Vega-Lite:来自数据的笔触颜色值? [英] Vega-Lite : stroke color value from data?

查看:135
本文介绍了Vega-Lite:来自数据的笔触颜色值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在维加也能够采取从数据的颜色值,这样的:例如在维加

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

有没有办法用Vega-Lite做到这一点? Vega-Lite中的示例

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

推荐答案

是的,您需要在color属性中将scale设置为null.

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
      }
    }

要直接编码数据值,可以将scale属性设置为 空.

To directly encode the data value, the scale property can be set to null.

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

希望有帮助!!

这篇关于Vega-Lite:来自数据的笔触颜色值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆