在highcharts中,默认情况下,x轴上的刻度线是默认的,就像在x轴上一样(下面的代码段),但是我找不到在y轴上创建刻度线的任何方法。这可能吗?

$(function () {
$('#container').highcharts({
title:{
text:''
},
xAxis: {
gridLineColor: 'transparent',
title: {
text: "x"
},
gridLineWidth: 1,
min: -5,
max: 5,
tickInterval: 1,
},
yAxis: {
gridLineColor: 'transparent',
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]
]
}]
});
});Run Code Online (Sandbox Code Playgroud)
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="width: 400px; height: 400px"></div>Run Code Online (Sandbox Code Playgroud)
只需使用tickLength和tickWidth:
yAxis: {
tickLength: 10,
tickWidth: 1
}
Run Code Online (Sandbox Code Playgroud)
示例:http://jsfiddle.net/7ox30pmy/
| 归档时间: |
|
| 查看次数: |
3928 次 |
| 最近记录: |