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

Changing chart tooltip dynamically

3 Answers 336 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 03 Oct 2013, 08:11 PM
I'm trying to change the chart tooltip each time a different series of data is displayed, to match the units of the data (some data are measured in inches, other data in degrees).

chart.options.tooltip.template = "{0}°";
or 
chart.options.tooltip.template = "{0} in.";
It seems that changing the tooltip has no effect whatsoever on the chart. 

I've included a link to the jsFiddle in which I am working: http://jsfiddle.net/raltman/4j7LV/22/

I've also tried using the setOptions methods described in the chart API documentation; the result of which was that the chart never even rendered on page.

How should this be handled?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 04 Oct 2013, 08:11 AM
Hi Robert,

You need to call chart.setOptions() in order to change the chart configuration and you need to change a little bit your configuration logic.

Live example: http://jsfiddle.net/4j7LV/28/

Regards,
Hristo Germanov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
James
Top achievements
Rank 1
answered on 29 Oct 2015, 08:46 PM

I'm trying to do a similar thing in my code, but the fiddle seems to be gone.  In my dataBound function I have the following code which seems to do nothing.  chartData is a JSON object.  I am able to set other fields using this style and format.

chart.options.tooltip.visible = chartData.tooltipVisible;
chart.options.tooltip.template = chartData.tooltipTemplate;

On a similar note, is it possible to change the series name at this point.  I am trying to make my chart configurable where I can use the same options set up but display different charts based on data passed from the server.  I have tried:

chart.options.series[i].name = chartData.dataName;
When I do this only only see the contents of chartData.dataName (#= group.value #) not the group value.  Is it possible for me to set this information dynamically?

 

 

0
Iliana Dyankova
Telerik team
answered on 02 Nov 2015, 03:46 PM
Hi James,

You could dynamically change chart options via its setOptions method. For your convenience here is a dojo example.

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
Robert
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
James
Top achievements
Rank 1
Iliana Dyankova
Telerik team
Share this question
or