简体   繁体   English

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

[英]Vega-Lite : stroke color value from data?

In Vega it is possible to take a color value from data, like that : example in Vega 在Vega中,可以从数据中获取颜色值, 例如Vega中的示例

Is there a way to do this with Vega-Lite ? 有没有办法用Vega-Lite做到这一点? example in Vega-Lite Vega-Lite中的示例

Yes, you need to set the scale to null in your color property. 是的,您需要在color属性中将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. 要直接对数据值进行编码,可以将scale属性设置为null。

https://vega.github.io/vega-lite/docs/scale.html#disable https://vega.github.io/vega-lite/docs/scale.html#disable

Hope it helps!! 希望能帮助到你!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM