Skip to content

Dynamic update series ? #61

Description

@temaivanoff

How to dynamic update series ?

tried variant 1

  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

  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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions