Vega可以使用以下链接进行调试:
https://vega.github.io/editor/#/edited
数据
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": [
{"buckets":[
{"key": "2012-11-01","test":1, "foo": [{"keys1":"TCP","value":2}, {"keys1":"UDP","value":3}]},
{"key": "2012-12-01","test":2, "foo": [{"keys1":"TCP","value":4}, {"keys1":"UDP","value":5}]}
]}
]
},
"transform": [{"flatten": ["buckets"]},{"flatten": ["buckets.foo"]}],
"mark": "circle",
"encoding": {
"x": {"field": "[buckets.foo].keys1", "type": "nominal"},
"y": {"field": "buckets.test", "type": "nominal"},
"color": {"field": "buckets.test", "type": "nominal"}
}
}
注意需要使用[buckets.foo]
Vega数据的调试方式
对不确定的数据进行测试时,可以查看DATA VEWER进行调试