ChartJS。更改轴线颜色 [英] ChartJS. Change axis line color

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

问题描述

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

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

谢谢

推荐答案

我知道这个问题是在两年前提出的,并且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.


但这会改变颜色轴和所有gridLines,如果
我只想更改轴颜色怎么办?例如,我希望轴
线为纯黑色,而网格线为灰色。

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'
    }
}]

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

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