是否可以设置子刻度间隔?我需要在Y轴的第一个间隔中有一个差异为50的刻度,其中刻度线相差250.
如果Y轴的最大值为1500,则Y轴将具有以下间隔:
0, 250, 500, 750, 1000, 1250, 1500
。
在0 - 250范围内,我希望0, 50, 100, 150, 200, 250
因此,Y轴上的间隔应如下所示:
0, 50, 100, 150, 200, 250, 500, 750, 1000, 1250, 1500
。
function loadColumnBarChart(Hired, Scrned, AllTimPreQulfd, Qualfid, AllTimSAD, SAD, SMD, Aprvd, pndin) {
$('#chartMain').highcharts({
chart: {
type: 'column'
},
title: {
text: Data Flow'
},
xAxis: {
categories: [
'Hired',
'Screened',
'Pre-Qualified',
'Submitted All Docs',
'Submittted Missing Docs',
'Approved',
'Pending'
],
crosshair: true
},
yAxis: {
min: 0,
tickInterval: 250,
// tickPixelInterval: 50,
title: {
text: 'Employees'
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} </b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: [{
name: 'Current Status',
data: [Hired, Scrned, Qualfid, SAD, SMD, Aprvd, pndin]
}, {
name: 'Total Amount',
data: [Hired, Scrned, AllTimPreQulfd, AllTimSAD, SMD, Aprvd, pndin]
}]
});
}
答案 0 :(得分:1)
以下是基于文档的粗略示例,您可以根据需要进行清理:
<强>代码:强>
yAxis: {
min: 0,
max: 1500,
tickPositioner: function() {
var positions = [],
tick = 0,
increment1 = 50,
increment2 = 250;
for (tick; tick < 250; tick += increment1) {
positions.push(tick);
}
for (tick; tick - increment2 < this.max; tick += increment2) {
positions.push(tick);
}
return positions;
}
}
小提琴:
<强>参考强>: