如何在 chart.js 的条形图中隐藏 y 轴和 x 轴线以及标签

How to hide the y axis and x axis line and label in my bar chart for chart.js

我是 Chart.js 的新手,我想在我的图表中隐藏 y 轴和 x 轴线和标签。我查看了文档,找不到好的选择。有没有其他人遇到过这个问题并有解决方案?

我发现如果你编辑这个答案中发布的库,你可以实现这个

使用 showScale 选项会更好

var ctx = document.getElementById("LineWithLine").getContext("2d");
new Chart(ctx).Line(data, {
    showScale: false
});

Fiddle - http://jsfiddle.net/wb3kcunt/

这也隐藏了网格线。如果只想隐藏轴和标签而不隐藏网格线,只需将 scaleFontColor 和 scaleLineColor 设置为透明颜色即可。