Color and Legend in KendoReact bubble chart

1 Answer 57 Views
Charts
Derek
Top achievements
Rank 1
Derek asked on 31 Mar 2022, 02:49 PM

I am generating a bubble chart in my React app, but all items are the same color. Is there any way to have each category automatically show as a different color? I see the colorfield prop, but I don't want to have to manually generate colors, and the number of categories can vary.

Also I've set the legend visible: true, but the legend doesn't appear. Is it possible to have a legend on a bubble chart?

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 01 Apr 2022, 09:45 AM

Hello,

Regarding both questions:

1) The color can be set via the colorField property. We can add the color as part of the data:

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

Each item will have its own color regardless of how many items they are.

2) The legend is for the different series, in that case, we have only one series. It is not shown per category. The legend also required the series to have a name.

I made an example with both:

https://stackblitz.com/edit/react-cmkbhc?file=app%2Fmain.jsx

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.

Tags
Charts
Asked by
Derek
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or