我创建一个图表使用vegalite和应用梯度条 colored颜色 ,但我想使参数的 colored颜色 定义在梯度基本上想绑定一个参数梯度 我只是试着让params barcolor——
如何使用 colored颜色 vai params绑定这个
我创建一个图表使用vegalite和应用梯度条 colored颜色 ,但我想使参数的 colored颜色 定义在梯度基本上想绑定一个参数梯度 我只是试着让params barcolor——
如何使用 colored颜色 vai params绑定这个
梯度不支持信号,但您可以定义信号中的梯度.
例如
Here you could switch between two different gradients - test1 and test2.
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 200,
"height": 200,
"padding": 5,
"signals": [
{
"name": "test1",
"update": "{gradient: 'linear', stops: [{offset: 0, color: 'green'}, {offset: 1, color: 'red'}]}"
},
{
"name": "test2",
"update": "{gradient: 'linear', stops: [{offset: 0, color: 'red'}, {offset: 1, color: 'green'}]}"
}
],
"marks": [
{
"type": "rect",
"encode": {
"enter": {
"x": {"value": 0},
"x2": {"value": 100},
"y": {"value": 0},
"y2": {"value": 400},
"fill": {"signal": "test1"}
}
}
}
]
}