Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Vega-lite fold - not working

Topic Labels: Extensions
Solved
Jump to Solution
427 1
cancel
Showing results for 
Search instead for 
Did you mean: 

I just found the vega-lite block today and am trying to get a stacked bar graph using 2 fields. I stumbled onto the fold example (Fold | Vega-Lite) and was able to convert it to stacked instead of columns… and it looks like exactly what I want inside the vega-lite editor. But inside airtable, it seems that it doesn’t like the return “key” and “value” from the fold command. Gives the error:

value is not a valid transform name, inline data name, or field name from the Table1 table:

Anyone know if I’m doing something wrong, if this is missing functionality in airtable, or a bug?

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "title": "Table1",
  "width": "container",
  "height": "container",
  
  "transform": [{"fold": ["Field1","Field2"]}],
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "NAME",
      "type": "nominal"
    },
    "y": {
      "type": "quantitative",
      "field": "value"
    },
    "color": {
      "field": "key", 
      "type": "nominal", 
      "scale": {"range": ["#c49712", "#999"]
      }
    }
  }
}

Edit- Add link to fold example

1 Solution

Accepted Solutions

Support got back. Correct line should be

“transform”: [{“fold”: [“Field1”,“Field2”], “as”:[“key”, “value”]}]

See Solution in Thread

1 Reply 1

Support got back. Correct line should be

“transform”: [{“fold”: [“Field1”,“Field2”], “as”:[“key”, “value”]}]