This is a migrated thread and some comments may be shown as answers.

[Solved] Donut series label color

1 Answer 195 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 10 Dec 2014, 05:47 PM
My data contains a color field, e.g. {"category": "Age", "value": 6, "color": "#ffd800" }

I want to use the color in the record to format the label text for that category.

This works (hard-coded):

.Labels(labels => labels.Color("#ff0000"))

These don't:

.Labels(labels => labels.Color("color"))
.Labels(labels => labels.Color("#= color #"))
.Labels(labels => labels.Color("#= dataItem.color #"))

I've confirmed that the color field is accessible.

How can this be done?

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 12 Dec 2014, 02:43 PM
Hello Paul,

Setting a color based on the items is possible by setting a function for the color option. Currently an overload that accepts a function is not available for the wrapper so I can suggest to set the function in the dataBound event(live demo). We will include an overload for the wrapper in the next internal build.


Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Charts
Asked by
Paul
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or