I have a problem with Highcharts that I would like to ask.
I have a Highcharts, and I want to copy the preview symbol from legends to the tooltip.
I am doing this in 2 different case:
Extra information:
<svg>
and I don't actually know how to copy a <svg>
Thanks in advance
Here's how to display the the SVG from the legend item in the tooltip (works for columns and pattern fill):
tooltip: {
useHTML: true,
pointFormatter: function() {
var point = this,
series = point.series,
legendSymbol = "<svg width='20' height='20'>" + series.legendSymbol.element.outerHTML + "</svg>";
return legendSymbol + series.name + ": <b>" + point.y + "</b><br/>";
}
}
useHTML
must be enabled to make it work.
Live demo: https://jsfiddle.net/kkulig/adr9otbg/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With