chore: clone in update
This commit is contained in:
parent
2bb46a0c60
commit
9dce5cf5a8
@ -184,11 +184,13 @@ export default class BaseChart {
|
|||||||
if (init) {
|
if (init) {
|
||||||
this.data = this.realData;
|
this.data = this.realData;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.update(this.data);
|
this.update(this.data, true);
|
||||||
}, this.initTimeout);
|
}, this.initTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.renderLegend();
|
if (this.config.showLegend) {
|
||||||
|
this.renderLegend();
|
||||||
|
}
|
||||||
|
|
||||||
this.setupNavigation(init);
|
this.setupNavigation(init);
|
||||||
}
|
}
|
||||||
@ -264,14 +266,12 @@ export default class BaseChart {
|
|||||||
this.components = new Map();
|
this.components = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
update(data) {
|
update(data, drawing = false) {
|
||||||
if (!data) {
|
if (!data) console.error("No data to update.");
|
||||||
console.error("No data to update.");
|
if (!drawing) data = deepClone(data);
|
||||||
}
|
|
||||||
this.data = this.prepareData(data);
|
this.data = this.prepareData(data);
|
||||||
this.calc(); // builds state
|
this.calc(); // builds state
|
||||||
this.render(this.components, this.config.animate);
|
this.render(this.components, this.config.animate);
|
||||||
this.renderLegend();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(components = this.components, animate = true) {
|
render(components = this.components, animate = true) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user