我在使用 chartist.js
时遇到问题。
我想将 y 轴
网格线之间的间距调整为 40px
。(现在是 36px)
我已经尝试找到一些示例,但找不到。
.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
选项。
options = {
axisY: {
offset: 0,
scaleMinSpace: 40
showGrid: true,
showLabel: false
}
}
欲了解更多信息,https://gionkunz.github.io/chartist-js/api-documentation.html .
关于javascript - 如何调整 chartist.js 中网格线的间距?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37432915/