Skip to content

Commit

Permalink
chore: clone in update
Browse files Browse the repository at this point in the history
  • Loading branch information
uhrjun committed Nov 28, 2022
1 parent 2bb46a0 commit 9dce5cf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/js/charts/BaseChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,13 @@ export default class BaseChart {
if (init) {
this.data = this.realData;
setTimeout(() => {
this.update(this.data);
this.update(this.data, true);
}, this.initTimeout);
}

this.renderLegend();
if (this.config.showLegend) {
this.renderLegend();
}

this.setupNavigation(init);
}
Expand Down Expand Up @@ -264,14 +266,12 @@ export default class BaseChart {
this.components = new Map();
}

update(data) {
if (!data) {
console.error("No data to update.");
}
update(data, drawing = false) {
if (!data) console.error("No data to update.");
if (!drawing) data = deepClone(data);
this.data = this.prepareData(data);
this.calc(); // builds state
this.render(this.components, this.config.animate);
this.renderLegend();
}

render(components = this.components, animate = true) {
Expand Down

0 comments on commit 9dce5cf

Please sign in to comment.