Javascript Y轴值与highcharts中的蜡烛合并
大家好,我正在尝试在y轴和蜡烛之间制作一个分隔符,但未能实现。我已经用黄色突出显示了我想要修复的区域。我甚至不确定这是否可能。任何帮助都将不胜感激 以下是JSFIDLE链接: 这是脚本Javascript Y轴值与highcharts中的蜡烛合并,javascript,jquery,css,highcharts,Javascript,Jquery,Css,Highcharts,大家好,我正在尝试在y轴和蜡烛之间制作一个分隔符,但未能实现。我已经用黄色突出显示了我想要修复的区域。我甚至不确定这是否可能。任何帮助都将不胜感激 以下是JSFIDLE链接: 这是脚本 $(function () { $.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlcv.json&callback=?', function (data) { // spl
$(function () {
$.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlcv.json&callback=?', function (data) {
// split the data set into ohlc and volume
var ohlc = [],
volume = [],
dataLength = data.length,
// set the allowed units for data grouping
groupingUnits = [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]],
i = 0;
for (i; i < dataLength; i += 1) {
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
]);
}
// create the chart
$('#container').highcharts('StockChart', {
rangeSelector: {
selected: 1
},
title: {
text: 'AAPL Historical'
},
yAxis: [{
labels: {
align: 'right',
x: -3
},
title: {
text: 'OHLC'
},
height: '60%',
lineWidth: 2
}, {
labels: {
align: 'right',
x: -3
},
title: {
text: 'Volume'
},
top: '65%',
height: '35%',
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
}
}]
});
});
});
$(函数(){
$.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=aapl-json&回调=?',函数(数据){
//将数据集拆分为ohlc和卷
var ohlc=[],
卷=[],
dataLength=data.length,
//设置允许的数据分组单位
分组单元=[[
'周',//单位名称
[1] //允许的倍数
], [
“月”,
[1, 2, 3, 4, 6]
]],
i=0;
对于(i;i
您已将标签设置为x:-3,因此这些标签将在图表中合并。请将它们定位为
labels: {
align: 'right',
x: 20
}
请参见您可以使用。使用此参数,可以将轴进一步/更靠近打印区域。例如:
yAxis: [{
labels: {
align: 'right',
x: -3
},
title: {
text: 'OHLC'
},
height: '60%',
lineWidth: 2,
offset: 20 //new value
}, {
labels: {
align: 'right',
x: -3
},
title: {
text: 'Volume'
},
top: '65%',
height: '35%',
offset: 0,
lineWidth: 2
}],
您还可以玩放置和放置
你必须要玩它来找到你的完美身材,但这应该让你开始