Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a Kendo UI Pie chart tooltip contain the series category name?

I'm building a Kendo Chart in a razor view and have

 .Tooltip(tooltip => tooltip.Visible(true))

Is there any other function on the configuration action that I can use to include the series category title on the tooltip?

The documentation for Template() and Format() appear to be for JS implementations rather than razor implementations.

like image 915
StuperUser Avatar asked Sep 05 '12 13:09

StuperUser


2 Answers

Templates

Tooltip content can be defined with a Kendo Template when more flexibility is desired. The template provides access to all information associated with the point:

  • value - the point value. Value dimensions are available as properties, for example, value.x and value.y
  • category - the category name.
  • series - the data series.
  • dataItem - the original data item (when binding to dataSource).
like image 29
Rodolpho Brock Avatar answered Nov 04 '22 03:11

Rodolpho Brock


You can add in a specific template and format like so:

.Tooltip(tooltip => tooltip
    .Template("#=category# - #=value #")
    .Format("{0}%")
    .Visible(true)
)

This would give you a tooltip that looks like:

Hydro - 22%

I believe that using the Template and Format helpers together may cause some conflict, but you can add a format into the template like this:

.Template("#=category# - #=kendo.format('{0}', value)#")
like image 73
Alejo Avatar answered Nov 04 '22 01:11

Alejo