图表JS.更改轴线颜色 [英] ChartJS. Change axis line color

查看:21
本文介绍了图表JS.更改轴线颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用 ChartJS 更改图表轴的颜色.

I wanna know if it's possible to change the color of the chart axis using ChartJS.

谢谢

推荐答案

我知道这个问题是在 2 年前提出的,OP 已经标记了正确答案,但是我有一个解决方案OP 在标记答案的评论中提到的问题,我想解决它以节省其他人的时间.

I know this question was asked over 2 years ago and the OP has already marked a correct answer, but I have a solution to the problem that the OP mentioned in the comments of the marked answer and I'd like to solve it to save other people some time.

但这会改变轴和所有网格线的颜色,如果我只想更改轴颜色?例如,我想要轴实线为黑色,网格线为灰色.

But this changes the color of the axis and all the gridLines, what if I just want to change the axis color? For example, I want the axis line solid black and the grid lines grey.

如果您想实现这一目标,那么标记的答案不会为您做到,但以下内容应该:

If you're trying to achieve this, then the marked answer won't do it for you but the following should:

yAxes: [{
    gridLines: {
        zeroLineColor: '#ffcc33'
    }
}]

这篇关于图表JS.更改轴线颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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