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

Switching chart to shared tooltip with javascript

2 Answers 214 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 01 Feb 2019, 08:24 PM

I've tried to simplify the code as much as possible with this example:

https://dojo.telerik.com/aJARADIk

If I create a chart with a shared tooltip, I can switch back and forth between shared and unshared tooltips without issue. If I create a chart with an unshared tooltip and try to set shared = true in the options, then redraw the chart, the tooltip will not display on hover. It will display on click, but even showOn = "mouseenter" will not help.

I've compared the options objects between the two charts in the example and they are essentially identical with a few spots where the series tooltip is still false or the font is set. The commented out code is meant to show that fixing these differences does not make this work.

At this point, I'm assuming that creating the chart with shared = true does something that shared = false does not, e.g. registering events for the shared tooltip, but I can't figure out what it is. Is there something that needs to be done in addition to setting shared = true or is this a bug that needs to be reported?

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 05 Feb 2019, 02:25 PM
Hello Joe,

Since this change does not require only changes to the Chart, but to the externally rendered tooltip as well, it needs to be applied using the setOptions method of the Chart, which will re-create the widget with the new options:
var chart = $("#chart").data("kendoChart");
chart.setOptions({tooltip: { shared: true }});

Here is the updated example:
https://dojo.telerik.com/aJARADIk/3

Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Joe
Top achievements
Rank 1
answered on 05 Feb 2019, 08:44 PM
Thank you. That solved the issue.
Tags
Charts
Asked by
Joe
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Joe
Top achievements
Rank 1
Share this question
or