Vega-Lite:来自数据的笔画颜色值?

Vega-Lite : stroke color value from data?

在 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

希望对您有所帮助!!