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

Using category label in tooltip

1 Answer 970 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 06 May 2016, 05:29 PM

I apologize if this has been asked already, but I have looked all over and found nothing. I am looking to see if there is a way to use the category label as a display value in a chart tooltip template. I have tried using the category property, but that really only seems usable in the use of a pie chart. In my case I am using a column chart that is being plotted by date. So when I use category in my tooltip, I get something like this: Tue Mar 01 2016 00:00:00 GMT-0600 (Central Standard Time). I can't just apply a date format to the category, because the charting code we have is being used generically, so the category will not always be a date. I would prefer to be able to just use the label on the category (Mar '16). Is that possible? Or is there some other available property to get the formatted value that is used on the axis? Or some other solution?

 

Template code:

tooltip: {
    visible: true,
    template: "#= series.name # - #= category #: #= value #"
},
    labels: {
        template: "#= value #"
    }

 

Current tooltip

Total Expenses by Period - Tue Mar 01 2016 00:00:00 GMT-0600 (Central Standard Time): $936,248.35

Desired tooltip

Total Expenses by Period - Mar '16: $936,248.35

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 10 May 2016, 06:11 AM
Hi Matt,

To achieve the expected result you should format the date category in the tooltip template. As an example: 
//....
tooltip: {
    visible: true,
    template: "#= series.name # - #= kendo.toString(category, 'MMM/yy') #: #= value #"
},


Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Charts
Asked by
Matt
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or