Ryan Taylor

Load linkeddata chart async on click react-native charts

Recommended Posts


I have a chart of data and I'm trying to asynchronously load data for a linked chart on click of a column2d data point. Specifically, the main chart returns data by year, and I want to, on click of the bar chart item for a given year, make a server call to load the next set of data for the year clicked. I've tried to tap into dataPlotClick, beforeRender, beforeLinkedItemOpen, linkedChartInvoked, linkedItemOpened and more events to try and update dataSource.linkeddata before the linked graph loads, with no success. I know that the update works, however, because, if I click the back button on the linkedchart, and then click into the dataplot again, it will show up on subsequent linkedchart clicks, just not the first time I click into the linked chart.

What am I doing wrong? Is what I want to achieve possible with this charting functionality?

Additional details: I'm using the react-native modules and my initial chart data loads from the fetch command without issue. The essence of my code is that on click (let's go with dataPlotClick), make the fetch call with the relevant .then() statements and populate this.state.dataSource.linkeddata with the new data before the graph renders. 

To remove variables, I tried to just populate linkeddata from a hard coded array (no api call) in the dataPlotClick callback (plus all the other events listed above) and it still doesn't show the chart the first time you drill down.

Help would be greatly appreciated!


Share this post

Link to post
Share on other sites

Hi Ryan,

I hope you are doing good.

For drill-down chart you need to load the parent and child data at the beginning i.e. while rendering the parent chat the child chart data also needs to be loaded, as of now it is not possible to load child chart data asynchronously.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now