Dont use this.refs.chart.getChart
See original GitHub issueIn the README.md you describe the update mechanism as follows:
componentDidMount() {
let chart = this.refs.chart.getChart();
chart.series[0].addPoint({x: 10, y: 12});
}
render() {
return <ReactHighcharts config={config} ref="chart"></ReactHighcharts>;
}
this is not the react way it should be updated via the react state so for example:
componentDidMount() {
this.setState(
{ series: this.series(),
xAxis: { categories: this.categories() }
}
);
}
render() {
return (<ReactHighcharts config={this.state}/>);
}
while the highchart config is represented as component stat
Issue Analytics
- State:
- Created 7 years ago
- Reactions:9
- Comments:12 (1 by maintainers)
Top Results From Across the Web
trying to set the state of react-highcharts, but it isn't working?
The code you show kicks off during componentDidMount , e.g. at the time of first render() (and unless your initial state assigned some...
Read more >API | Chart.js
Returns the stored visibility state of an data index for all datasets. Set by toggleDataVisibility. A dataset controller should use this method ...
Read more >Build with React -- Calling series.events in outside method
I was able to get access to the chart using: Code: Select all let chart = this.refs.chart.getChart();. But I can't figure out how...
Read more >Getting Started - vue-chartjs
For this purpose, you should utilize Vue.js props to pass in chart options and chart data. This way, the parent component itself does...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think someone is programming a proper (reactive) version of react highcharts: https://github.com/whawker/react-jsx-highcharts
So this issue might be closed and people could be referred to this project, if they want a reactive approach.
@haydencarlson sorry but i couldn’t disgree more, addPoint is the hack, modifing reacts state is the correct way, example: https://github.com/madnight/githut/blob/master/src/js/components/LangChart.js#L108