我想显示符号的开盘价,收盘价,收盘价和最高价,但看起来highstock只显示当图表类型为ohlc或烛台但不符合时的值。我解决这个问题的方法是生成两个具有相同数据的图表,行(使其可见)和ohlc(使其不可见)并从第二种类型中提取打开,关闭,高和低并在工具提示中显示它。我相信这不是一个正确的方法。有没有人有任何解决方案。
我的工具提示格式化程序
formatter: function() {
var s=' ';
$.each(this.points, function(i, series) {
//when the series is of type 'line', series.point.open is undefined but works great on 'ohlc' type
n=new Date(series.point.x);
s += 'Open: <span style="font-weight:bold">' +series.point.open + '</span> Close: <span style="font-weight:bold">' +series.point.close + '</span> High: <span style="font-weight:bold">'+ series.point.high + '</span> Low: <span style="font-weight:bold">' + series.point.low + '</span>';
});
return s;
}
答案 0 :(得分:4)
解决了它。如果有人需要,这是解决方案。
formatter: function() {
var s = ' ';
$.each(this.points, function(i, series) {
for (i = 0; i < dataLength; i++) {
if (ohlc[i][0] == series.point.x) //ohlc holds my main data
{
s += 'Open: <span style="font-weight:bold">' + ohlc[i][1]
+ '</span> Close: <span style="font-weight:bold">' + ohlc[i][4]
+ '</span> High: <span style="font-weight:bold">' + ohlc[i][2]
+ '</span> Low: <span style="font-weight:bold">' + ohlc[i][3]
+ '</span>';
break;
}
}
}
});
return s;
}