英文:
Dashed gridlines in Chart.js version 4.x
问题
你想要在Chart.js中创建虚线网格线,我知道关于borderDash
属性,但这对我不起作用,在文档中我找不到任何相关信息。
英文:
How can I make dashed gridlines in Chart.js? I know about the borderDash
property, but this doesn't work for me, and in the documentation I don't find anything about this.
scales: {
y: {
grid: {
drawTicks: false,
borderDash:[5,5], //thid don't work
display: true
}
}
}
答案1
得分: 3
自版本4以来,边框是轴的特定配置节点。
查看迁移指南:https://www.chartjs.org/docs/latest/migration/v4-migration.html#specific-changes
您的配置应该是:
scales: {
y: {
border: {
dash: [5, 5],
display: true
}
grid: {
drawTicks: false,
display: true
}
}
}
英文:
Since version 4, the border is a specific config node of the axes.
See Migration guide: https://www.chartjs.org/docs/latest/migration/v4-migration.html#specific-changes
Your config should be:
scales: {
y: {
border: {
dash: [5, 5],
display: true
}
grid: {
drawTicks: false,
display: true
}
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论