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

Trouble with lables template

2 Answers 49 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Alan Mosley
Top achievements
Rank 1
Alan Mosley asked on 03 Jun 2014, 04:47 PM
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 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 04 Jun 2014, 11:04 AM
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.

 
0
Alan Mosley
Top achievements
Rank 1
answered on 04 Jun 2014, 11:48 AM
Thanks, that did the trick
Tags
Chart
Asked by
Alan Mosley
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Alan Mosley
Top achievements
Rank 1
Share this question
or