I tried to create a inside formatter[of tooltip config] inside which I was trying to create a chart dynamically but failed to acheive so. Any bright ideas?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Create new container inside tooltip formatter
, and there also create new chart. Important part is to create chart after tooltip is rendered. For example use setTimeout
. Also, useHTML: true
is required, so formatter
will return HTML elements, not SVG.
See working demo: http://jsfiddle.net/EtvMR/4/
Of course, you will need to get some data according to hovered point, but in example I'm using static data.
$('#container').highcharts({
tooltip: {
useHTML: true,
formatter: function() {
setTimeout( function() {
$("#hc-tooltip").highcharts({
series: [{
data: [12, 12]
}]
});
}, 10)
return '<div id="hc-tooltip"></div>';
}
},
series: [{
type: 'column',
data: [29.9, 71.5]
}]
});