huww98 / huww98/TimeChart

Dynamic update series ?

Open
#61 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
404
Forks
35
PR merge metrics
No merged PRs in 30d

Description

How to dynamic update series ?

tried variant 1
```js
componentDidUpdate(prevProps) {
if (this.props.data.series !== prevProps.data.series && this.chart !== null) {
this.chart.options.baseTime = this.props.data.baseTime;
this.chart.options.series = this.props.data.series;
this.chart.update();
}
}
```
tried variant 2
```js
componentDidUpdate(prevProps) {
if (this.props.data.series !== prevProps.data.series && this.chart !== null) {
this.chart.options.series = [];
this.chart.update();
this.chart.options.baseTime = this.props.data.baseTime;
this.chart.options.series = this.props.data.series;
this.chart.update();
}
}
```
This examples duplicate series. Should it be completely destroyed ?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.