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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user