如何将 y 轴上的刻度长度设置为 0 或从 highchart 中的 y 轴上删除刻度线?
How to set tick length in y-axis to 0 or remove tickline from y axis in highchart?
x 轴 'tickLength: 0' 正在工作,我可以从 x 轴标签上删除勾号,但同样的事情不适用于 y 轴。请建议我删除 y 轴刻度线的正确方法。
$(function () {
Highcharts.setOptions({
colors: ['#C9F4F4']
});
$('.container').highcharts({
chart: {
type: 'area',
},
credits: {
enabled: false
},
title: {
text: ''
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'Jul','Aug','Sep','Oct','Nov','Dec'],
tickmarkPlacement: 'on',
overflow:'false',
gridLineWidth: 1,
//tickLength: 0,
startOnTick:true,
title: {
enabled: false
}
},
yAxis: {
min: 100,
max: 1000,
tickInterval: 100,
gridLineWidth: 1,
title: {
enabled: false
},
labels: {
formatter: function () {
return this.value;
}
}
},
tooltip: {
shared: true,
formatter: function () {
return this.y;
}
},
plotOptions: {
series: {
lineColor: '#00CFCF',
lineWidth: 1,
marker: {
lineWidth: 1,
lineColor: '#00CFCF',
enabled: false,
}
}
},
navigation: {
buttonOptions: {
enabled: false
}
},
series: [{
name: 'Asia',
data: [502, 635, 809, 947, 900, 1000, 1000,200,750,630,400,75]
}]
});
});
这里是JSFiddle
是想要的效果吗? http://jsfiddle.net/xznu95mv/5/
x轴部分,
将 startOnTick: true,
更改为 startOnTick: false,
添加 min: 0.5
参考:How to remove the gap between yAxis and data?
x 轴 'tickLength: 0' 正在工作,我可以从 x 轴标签上删除勾号,但同样的事情不适用于 y 轴。请建议我删除 y 轴刻度线的正确方法。
$(function () {
Highcharts.setOptions({
colors: ['#C9F4F4']
});
$('.container').highcharts({
chart: {
type: 'area',
},
credits: {
enabled: false
},
title: {
text: ''
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'Jul','Aug','Sep','Oct','Nov','Dec'],
tickmarkPlacement: 'on',
overflow:'false',
gridLineWidth: 1,
//tickLength: 0,
startOnTick:true,
title: {
enabled: false
}
},
yAxis: {
min: 100,
max: 1000,
tickInterval: 100,
gridLineWidth: 1,
title: {
enabled: false
},
labels: {
formatter: function () {
return this.value;
}
}
},
tooltip: {
shared: true,
formatter: function () {
return this.y;
}
},
plotOptions: {
series: {
lineColor: '#00CFCF',
lineWidth: 1,
marker: {
lineWidth: 1,
lineColor: '#00CFCF',
enabled: false,
}
}
},
navigation: {
buttonOptions: {
enabled: false
}
},
series: [{
name: 'Asia',
data: [502, 635, 809, 947, 900, 1000, 1000,200,750,630,400,75]
}]
});
});
这里是JSFiddle
是想要的效果吗? http://jsfiddle.net/xznu95mv/5/
x轴部分,
将 startOnTick: true,
更改为 startOnTick: false,
添加 min: 0.5
参考:How to remove the gap between yAxis and data?