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

How to access the Dates/Category in the shared tooltip

4 Answers 209 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Vimal
Top achievements
Rank 1
Vimal asked on 09 Nov 2013, 02:18 AM
Hi ,

We would like to format the category/date in the shared tooltip.
Just for convenience we have attached one screen shot to highlight the particular element.

In our case the category is date ( we want to format in "MMM dd" style in the shared tooltip) .

Thanks
 

4 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 12 Nov 2013, 03:50 PM
Hi Vimal,

By design you should be able to achieve this using a sharedTemplate for the tooltip, however there is a bug in the current version of Kendo UI and using such a template it is not possible to reach the points. We are currently working on this problem and will do our best to provide a solution as soon as possible. Please excuse us for the inconvenience caused.

Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ehtesham
Top achievements
Rank 1
answered on 30 Oct 2015, 02:14 PM

Hello,

I facing a similar situation and would like to find out how to achieve this in MVC. Is the bug still an issue in latest build?

Thanks,
Ehtesham

0
Ehtesham
Top achievements
Rank 1
answered on 30 Oct 2015, 02:58 PM

 

Also, is it possible to access any other data item in SharedTemplate? Let's say I want to display the category ID along the category name. Is this achievable?

 Thanks!

0
Iliana Dyankova
Telerik team
answered on 03 Nov 2015, 09:50 AM
Hello Ehtesham,

This is a pretty old thread and the discussed issue has been already addressed. Up to your other questions: 
- ...and would like to find out how to achieve this in MVC...
You could use SharedTemplate in Kendo UI Chart for ASP.NET MVC too. Below is the syntax: 
@(Html.Kendo().Chart<Kendo.Mvc.Examples.Models.ElectricityProduction>()
    .Name("chart")
    //....
    .Tooltip(tooltip => tooltip
       .Visible(true)
       .Shared(true)
       .SharedTemplate("#= sharedTooltiptemplate(points, category) #")
    )
)
 
<script>
function sharedTooltiptemplate(points, category) {
   //....
}
</script>

- ...Let's say I want to display the category ID...
In the sharedTemplate you could reach the category name, you could easily get its index using additional JavaScript. As an example: 
@(Html.Kendo().Chart<Kendo.Mvc.Examples.Models.ElectricityProduction>()
    .Name("chart")
    //....
    .Tooltip(tooltip => tooltip
       .Visible(true)
       .Shared(true)
       .SharedTemplate("#= sharedTooltiptemplate(points, category) #")
    )
)
  
<script>
function sharedTooltiptemplate(points, category) {
   var currentCategory = category,
     chart = $("#chart").data("kendoChart"),
     allCategories = chart.options.categoryAxis.categories;
 
   console.log($.inArray(currentCategory, allCategories));
}
</script>


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
Vimal
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Ehtesham
Top achievements
Rank 1
Share this question
or