nel*_*ela 5 highcharts highstock
在以下示例中,如何为两个系列AND标志格式化工具提示?
我想在标记工具提示中显示系列工具提示和其他数据中的额外信息.
cra*_*crv 11
使用以下功能作为工具提示格式化程序 -
tooltip: {
shared:true,
formatter: function(){
var p = '';
console.log(this);
if(this.point) {
p += '<b>'+ Highcharts.dateFormat('%A, %b %e, %Y', this.point.x) +'</b><br/>';
p += this.point.config.text // This will add the text on the flags
}
else {
p += '<b>'+ Highcharts.dateFormat('%A, %b %e, %Y', this.x) +'</b><br/>';
$.each(this.points, function(i, series){
p += '<span style="color:' + this.series.color + '">' + this.series.name + '</span>: <b>'+ this.y + ' kWh ($' + Highcharts.numberFormat(this.y * rate, 0) + ')</b><br/>';
});
}
return p;
}}
Run Code Online (Sandbox Code Playgroud)
另请参阅此JSFiddle:http://jsfiddle.net/aTcFe/
一种方法是创建一个工具提示格式化程序,用于检查当前对象是否为点.
tooltip: {
formatter: function(){
if(this.point) {
return "this is a flag"
}
else {
return "this is a line"
}
}
}
Run Code Online (Sandbox Code Playgroud)
你可以更进一步,给你的标志名称,然后检查点是否有一个名称(而不是它是否存在),以防止非标志点获得相同的格式.
以下是您修改的示例以反映前http://jsfiddle.net/aTcFe/
| 归档时间: |
|
| 查看次数: |
12407 次 |
| 最近记录: |