简体   繁体   中英

Vega lite: How to change value labels

I could not found out way how to change labels of X axis. I have this data and I need to show bars which have title taken from field label . Currently bars are aggregated by id and goals is to label bars with label even if the texts are same. I'm confused by examples what to do. Whether I should create layer or some signals. Could someone help me? IMHO this should be trivial, but I did not found anything useful.

      {
        "id": 15971,
        "label": "Click Next to continue",
        "result": "Success",
        "value": 2
      },
      {
        "id": 15972,
        "label": "Click Next to continue",
        "result": "No data",
        "value": 0
      },

当前图

织女星编辑器

There's not really any way to do this in the Vega-Lite grammar, because what you want to do is semantically inconsistent: if you group values by one column, there is no guarantee that the values in another column will match within that grouping.

One option you have is to use labelExpr to define the desired label manually, eg

    "x": {
      "field": "id",
      "type": "nominal",
      "axis": {"title": "x", "labelExpr": "'Click Next to continue'"},
      "scale": {"type": "point"}
    },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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