在 Vega 中,可以从数据中获取颜色值,例如:example in Vega
有没有办法用 Vega-Lite 做到这一点? example in Vega-Lite
最佳答案
是的,您需要在颜色属性中将 scale
设置为 null
。
"encoding": {
"x": ...,
"y": ...,
"color": {
"field": "color",
"legend": null,
"type":"nominal",
"scale": null
}
}
To directly encode the data value, the scale property can be set to null.
https://vega.github.io/vega-lite/docs/scale.html#disable
希望对你有帮助!!
关于javascript - Vega 精简版 : stroke color value from data?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52001047/