AnyChart / AnyChart-React

Intuitive and easy to use React plugin that allows you to create and work with AnyChart JavaScript Charts
https://www.anychart.com
Apache License 2.0
39 stars 30 forks source link

Cannot render multi-series chart #12

Closed jimmy-e closed 5 years ago

jimmy-e commented 5 years ago

Reproduce:

Issue: The multi-series chart does not show up. As mentioned here, the chart needs to be re-rendered to render the multi-column data. However, this does not seem feasible for the example repo, if the chart is part of a nested child component that cannot be directly re-rendered using the react-dom. (Using react-dom to render components more than once in the react spa is considered an anti-pattern).

Question: How can we render a mutli-series chart when using a nested react component?

Shestac92 commented 5 years ago

@jimmy-e In your case, there's no need to rerender the chart. You can create the multi-series chart in a single rendering. The plugin supports an approach of applying chart instance. It means that you can create the chart using the default library API and then apply the chart instance to the AnyChart React plugin. For details, check the sample.

jimmy-e commented 5 years ago

@Shestac92 , thanks. Is there any way to only way to create a multi-series chart in a single rendering via react props, as seen here, or are we limited to the default api and class methods? Thanks.

jimmy-e commented 5 years ago

@Shestac92 , closing this ticket. Using JSON configurations as well seems pretty satisfactory.