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
Bar Charts not updating correctly on dataset change #29
Comments
@sbatson5 the It seems we keep running into edge cases with the automatic updating. I'm hoping Chartjs version 2 will fix all of these hacks once it's stable. |
what if you passed the type to chart-data-updater? var redraw = ChartDataUpdater.create({
data: data,
chart: chart,
type: type
}).updateByType(); Then specified the type: if (chart.datasets.length !== datasets.length) {
return this.set('redraw', true);
} else if (this.get('type') === 'Bar' && chart.datasets[0].bars.length !== datasets[0].data.length) {
return this.set('redraw', true);
} |
Misunderstood your first reply. Revised to: if (chart.datasets.length !== datasets.length) {
return this.set('redraw', true);
} else if (typeof chart.datasets[0].bars !== 'undefined') {
if (chart.datasets[0].bars.length !== datasets[0].data.length) {
return this.set('redraw', true);
}
} |
@aomra015 Opened a PR with the above revision and unit test. |
@aomra015 Have you had a chance to look at the PR I opened regarding updating bar charts on dataset length changes? Let me know if it looks good or if you see any issues. |
I'll try to find some time this weekend to review this. Thanks ! |
merged |
👍 Thanks! |
Thanks for all the work on ember-cli-chart. I have an issue where we track interest payments over sets of years, with 2 data points:
However, when the loan is paid off faster than 10 years, the chart should update. Here is the default behavior:
To solve this, I edited chart-data-updater to check to see if the bars length matched our new dataset length:
Is there a better way to do this? Would it make sense to also confirm that the type is bar?
The text was updated successfully, but these errors were encountered: