编辑HighStock示例2窗格图,在轴上设置极值会导致体积图消失。这是一个例子
我正在使用两个窗格图,但是当我调用setExtremes(因为我想设置导航器的起始值)时,大多数情况下第一个图表很好,但是体积图(这是我的第二个x) -axis)每次都跳舞到不同的高度(使它从x轴上脱落),有时它完全消失(虽然y轴本身看起来仍然很好)。
$(function(){ $ .getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlcv.json&callback=?',函数(数据){
// split the data set into ohlc and volume
var ohlc = [],
volume = [],
dataLength = data.length;
for (i = 0; i < dataLength; i++) {
ohlc.push([
data[i][0], // the date
data[i][1], // open
data[i][2], // high
data[i][3], // low
data[i][4] // close
]);
volume.push([
data[i][0], // the date
data[i][5] // the volume
])
}
// set the allowed units for data grouping
var groupingUnits = [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]];
// create the chart
$('#container').highcharts('StockChart', {
chart: {
events: {
load: function() {
this.xAxis[0].setExtremes(Date.UTC(2008,1,1),Date.UTC(2008,8,1),true,true);
}
}
},
rangeSelector: {
selected: 1
},
title: {
text: 'AAPL Historical'
},
yAxis: [{
title: {
text: 'OHLC'
},
height: 200,
lineWidth: 2
}, {
title: {
text: 'Volume'
},
top: 300,
height: 100,
offset: 0,
lineWidth: 2
}],
series: [{
type: 'candlestick',
name: 'AAPL',
data: ohlc,
dataGrouping: {
units: groupingUnits
}
}, {
type: 'column',
name: 'Volume',
data: volume,
yAxis: 1,
dataGrouping: {
units: groupingUnits
}
}]
});
});
});
答案 0 :(得分:0)
问题与动画有关,但在最新的主分支中已修复:
<script src="https://raw.github.com/highslide-software/highcharts.com/master/js/highstock.src.js"></script>