Note that there are some explanatory texts on larger screens.

plurals
  1. POShowing Tool-tip & Cross-hair on two independent graphs from a single hover event?
    primarykey
    data
    text
    <p>Good day,</p> <p>We are trying to develop a report which contains two charts. Each chart shows different metrics on the same timescale (unix timestamp). The aim is to show the tooltip &amp; cross hair on both charts regardless of which you hover over. </p> <p>In my head I would like to get the xAxis timestamp (time) from the tooltip hover event on chart A. I would then fetch the associated series on chart B and trigger the tooltip refresh event.</p> <p>As it stands, it looks like highcharts only accepts points.</p> <p>I've added a mouseOver/Out event to both charts. This obtains the hoverPoints</p> <pre><code> plotOptions: { series: { point: { events: { mouseOver: function () { $el.trigger('tooltip-open', {"$sourceEl": $el[0], "point": this}); }, mouseOut: function () { $el.trigger('tooltip-close', {"$sourceEl": $el[0], "point": this}); } } } } } </code></pre> <p>// Where $el is the highcharts container // ..and tool-tip-XXXXX is a custom jQuery event.</p> <p>My temporary work around is: $el.bind('tooltip-open', function (e, data) { var $el = $(this);</p> <pre><code> if (data.$sourceEl.id == $el.id) { return; } var chart = $el.highcharts(); var points = $(chart.series).map(function () { return this.points }).get(); var pointsForTimestamp = $.grep(points, function (p) { return p.x == data.point.x; }); $(pointsForTimestamp).each(function () { this.setState('hover'); }); chart.tooltip.refresh(pointsForTimestamp); }); $el.bind('tooltip-close', function (e, data) { var $el = $(this); if (data.$sourceEl.id == this.id) { return; } var chart = $el.highcharts(); chart.tooltip.hide(); }); </code></pre> <p>var linkGraphs = function ($elA, $elB) {</p> <pre><code>function isEventHandled(data){ data.count = data.count || 0; if(data.count &gt; 0){ return true }else{ data.count++; return false; } } function bindToOpen($elA, $elB) { $elA.bind('tooltip-open', function (e, data) { if(!isEventHandled(data)){ $elB.trigger('tooltip-open', data); } }); } function bindToClose($elA, $elB) { $elA.bind('tooltip-close', function (e, data) { if(!isEventHandled(data)){ $elB.trigger('tooltip-close', data); } }); } bindToOpen($elA, $elB); bindToOpen($elB, $elA); bindToClose($elA, $elB); bindToClose($elB, $elA); </code></pre> <p>};</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload