Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scatter Chart #129

Closed
daniel-shuy opened this issue Jun 27, 2017 · 4 comments
Closed

Scatter Chart #129

daniel-shuy opened this issue Jun 27, 2017 · 4 comments
Assignees
Milestone

Comments

@daniel-shuy
Copy link
Contributor

Hi, I would like to suggest to either create a Scatter component, or include the steps to create one from a Line component in the documentation (it took me a really long time to figure this out, so I'm hoping this will help prevent others from running into the same trouble).

With vanilla chart.js, you could do:

new Chart(ctx, {
    type: 'scatter',
    // ...
})

which is syntactic sugar for:

new Chart(ctx, {
    type: 'line',
    // ...
    options: {
        scales: {
          xAxes: [{
            type: 'linear',
            position: 'bottom'
          }]
        }
    }
})

It would be nice if we could simply do:

export default Scatter.extend({
    // ...
})

with vue-chartjs to create a Scatter Chart.

@daniel-shuy
Copy link
Contributor Author

Turns out, the type: 'scatter' syntactic sugar actually consists of more than the options I listed above (I don't even know the full list myself, may have to dig into Chart.js' source code to find out).

I noticed that the Scatter chart also modified tooltips.callbacks.label.

It would be way easier to simply pass in type: 'scatter', than to try and implement the options provided by it manually.

@apertureless
Copy link
Owner

If I find some time, I will get into it. Passing the type however would break with the consistency and would introduce a lot of confusion I guess.

We have this some time ago with the horizontal Barchart, which accepted a third argument in the renderChart method. This however introduced also some side effects. Especially in the reactive Mixins which would not work, because in certain scenarios they call the renderChart() method, and would not know about the third argument.

The

export default Scatter.extend({
    // ...
}

would be imo the cleanest and most consistent way of doing it.

@daniel-shuy
Copy link
Contributor Author

Yes I agree with you, creating a new Class is better than passing an argument type. I was actually talking about how to go about implementing it, sorry if I was being confusing.

@apertureless
Copy link
Owner

Added with PR #136
Will be available with version 2.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants