RayLoveless
RayLoveless

Reputation: 21048

kendo ui chart - add html and multiple values to series.Labels.Template

For this example:

http://dojo.telerik.com/arIhI/2

$("#chart").kendoChart({
  dataSource: {
    data: [
      { score: 1.1, legend: 'a' },
      { score: 2.5, legend: 'b' },
      { score: 3.25, legend: 'c' }
    ]
  },
  series: [{
    field: "score",   
    labels: {
      visible: true,
      template: "Score is: #: value #% legend is: ????"
    },
  }]
});

2 questions:

1) is it possibly to add html to the template ( say Value is: ....)?

2) is it possible to add multiple values to the label. I'd like to add score and the legend.

-Thanks.

Upvotes: 2

Views: 7058

Answers (1)

Jarosław Kończak
Jarosław Kończak

Reputation: 3407

1) Sure

template: "<b>Score is:</b> #: value #% legend is: ????"

is valid template.

2) Do it like this:

template: "Score is: #= dataItem.score #% legend is: #= dataItem.legend #"

or by using a function which I think is more convenient:

template: function(e) { return "Score is: " + e.dataItem.score + "% legend is: " + e.dataItem.legend }

UPDATE: It currently is not possible to add html to series.labels.templates.

Upvotes: 5

Related Questions