如何更改区域标记的不透明度,或者具体来说,如何定义渐变停止点的不透明度?
How can I change opacity of area mark or specifically, how do I define opacity of gradient stops?
在this example中,如何更改区域标记的不透明度?我正在尝试将区域的不透明度更改为 1(完全不透明)。
将 "opacity": 1
或 "fillOpacity": 1
添加到 mark
似乎不起作用。另一方面,在定义 Gradient 时,只能为 stop
定义 color
而不能为 opacity
.
定义
编辑:dominic 下面的回答可用于定义渐变色标的不透明度。然而,
定义区域标记的不透明度似乎存在错误:https://github.com/vega/vega-lite/issues/5807
您可以将此格式用于颜色 rgba(R, G, B, A)
,其中 A 是 alpha。
"color": {
"x1": 1,
"y1": 1,
"x2": 1,
"y2": 0,
"gradient": "linear",
"stops": [
{
"offset": 0,
"color": "rgba(0, 255, 0, 0)"
},
{
"offset": 1,
"color": "rgba(0, 255, 0, 1)"
}
]
}
要将不透明度设置为 1,您可以使用编码
"opacity": {
"value": 1
}
在this example中,如何更改区域标记的不透明度?我正在尝试将区域的不透明度更改为 1(完全不透明)。
将 "opacity": 1
或 "fillOpacity": 1
添加到 mark
似乎不起作用。另一方面,在定义 Gradient 时,只能为 stop
定义 color
而不能为 opacity
.
编辑:dominic 下面的回答可用于定义渐变色标的不透明度。然而, 定义区域标记的不透明度似乎存在错误:https://github.com/vega/vega-lite/issues/5807
您可以将此格式用于颜色 rgba(R, G, B, A)
,其中 A 是 alpha。
"color": {
"x1": 1,
"y1": 1,
"x2": 1,
"y2": 0,
"gradient": "linear",
"stops": [
{
"offset": 0,
"color": "rgba(0, 255, 0, 0)"
},
{
"offset": 1,
"color": "rgba(0, 255, 0, 1)"
}
]
}
要将不透明度设置为 1,您可以使用编码
"opacity": {
"value": 1
}