I'm trying to use inline csv data with Vega charts, using the values property of the Vega data specification. The Vega documentation says that this possible, but doesn't give an example. I have tried to change the bar chart example from the examples gallery to use inline CSV data instead of JSON, but without success.
I replaced the data section from the example code with my own code. The original snippet looks like this:
"data": [
{
"name": "table",
"values": [
{"category": "A", "amount": 28},
{"category": "B", "amount": 55},
{"category": "C", "amount": 43},
{"category": "D", "amount": 91},
{"category": "E", "amount": 81},
{"category": "F", "amount": 53},
{"category": "G", "amount": 19},
{"category": "H", "amount": 87}
]
} ]
I replaced it with this one:
"data": [
{
"name": "table",
"format": "csv",
"values": {"category", "amount"
"A", "28"
"B", "55"
"C", "43"
"E", "91"
"E", "81"
"F", "53"
"G", "19"
"H", "87"}
} ]
I used the Vega online editor, but got only error messages about unexpected tokens in the JSON. I also tried the following variation:
"data": [
{
"name": "table",
"format": "csv",
"values": "category, amount
A, 28
B, 55
C, 43
E, 91
E, 81
F, 53
G, 19
H, 87"
} ]
But this lead to the same error messages. What is the correct syntax here?