我确实缺乏 Javascript 技能,但我遇到了问题。
我使用 Highcharts.js 构建了一个图表,我正在尝试自定义工具提示显示。这是一个范围图,默认情况下 point.y 返回低值。我不知道如何返回高值。
有人可以帮忙吗?这是格式化程序代码,我还创建了一个 jsfiddle。
formatter: function() {
var s = '<b>'+ this.x +'</b>';
$.each(this.points, function(i, point) {
s += '<br/>Maximum Value: ?<br/>Minimum Value: ' + point.y
+ '<br/>Spread Value: Max-Min';
});
return s;
},
最佳答案
points 数组中的每个对象都包含 point
属性,这是 Highcharts 中的真实对象。然后您可以访问 point.high
和 point.low
。请参阅:http://jsfiddle.net/cCrLh/3/
tooltip: {
crosshairs: true,
shared: true,
formatter: function() {
var s = '<b>'+ this.x +'</b>';
$.each(this.points, function(i, point) {
s += '<br/>Maximum Value: ' + point.point.high + '<br/>Minimum Value: ' + point.point.low
+ '<br/>Spread Value: Max-Min';
});
return s;
},
shared: true
},
关于javascript - 在 Highcharts.js 中获取值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23519622/