Highcharts - show tooltip

I have a chart with a high graph, and I let the user dynamically create their own flags. Now I want to be able to click on the flag itself and be able to hold it with a tooltip, showing all the time until I click on the flag again. The reason for this is to allow the user to attach special importance to the points, and when they save the graph as an image, I want it to display information about the tooltip on which they stayed.

Does anyone know how to do this or get around this? I can't figure out how to access the flags tooltip

plotOptions: { series: { allowPointSelect: true, animation: false, dataGrouping: { force: true, smoothed: true } }, line: { allowPointSelect: true, animation: false, point: { events: { click: function () { var thePoint = this; var previousFlag = findFlag(thePoint); if (previousFlag != null) { previousFlag.remove(); } else { createFlagForm(thePoint); } } } } }, flags: { point: { events: { click: function() { //How to access the tooltip? this means the flag point itself } } }, tooltip: { useHTML: true, xDateFormat: "%B-%e-%Y %H:%M" } } }, 
+4
source share
1 answer

I just whipped it. When you click a point, it will be saved with a tooltip. He does this by cloning the svg tooltip element and adding it to the chart.

Here's the fiddle .

 $(function () { cloneToolTip = null; chart = new Highcharts.Chart({ chart: { renderTo: 'container' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, plotOptions: { series: { cursor: 'pointer', point: { events: { click: function() { if (cloneToolTip) { chart.container.firstChild.removeChild(cloneToolTip); } cloneToolTip = this.series.chart.tooltip.label.element.cloneNode(true); chart.container.firstChild.appendChild(cloneToolTip); } } } } }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); });​ 
+32
source

All Articles