Vega-Lite : stroke color value from data?

送分小仙女□ 提交于 2019-12-23 13:22:52

问题


In Vega it is possible to take a color value from data, like that : example in Vega

Is there a way to do this with Vega-Lite ? example in Vega-Lite


回答1:


Yes, you need to set the scale to null in your color property.

"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

Hope it helps!!



来源:https://stackoverflow.com/questions/52001047/vega-lite-stroke-color-value-from-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!