You*_*nes 3 javascript jquery highcharts
这就是我尝试过的:
$("#toollip").click(function(){
if(chart.container.tooltip.enabled ){
chart.container.tooltip.enabled = false;
}else{
chart.container.tooltip.enabled = true;
}
});
Run Code Online (Sandbox Code Playgroud)
我浏览了很多论坛,无处可寻,显示/隐藏工具提示非常简单,如tooltip.enable = true/false.我遇到的好方法是在图表初始化中通过Formatter设置工具提示设置.
var barsShowen - 是一个具有必要状态的全局变量 - true/false - 显示工具提示与否.
tooltip: {
shared: true,
useHTML: true,
formatter: function () {
if (barsShowen) {
var s = '<span><b>' + this.x + '</b></span><table>';
$.each(this.points, function () {
s += '<tr><td align = "left" style = "color:' + this.series.color + ';">' + this.series.name + ': ' + '</td>' +
'<td><b>' + this.y + '</b></td></tr>';
});
return s + '</table>';
} else {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16116 次 |
| 最近记录: |