Gerrie van Wyk Gerrie van Wyk - 1 year ago 247
React JSX Question

How to envoke a method on a react component (Amcharts-React)

Is there a way to evoke a method on a chart. Such as:


I'm struggling to find a handle for the chart object.
To render the chart i use:

<AmCharts ref={`chart_${this.props.tileid}`} {...this.chart} dataProvider={} />

I tried to inspect the element to see if I can access these methods through:

ch = this.refs[`chart_${this.props.tileid}`]

However in the 'ch' object I can not seem to find any of the methods mentioned in:

How would one reference a element to evoke a method on it?

Answer Source

The amchart3-react component sets the chart as a state. Thus the method can be evoked by calling:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download