-
This data, intended for a grouped bar chart,
transforms to JSON as
If that JSON data format compatible with vega-lite? All the examples I see have a format like
|
Beta Was this translation helpful? Give feedback.
Answered by
jakevdp
Jun 9, 2021
Replies: 1 comment 1 reply
-
This is what the Fold transform is used for. For example: {
"data": {
"values": [
{"Year": 2002, "Rentals": 184, "Sales": 84},
{"Year": 2003, "Rentals": 180, "Sales": 67}
]
},
"transform": [{"fold": ["Rentals", "Sales"], "as": ["type", "value"]}],
"mark": "bar",
"encoding": {
"x": {"field": "value", "type": "quantitative"},
"y": {"field": "Year", "type": "ordinal"},
"color": {"field": "type", "type": "nominal"}
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
domoritz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is what the Fold transform is used for. For example: