Donut series label color

2 posts, 0 answers
  1. Paul
    Paul avatar
    9 posts
    Member since:
    Feb 2014

    Posted 10 Dec 2014 Link to this post

    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?
  2. Daniel
    Admin
    Daniel avatar
    2230 posts

    Posted 12 Dec 2014 Link to this post

    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!
     
Back to Top