I'm trying to set shared tooltip between charts. It works nice only if tooltip doesn't have shared: true
, if I set shared: true
I get error:
TypeError: 'undefined' is not an object (evaluating 'a[0].category') highcharts.js:3259
I prepared example: http://jsfiddle.net/CAKQH/24408/
If you move cursor on first chart - it works nice, also if you comment shared: true
it works, but if you move cursor on second chart you'll get an error.
Did someone faced this error? Help me to solve it, please.
The problem occurs because you have
shared: true
on one chart, while having it default (false) on the other. This is a problem because thetooltip.refresh
method will take different paths and use the input differently based the chart having shared set to true or false.You can find this branching in the source code on line 8806, for the
tooltip.refresh
method:You can handle this by doing a branching inside your
syncTooltip
method to handle the different cases like this (example JFiddle):This way you can freely set shared to true or false on both charts.
Unfortunately your
plotOptions.series.point.events.mouseOver
-event doesn't capture points that are "selected" through theshared: true
functionality, so you will have to find an alternate event to properly capture this situation.