amcharts / amcharts3-react

Official amCharts V3 React component
Apache License 2.0
118 stars 50 forks source link

Having trouble adding/removing graphs #42

Closed ryantaylor closed 7 years ago

ryantaylor commented 7 years ago

I'm able to create a chart with an arbitrary number of graphs no problem, but if I try to go back and change the graphs after the chart has been created I'm getting errors. Is there a proper way to add or remove graphs with the React component? I see that there is an addGraph method in vanilla AmCharts, but I don't know how to access it through the component. Right now I'm just updating the graphs prop on the AmCharts component, but when I do that it gives me an error:

Uncaught TypeError: Cannot read property 'values' of undefined
    at Object.stackGraphs (application-140b667….js:77674)
    at Object.updateData (application-140b667….js:77656)
    at Object.draw (application-140b667….js:77658)
    at Object.zoom (application-140b667….js:77636)
    at b.zoomAxesAndGraphs (application-140b667….js:172445)
    at b.zoomAxesAndGraphs (application-140b667….js:172461)
    at b.timeZoom (application-140b667….js:172458)
    at b.zoom (application-140b667….js:172457)
    at b.drawChart (application-140b667….js:172454)
    at b.onDataUpdated (application-140b667….js:172449)
    at b.initChart (application-140b667….js:172449)
    at b.afterWrite (application-140b667….js:77711)
    at b.write (application-140b667….js:77707)
    at b.validateNow (application-140b667….js:77734)
    at Object.componentDidUpdate (eval at <anonymous> (application-140b667….js:12325), <anonymous>:264:26)
    at measureLifeCyclePerf (eval at <anonymous> (application-140b667….js:2965), <anonymous>:75:12)
Pauan commented 7 years ago

@ryantaylor Make sure you're using version 2.0.1 of amcharts3-react

You can find instructions on how to upgrade to version 2.0 here