在HighCharts中显示工具提示并在图示点击饼图上选择饼切片


Show tootip and select pie slice on legend click of pie chart in HighCharts

朋友们,我想在鼠标悬停和点击饼图事件时显示带有图例的工具提示,就像我们悬停饼切片时一样,我想显示选中的饼(饼切片像在饼点选择时一样滑出)

这是默认的图表,我禁用了图示点击饼

  http://jsfiddle.net/LQS48/1/

谁能告诉我怎么做?

就像你在这里看到的

http://livecoding.io/3433043 ( which is done with custom buttons i want to achive this with highcharts legends 

任何帮助都将不胜感激。:)

更新-在steve和sebastian的帮助下找到的解决方案集成在下面的fiddle

http://jsfiddle.net/8T7Ew/1/

最终更新-修复了这个解决方案中的一个错误,我在steve和sebastian的帮助下发现了highcharts支持团队集成在这里,现在工作完美无瑕。

我希望这能成为一个highcharts功能,

  Final working Solution for me :: http://jsfiddle.net/8T7Ew/3/

对于图例上的点击事件,您可以添加:

   this.select();
   chart.tooltip.refresh(this);

到你的legendItemClick函数。http://jsfiddle.net/8T7Ew/。

对于鼠标悬停,highcharts论坛http://hililide.com/forum/viewtopic.php?f=9&t=7094上有一个讨论。第二页建议:http://jsfiddle.net/hfrntt/ArmRM/11661/

看一个例子,介绍如何显示工具提示当你悬停在图例http://jsfiddle.net/ArmRM/14892/

$('.highcharts-legend span, .highcharts-legend tspan').each(function(index, element) {
$(element).hover(function() {
    chart.tooltip.refresh(chart.series[0].data[index]);
},function() {
    chart.tooltip.hide();
})

});