如何在Chart.js中删除轴的线/规则? [英] How to remove the line/rule of an axis in Chart.js?

查看:61
本文介绍了如何在Chart.js中删除轴的线/规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法删除了我的图表中的所有水平线/规则:

I managed to remove all horizontale lines/rules in my chart using this:

scales: {
       xAxes: [{
        gridLines: {
            display: false
        }  
    }]
}

但我也想摆脱代表Y轴的规则/条。 但我想保留标签

But I also want to get rid of the rule/bar that represents the Y-axis as well. But I want to keep the labels:

不幸的是我找不到任何选择。我只能删除整个轴,包括标签。

Unfortunately I can't find any option for that. I can only remove the whole axis including labels.

我正在使用Chart.js 2.3。

I'm using Chart.js 2.3.

推荐答案

我找到了一种方法来删除这一行。它实际上被称为轴的边界,并且有一个选项,参见网格线配置

I found a way to remove this line. It's actually called the border of the axis and there's an option for it, see "Grid Line Configuration":

scales: {
    yAxes: [{
        gridLines: {
            drawBorder: false,
        }
    }]
}

这篇关于如何在Chart.js中删除轴的线/规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆