我使用chart.js绘制条形图。如何更改chart.js中的条形填充颜色(我使用'条形图')
var data = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
data : [28,48,40,19,96,27,100]
}
]
}
fillColor:" rgba(220,220,220,0.5)是什么意思?如何更改此颜色?
答案 0 :(得分:3)
rgba代表红绿蓝alpha。参数如下:
rgba(x, y, z, w)
您还可以将Hex values指定为颜色:
{
fillColor : "#ffff00",
strokeColor : "#000000",
data : [65,59,90,81,56,55,40]
}
或预定义的colour names代替,如果您不想使用rgba值:
{
fillColor : "yellow",
strokeColor : "black",
data : [65,59,90,81,56,55,40]
}