How to create a HighCharts chart in react

前端 未结 3 967
-上瘾入骨i
-上瘾入骨i 2021-01-16 13:27

How can I create a component with a HighCharts chart, that create the chart ones on the first render and only update the series data when new data comes in using chart

3条回答
  •  囚心锁ツ
    2021-01-16 13:52

    As stated, you can use react-highcharts. It provides an example of how to update the chart on it's readme page:

    class MyComponent extends React.Component {
      componentDidMount() {
        let chart = this.refs.chart.getChart();
        chart.series.addPoint({x: 10, y: 12});
      }
    
      render() {
          return ;
      }
    }
    

提交回复
热议问题