Javascript 如何在chartist.js中调整网格线的间距?
我在使用Javascript 如何在chartist.js中调整网格线的间距?,javascript,charts,linechart,chartist.js,Javascript,Charts,Linechart,Chartist.js,我在使用chartist.js时遇到问题。 我想通过40px(现在是36px)调整y轴网格线之间的间距 我已经试着找到一些例子了,但是我找不到 .ct-grids line { stroke: #fff; opacity: .05; stroke-dasharray: none; } 这是我当前的网格样式 var data = { labels: ['JAN 1', 'JAN 18', 'FEB 14', 'MAR 9', 'APR 22', 'May 2'], serie
chartist.js时遇到问题。
我想通过40px
(现在是36px)调整y轴
网格线之间的间距
我已经试着找到一些例子了,但是我找不到
.ct-grids line {
stroke: #fff;
opacity: .05;
stroke-dasharray: none;
}
这是我当前的网格样式
var data = {
labels: ['JAN 1', 'JAN 18', 'FEB 14', 'MAR 9', 'APR 22', 'May 2'],
series: [
[40.8, 46.5, 48.8, 56.9, 68.7, 72.7],
[12.8, 13.7, 13.9, 14.8, 15.3, 15.6],
[5.2, 3.8, 4.2, 5, 3.9, 4.3],
[1.2, 1.8, 1.7, 2.1, 1.8, 1.9]
]
};
var options = {
showPoint: false,
lineSmooth: false,
axisX: {
showGrid: false,
showLabel: false
},
axisY: {
offset: 0,
showGrid: true,
showLabel: false
}
};
var chart = new Chartist.Line('.ct-chart', data, options);
如果你知道,请告诉我。
谢谢。在axisY
选项上使用scaleMinSpace
,对我很有效
options = {
axisY: {
scaleMinSpace: 40
}
}
请像这样更改axisY
选项
options = {
axisY: {
offset: 0,
scaleMinSpace: 40
showGrid: true,
showLabel: false
}
}
有关详细信息