GithubHelp home page GithubHelp logo

Comments (1)

ppotaczek avatar ppotaczek commented on August 29, 2024 1

Hi @rohankk2,

After setState, the highcharts-react wrapper uses chart.update() to update chart options, which are merged, not overwritten.

API: https://api.highcharts.com/class-reference/Highcharts.Chart#update

In your case the best way to achieve the wanted result is to create two HighchartsReact components and display them alternately depending on some condition.

  render() {
    return (
      <div>
        {this.state.displayedChart === 1 && (
          <HighchartsReact
            highcharts={Highcharts}
            constructorType={"chart"}
            options={this.state.options}
          />
        )}
        {this.state.displayedChart === 2 && (
          <HighchartsReact
            highcharts={Highcharts}
            constructorType={"chart"}
            options={this.state.options}
          />
        )}
      </div>
    );
  }

Live demo: https://codesandbox.io/s/xp63rx42y4

We are trying to keep github only for bugs, so for future please ask this type of questions on support: https://www.highcharts.com/support

from highcharts-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.