Can I display custom tooltips on a pie chart via a callback?

2 posts, 0 answers
  1. Rik
    Rik avatar
    5 posts
    Member since:
    Apr 2012

    Posted 12 Jun 2012 Link to this post

    I have data that is in minutes, but I want to display the tooltip in hours and minutes. For example, if value was 200, the displayed tooltip would be "3 hours 20 minutes". 

    I know I can use the templates to display a custom tooltip that is made up of the value and text, but I need to do more manipulation of the value to make it more friendly.


  2. Iliana Nikolova
    Iliana Nikolova avatar
    2622 posts

    Posted 15 Jun 2012 Link to this post

    Hi Rik,

    To achieve this you could create a function which implement the logic you need and call it in the tooltip. For example: 
      tooltip: {
          visible: true,
           template: "#= templateFormat(value) #"
    function templateFormat(value) {
       var hours = Math.floor(value/60);
       var minutes = Math.floor(value%60);
       return hours + " hours " + minutes + " minutes";

    For convenience, I created a simple project which illustrates such approach in action.


    Iliana Nikolova
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top