【发布时间】:2015-07-08 11:29:00
【问题描述】:
我想在工具提示中显示警告或解释,仅当您将鼠标悬停在特定的一两个点上时。这些警告将是唯一的,因此不能重复。
我已将自定义文本“警告”和“警告 2”放入系列数据中,但似乎无法在每个包含它的工具提示中调用该数据。
我的系列数据如下所示:
series: [{
color: '#333',
name: 'Pre-tax profits',
data: [{y: 811, custom: 'WARNING'}, 881, 465, -137, 491, 567, 284, 35, 675]
}, {
color: '#00adef',
name: 'Revenues',
data: [2663, 2300, 1851, 1782, { y: 2103, custom: 'WARNING 2'}, 2154, 1665, 1666, 2149]
}]
“y”似乎是多余的,但没有它我会出错。
这是我迄今为止在工具提示格式化程序中的调用方式...
formatter: function () {
var s = '<b>' + this.x + '</b>';
$.each(this.points, function () {
s += '<br/>' + this.series.name + ': ' + this.y + 'm';
s += '<h2>' + this.point.custom + '</h2>';
});
return s;
},
因为我在每个点中都调用它,所以我对它们中的大多数都没有定义,而实际上我只想在它有此警告时调用它一次,根据工具提示。也许我可以只在工具提示中显示这些警告,制作一个全新的系列?
这是一个演示,看看我在说什么......
http://thetally.efinancialnews.com/tallyassets/barclays-ib/index.html
【问题讨论】:
标签: javascript jquery highcharts tooltip