mirror of
https://github.com/flarum/core.git
synced 2025-08-01 14:10:37 +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) {
|
drawChart(elm, isInitialized, context) {
|
||||||
|
if (context.chart && context.entity === this.selectedEntity && context.period === this.selectedPeriod) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const entity = this.selectedEntity;
|
const entity = this.selectedEntity;
|
||||||
const period = this.periods[this.selectedPeriod];
|
const period = this.periods[this.selectedPeriod];
|
||||||
const labels = [];
|
const labels = [];
|
||||||
@@ -121,12 +125,12 @@ export default class StatisticsWidget extends DashboardWidget {
|
|||||||
format_tooltip_x: d => d,
|
format_tooltip_x: d => d,
|
||||||
format_tooltip_y: d => d
|
format_tooltip_y: d => d
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
context.chart.update_values(datasets, labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.chart.update_values(
|
context.entity = this.selectedEntity;
|
||||||
datasets,
|
context.period = this.selectedPeriod;
|
||||||
labels
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeEntity(entity) {
|
changeEntity(entity) {
|
||||||
|
Reference in New Issue
Block a user