Programmatically Created Chart and Clienttemplate for tooltips

3 posts, 1 answers
  1. marco
    marco avatar
    33 posts
    Member since:
    Sep 2007

    Posted 18 Mar 2015 Link to this post

    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. Answer
    Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 19 Mar 2015 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. marco
    marco avatar
    33 posts
    Member since:
    Sep 2007

    Posted 19 Mar 2015 Link to this post

    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\")#%";


Back to Top