Trouble with lables template

3 posts, 0 answers
  1. Alan Mosley
    Alan Mosley avatar
    200 posts
    Member since:
    Apr 2010

    Posted 03 Jun 2014 Link to this post

    I cant get labels to render correctly.

    series.Pie(Function(model) model.Value, Function(model) model.Key).Labels(Function(labels) labels.Template("#= Key #: #= Value #").Visible(True))

    This gives me an error "JavaScript runtime error: 'Value' is undefined"
    if I remove Value and use "#= Key #" I get I get a label like "[object Key]"

    Thanks


  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2619 posts

    Posted 04 Jun 2014 Link to this post

    Hi Alan,

    In the labels.template you can use the following fields: 
    - category;
    - dataItem;
    - series;
    - value;
    - percentage.
    Hence in order to achieve the expected result please try the following: 
    series.Pie(Function(model) model.Value, Function(model) model.Key)
      .Labels(Function(labels) labels.Template("#= dataItem.Key #: #= value #").Visible(True))

    Regards,
    Iliana Nikolova
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Alan Mosley
    Alan Mosley avatar
    200 posts
    Member since:
    Apr 2010

    Posted 04 Jun 2014 in reply to Iliana Nikolova Link to this post

    Thanks, that did the trick
Back to Top