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

Add chart data property setter and unit tests #3897

Merged
merged 1 commit into from
Feb 18, 2017

Conversation

simonbrunel
Copy link
Member

Chart data can now be entirely replaced using chart.data = {...} thanks to the new property setter (instead of using chart.config.data = {}). Also update the documentation, as suggested by @ldaguise and @kennethkalmer, with a note about versions prior 2.6.

Fixes #3891 #3785

Chart data can now be entirely replaced using `chart.data = {...}` thanks to the new property setter (instead of using `chart.config.data = {}`). Also update the documentation, as suggested by @ldaguise and @kennethkalmer, with a note about versions prior 2.6.
@@ -34,6 +34,8 @@ myLineChart.data.datasets[0].data[2] = 50; // Would update the first dataset's v
myLineChart.update(); // Calling update now animates the position of March from 90 to 50.
```

> **Note:** replacing the data reference (e.g. `myLineChart.data = {datasets: [...]}` only works starting **version 2.6**. Prior that, replacing the entire data object could be achieved with the following workaround: `myLineChart.config.data = {datasets: [...]}`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@kennethkalmer
Copy link

Thanks @simonbrunel & @etimberg!

@etimberg etimberg merged commit cc90c5c into chartjs:master Feb 18, 2017
@simonbrunel simonbrunel deleted the data-setter branch February 18, 2017 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants