Custom chart series children

1 Answer 87 Views
Charts
Tarjei
Top achievements
Rank 1
Tarjei asked on 14 Jun 2021, 09:01 AM

Im trying to create a dynamic chart series item that loads its own data instead of fetching everything in a parent component. Having trouble getting it to render.

Is there a obvious way to make this work? 🤷‍♂️

Example: https://stackblitz.com/edit/react-mqpaqe?file=app/main.jsx

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 14 Jun 2021, 09:40 AM

Hello, Tarjei,

This is because the ChartSeriesItem is a props collector component and the Chart internally checks for it. If the component is different it will be ignored.

This will require calling it as a method:

https://stackblitz.com/edit/react-mqpaqe-ahapl9?file=app/main.jsx

I hope this approach proves helpful.

Regards,
Stefan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tarjei
Top achievements
Rank 1
commented on 14 Jun 2021, 09:50 AM

Yes, I think this will work for me. Thanks Stefan 👍
Tarjei
Top achievements
Rank 1
commented on 14 Jun 2021, 11:44 AM

Seems theres issues with hooks if you call components like that. I will have to solve it another way.
Stefan
Telerik team
commented on 15 Jun 2021, 04:40 AM

Yes, indeed hooks have some restrictions on where functions can be called, but a similar approach has to be used. If additional assistance is needed, please share an example with the hooks issue.
Tags
Charts
Asked by
Tarjei
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or