Hi!
KendoUI is fantastic, however one problem. I am trying to set a custom template on a column chart for its tooltip, however it seems to be unable to find the fields specified.
Datasource:
Code:
The 'Max' and when changed 'Capacity' renders correct columns. But the template can't find either fields and throws a NullReferenceException.
Thanks in advance for your pro-tips ;-) !
Finest regards.
KendoUI is fantastic, however one problem. I am trying to set a custom template on a column chart for its tooltip, however it seems to be unable to find the fields specified.
Datasource:
var
usageData = @Html.Raw(@ServiceStack.Text.JsonSerializer.SerializeToString(Model.ParkingStats));
Code:
$(
'#chart-utilization'
).kendoChart({
title: {
text:
"Parking utilization for week"
},
dataSource:{
data: usageData[0].Usage
},
series:[{
type:
"column"
,
field:
"Max"
,
name:
"Max utilization"
}],
categoryAxis:{
field:
"Week"
},
tooltip: {
visible:
true
,
template:
"${ Max } of ${ Capacity }"
},
legend: {
visible:
false
}
});
The 'Max' and when changed 'Capacity' renders correct columns. But the template can't find either fields and throws a NullReferenceException.
Thanks in advance for your pro-tips ;-) !
Finest regards.
6 Answers, 1 is accepted
0

Dennis
Top achievements
Rank 1
answered on 15 Feb 2012, 03:07 PM
0
Accepted
Hello Dennis,
Tooltip templates work with predefined variables. More information and example can be found in corresponding documentation.
In your case, try to change the template property to:
I hope this will solve your problem.
Regards,
Alexander Valchev
the Telerik team
Tooltip templates work with predefined variables. More information and example can be found in corresponding documentation.
In your case, try to change the template property to:
template:
"#= value # of #= category #"
I hope this will solve your problem.
Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Dennis
Top achievements
Rank 1
answered on 15 Feb 2012, 03:38 PM
Thanks again!template: "${value} of ${dataItem.Capacity}"
Works, is there a reason for using #= value # ? Just for reference and other people, the working JSFiddle: http://jsfiddle.net/3fW95/6/
ps. After all your help today, I am confident about the support you guys deliver and will buy a license directly after finishing this post!
0
Hi Dennis,
Thank you for the nice words.
You could use whichever syntax you prefer. In the newest version of the framework we introduced #: # for conformance with #= #. ${} was kept for compatibility, but both of them do the same job.
Kind regards,
Alexander Valchev
the Telerik team
Thank you for the nice words.
You could use whichever syntax you prefer. In the newest version of the framework we introduced #: # for conformance with #= #. ${} was kept for compatibility, but both of them do the same job.
Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Dennis
Top achievements
Rank 1
answered on 15 Feb 2012, 05:54 PM
Hi!
Any rational behind the newly introduced way? I'd like to use the best practise, but not sure if there is one.
Any rational behind the newly introduced way? I'd like to use the best practise, but not sure if there is one.
0
Hi Dennis,
You should use the one that best fits to your requirements.
${} can be also used for HTML encoding in templates as shown in this examples.
Kind regards,
Alexander Valchev
the Telerik team
You should use the one that best fits to your requirements.
${} can be also used for HTML encoding in templates as shown in this examples.
Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!