question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dont use this.refs.chart.getChart

See original GitHub issue

In 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:open
  • Created 7 years ago
  • Reactions:9
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
madnightcommented, Mar 9, 2018

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.

0reactions
madnightcommented, Sep 28, 2017

@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

Read more comments on GitHub >

github_iconTop 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 >
Get Chart Ref - react-chartjs-2
Example of getting ref in react-chartjs-2.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found