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

Programmatically Created Chart and Clienttemplate for tooltips

2 Answers 431 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
marco
Top achievements
Rank 2
marco asked on 18 Mar 2015, 11:41 PM
I'm trying to personalize the clienttemplate, formatting numbers, and putting percentage

For a stacked 100% bar chart I have the following:

series.TooltipsAppearance.ClientTemplate = "#= dataItem.categoryName#<br/>#= dataItem.categoryValue#";

It works perfectly, but I want to display only three decimals for categoryValue.

If I try to add kendo.format(...), as I see in some example online, the chart is not shown anymore...

I'd like to show also the percentage of category value (the chart is a stack100 type)

2 Answers, 1 is accepted

Sort by
0
Accepted
Danail Vasilev
Telerik team
answered on 19 Mar 2015, 12:10 PM
Hello Marco,

When you use the kendo.format() method from code behind you should ensure the quotes are escaped with double back slashes. For example #=kendo.format(\\'{0:N2}\\', value)#. More information is available in this article - http://www.telerik.com/help/aspnet-ajax/htmlchart-troubleshooting-escaping-special-symbols.html.

Regards,
Danail Vasilev
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
marco
Top achievements
Rank 2
answered on 19 Mar 2015, 01:40 PM
thank you very much, it works perfectly.

..and I've discovered that I can format also like this:

TooltipsAppearance.ClientTemplate = "Category: #= dataItem.cat1Name# <br/> Value: #= dataItem.cat1Val.format(\"N2\")# <br/> #=(percentage*100).format(\"N2\")#%";


Tags
Chart (HTML5)
Asked by
marco
Top achievements
Rank 2
Answers by
Danail Vasilev
Telerik team
marco
Top achievements
Rank 2
Share this question
or