Javascript highcharts,可能的错误设置工具提示格式化程序和html?
我设置了以下选项:Javascript highcharts,可能的错误设置工具提示格式化程序和html?,javascript,charts,highcharts,highstock,Javascript,Charts,Highcharts,Highstock,我设置了以下选项: tooltip: { shared: true, useHTML: true, formatter: function() { return '<table style="text-align: center"><tr><td>{point.x
tooltip: {
shared: true,
useHTML: true,
formatter: function() {
return '<table style="text-align: center"><tr><td>{point.x:%Y-%b-%e}</td></tr><tr><td>Price: {point.y}</td></tr></table>';
}
工具提示:{
分享:是的,
是的,
格式化程序:函数(){
返回“{point.x:%Y-%b-%e}价格:{point.Y}”;
}
但我仍然得到这个输出
如果我使用:
tooltip: {
shared: true,
useHTML: true,
headerFormat: '<table style="text-align: center"><tr><td>{point.x:%Y-%b-%e}</td></tr><tr><td>Price: {point.y}</td></tr></table>',
pointFormat: '',
footerFormat: '',
valueDecimals: 2
},
工具提示:{
分享:是的,
是的,
headerFormat:“{point.x:%Y-%b-%e}价格:{point.Y}”,
点格式:“”,
页脚格式:“”,
数值小数:2
},
然后我得到:
然而,当我缩小到全部或10年期间时,我得到的输出与第一个相同
当使用大约3年时,似乎有一个bug
下面是一个演示错误的JSFIDLE:
缩小到所有在格式化程序中,您应该使用引用来指向对象和
格式化程序:函数(){
返回“”+(Highcharts.dateFormat(“%Y-%b-%e',this.x))+“价格:”+this.Y+”;
},
太好了,效果很好!但是工具提示HeadPerformat,pointFormat似乎是个bug,对吧?但这对我来说很好!
formatter: function () {
return '<table style="text-align: center"><tr><td>' + (Highcharts.dateFormat('%Y-%b-%e', this.x)) + '</td></tr><tr><td>Price: ' + this.y + ' </td></tr></table>';
},