Javascript 自定义Highcharts工具提示
我正在自定义Highcharts工具提示:Javascript 自定义Highcharts工具提示,javascript,highcharts,Javascript,Highcharts,我正在自定义Highcharts工具提示: tooltip: { headerFormat: '<b>{series.name}</b><br>', pointFormat: 'round {point.x-9} to {point.x} avg: {point.y}' } 工具提示:{ headerFormat:“{series.name}”, pointFormat:'将{point.x-9}取整为{point.x}平均值:{point.
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
pointFormat: 'round {point.x-9} to {point.x} avg: {point.y}'
}
工具提示:{
headerFormat:“{series.name}
”,
pointFormat:'将{point.x-9}取整为{point.x}平均值:{point.y}'
}
但是,{point.x-10}
无法计算,我没有得到第0到9轮平均值:0.1
,而是第9轮平均值:0.1
我怎么修理它
Highcharts不允许您在花括号中执行JS代码。在API中,我们可以阅读: 点格式:字符串:工具提示中点的线的HTML。变量用花括号括起来。可用的变量有point.x、point.y和series。名称和series.color以及同一表单上的其他属性 您应该使用格式化程序属性:
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
formatter: function() {
return 'round ' + (this.x - 9) + ' to ' + this.x + ' avg: ' + this.y
}
}
工具提示:{
headerFormat:“{series.name}
”,
格式化程序:函数(){
将'round'+(this.x-9)+'返回到'+this.x+'平均值:'+this.y
}
}
现场演示:
API:Highcharts不允许您在花括号中执行JS代码。在API中,我们可以阅读: 点格式:字符串:工具提示中点的线的HTML。变量用花括号括起来。可用的变量有point.x、point.y和series。名称和series.color以及同一表单上的其他属性 您应该使用格式化程序属性:
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
formatter: function() {
return 'round ' + (this.x - 9) + ' to ' + this.x + ' avg: ' + this.y
}
}
工具提示:{
headerFormat:“{series.name}
”,
格式化程序:函数(){
将'round'+(this.x-9)+'返回到'+this.x+'平均值:'+this.y
}
}
现场演示:
API:我认为您应该使用格式化程序选项我认为您应该使用格式化程序选项