Highcharts 在工具提示中使用来自多个系列的数据
我的图表中有两个系列Highcharts 在工具提示中使用来自多个系列的数据,highcharts,Highcharts,我的图表中有两个系列 “实际印象” “预定印象” 有一个共享的工具提示,显示两个系列的数据。在工具提示中,我还希望以百分比的形式显示(现实压缩/书本压缩)。 下面是我想要达到的目标。(这只是显示了我的意图,而不是实际的代码) Formatter=function(){ 返回“+”总计“+”“+”:“ +if(本系列['Booked Impressions'].Point.y!=0) {this.series['Actual Impressions'].Point.y/this.series['B
Formatter=function(){
返回“+”总计“+”
“+”:“
+if(本系列['Booked Impressions'].Point.y!=0)
{this.series['Actual Impressions'].Point.y/this.series['Booked Impressions'].Point.y+'%';}
else{'-';}
}
谢谢我想你想要这样的东西:
tooltip: {
formatter: function() {
var s = '<b>Ratio: </b>';
if (this.points[1] != 0)
{
s += (this.points[0].y / this.points[1].y).toFixed(2);
}
else
{
s += " - ";
}
s += "%";
return s;
},
shared: true
},
工具提示:{
格式化程序:函数(){
var s='比率:';
如果(此点[1]!=0)
{
s+=(this.points[0].y/this.points[1].y).toFixed(2);
}
其他的
{
s+=“-”;
}
s+=“%”;
返回s;
},
分享:真的
},
小提琴
tooltip: {
formatter: function() {
var s = '<b>Ratio: </b>';
if (this.points[1] != 0)
{
s += (this.points[0].y / this.points[1].y).toFixed(2);
}
else
{
s += " - ";
}
s += "%";
return s;
},
shared: true
},