Can a Kendo UI chart diagram tooltip include a series category name?

I create a kendo diagram in the form of a razor and

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

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

The documentation for Template() and Format() is provided for JS implementations, not razor implementations.

+4
source share
3 answers

You can add to a specific template and format it like this:

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

This will give you a tooltip that looks like this:

Hydro - 22%

I believe that using the template and format helpers together can lead to conflict, but you can add the format to the template as follows:

 .Template("#=category# - #=kendo.format('{0}', value)#") 
+8
source

Templates

Tooltip content can be defined using the Kendo template when more flexibility is required. The template provides access to all information related to the point:

  • value - the value of the point. Dimension sizes are available as properties, for example, value.x and value.y
  • category - category name. Series
  • - a series of data.
  • dataItem - the original data element (when binding to dataSource).
+3
source

You can use:

 .Tooltip(tooltip => tooltip .Visible(true) .Template("#= series.name #: #=kendo.format('{0:N0}', value)#") ) 

For example, it shows a tooltip:

 MySerie : 1.234.567 

If used only:

 .Tooltip(tooltip => tooltip .Visible(true) .Format("{0:N0}") .Template("#= series.name #: #= value #") ) 

He shows:

 MySerie : 1234567 
0
source

Source: https://habr.com/ru/post/1432482/


All Articles