【发布时间】:2014-10-14 02:03:37
【问题描述】:
我正在使用 Highcharts 绘制散点图,我想在绘图中心显示两个轴,如下所示:
但是 Highcharts 显示轴是这样的 (JSFiddle here):
代码:
$(function () {
$('#container').highcharts({
title:{
text:''
},
xAxis: {
title: {
text: "x"
},
gridLineWidth: 1,
min: -5,
max: 5,
tickInterval: 1,
},
yAxis: {
title: {
text: "y"
},
min: -5,
max: 5,
tickInterval: 1,
lineWidth: 1,
title: {
text: null
}
},
legend: {
enabled: false
},
series: [{
type: "line",
marker: {
enabled: false
},
data: [
[-3, 3],
[-2, 2],
[-1, 1],
[0, 0],
[1, 1],
[2, 2],
[3, 3]
]
}]
});
});
Highcharts 确实有一种方法可以手动偏移轴,如 this example,但这需要手动计算图表的大小并将轴偏移正确的像素数(换句话说 - 一个大规模的 hack)
在 Highcharts 中是否有任何适当的方法使轴居中?
【问题讨论】:
-
也可以在这里查看答案:stackoverflow.com/questions/26330775/…
标签: highcharts