0

我想为多行标签设置不同的颜色,我们可以在 vega 编辑器中查看示例:

https://vega.github.io/editor/#/url/vega/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykSArJQBWENgDsQAGgxwaZLGgBMABhUycSACZaa4smgEytSTClQBtUOKQI4aEGaYAbezOJJnDOBDRWQUKbkbABOAJ5+IACC0iAAQiAAugC+UqCBmMHhDgDCIKnpQWShEegAIvkpiTLQnj5+1rb26LWusZhhOM0gTEjiWrFabMh6aKAmZg5ObTIAZjRwzgPoGVkRqSAhfWTd8PKKydUgSAAe9ZagoQvimA6us7c1gW0tz24gzkhMi3FIEIt6boIGg6NqHZJAA

{
  "$schema": "https://vega.github.io/schema/vega/v5.json",
  "height": 200,
  "padding": 5,
  "data": [
    {
      "name": "table",
      "values": [{"category": ["A", "B"]}, {"category": "C"}, {"category": "D"}]
    }
  ],
  "scales": [
    {
      "name": "scale",
      "type": "band",
      "domain": {"data": "table", "field": "category"},
      "range": "height"
    }
  ],
  "axes": [{"orient": "left", "scale": "scale", "labelBaseline": "middle"}]
}

我有一个使用数组的多行["First label", "Second label"],我需要为每一个赋予不同的颜色。

带有示例的图像

我正在使用具有查看功能的 VEGA 版本 5.20.0。

4

0 回答 0