Kendo UI React.js Chart Legend Customization

1 Answer 281 Views
Charts Labels  Styling Styling / Themes
Pierre
Top achievements
Rank 1
Pierre asked on 30 Mar 2022, 07:03 AM

Please help me solve this case,

how to make a chart legend look like this ?

I'm using kendo react, and I'm having trouble customizing the legend to look like in the image, can someone help me?

 

Thank you 🙏

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 30 Mar 2022, 08:06 AM

Hello,

There are two options:

1) Programmatically draw shapes in the legend as it is an SVG and we have to draw all elements:

https://www.telerik.com/kendo-react-ui/components/charts/api/ChartLegendItemProps/#toc-visual

More details on the drawing API:

https://www.telerik.com/kendo-react-ui/components/drawing/

2) Another option, in this case, is the custom external legend. We have many customers using this approach for these cases as it allows nice flexibility and keeps all of the information in the state. It requires rendering items for each series and dynamically showing and hiding them based on which one is clicked.

I made an example with an external legend to show a possible approach:

https://stackblitz.com/edit/react-ujkzeh-jmvjmh?file=app/main.jsx

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Pierre
Top achievements
Rank 1
commented on 31 Mar 2022, 04:41 AM

Solved!
Thank you for your help, sir 🙏
Tags
Charts Labels  Styling Styling / Themes
Asked by
Pierre
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or