series.name is undefined on custom pie chart legend items

3 posts, 1 answers
  1. Brady
    Brady avatar
    2 posts
    Member since:
    Dec 2015

    Posted 14 Mar Link to this post

    I created a custom legend visual for some column charts we are using. When I tried to apply the same visual to a pie chart the series name is undefined. I see there is a e.options.series.data[] property but I have no way to figure out what index I am currently on. How do you create a custom legend item for a pie chart?

    I created an example of the issue. Line 56.

    http://plnkr.co/edit/WJ2J5Meor3AVC5pckhXk?p=preview

     

  2. Answer
    Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 16 Mar Link to this post

    Hello,

    The series.name will be undefined because the pie chart has a single series and a name is not set in the options. The text for the corresponding item would be the category from the point data which can be found from the series data and the argument pointIndex field:
    function drawLegendItem(e) {
        var seriesName = e.series.data[e.pointIndex].name;


    Regards,
    Daniel
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Brady
    Brady avatar
    2 posts
    Member since:
    Dec 2015

    Posted 16 Mar in reply to Daniel Link to this post

    That works perfect. I was looking for a property like that but I must have completely overlooked it. Thanks.
Back to Top