【发布时间】:2019-01-30 17:35:48
【问题描述】:
在 Vega 中,可以从数据中获取颜色值,如下所示:example in Vega
有没有办法用 Vega-Lite 做到这一点? example in Vega-Lite
【问题讨论】:
标签: javascript html json vega-lite
在 Vega 中,可以从数据中获取颜色值,如下所示:example in Vega
有没有办法用 Vega-Lite 做到这一点? example in Vega-Lite
【问题讨论】:
标签: javascript html json vega-lite
是的,您需要在颜色属性中将scale 设置为null。
"encoding": {
"x": ...,
"y": ...,
"color": {
"field": "color",
"legend": null,
"type":"nominal",
"scale": null
}
}
要直接对数据值进行编码,可以将 scale 属性设置为 空。
https://vega.github.io/vega-lite/docs/scale.html#disable
希望对你有帮助!!
【讨论】: