1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

Only update chart values if needed

This commit is contained in:
Toby Zerner
2017-12-11 18:52:54 +10:30
parent 3f1f92b565
commit b65ad8a5ce

View File

@@ -87,6 +87,10 @@ export default class StatisticsWidget extends DashboardWidget {
}
drawChart(elm, isInitialized, context) {
if (context.chart && context.entity === this.selectedEntity && context.period === this.selectedPeriod) {
return;
}
const entity = this.selectedEntity;
const period = this.periods[this.selectedPeriod];
const labels = [];
@@ -121,12 +125,12 @@ export default class StatisticsWidget extends DashboardWidget {
format_tooltip_x: d => d,
format_tooltip_y: d => d
});
} else {
context.chart.update_values(datasets, labels);
}
context.chart.update_values(
datasets,
labels
);
context.entity = this.selectedEntity;
context.period = this.selectedPeriod;
}
changeEntity(entity) {