I want create a data table by using Vega , But I don’t know much about its syntax . i copy a json from blog and edit it , i just want a data table looks like
{
"$schema":"https://vega.github.io/schema/vega/v3.json",
"width":400,
"height":200,
"data":[
{
"name":"vals",
"values":{
"aggregations":{
"day":{
"buckets":[
{
"key":"1528065000000",
"doc_count":306344,
"interface-error":{
"doc_count":135
},
"gateway-error":{
"doc_count":539
},
"error":{
"doc_count":674
},
"costTimePercent":{
"value":65.12306100331654
},
"total_percent":{
"value":0.22001410179406156
},
"gateway_percent":{
"value":0.17594599535163086
},
"interface_percent":{
"value":0.044068106442430734
}
},
{
"key":"1528092000000",
"doc_count":537511,
"interface-error":{
"doc_count":240
},
"gateway-error":{
"doc_count":1097
},
"error":{
"doc_count":1337
},
"costTimePercent":{
"value":60.83055416540313
},
"total_percent":{
"value":0.2487390955719976
},
"gateway_percent":{
"value":0.20408884655383797
},
"interface_percent":{
"value":0.04465024901815963
}
},
{
"key":"1528099200000",
"doc_count":196931,
"interface-error":{
"doc_count":51
},
"gateway-error":{
"doc_count":359
},
"error":{
"doc_count":410
},
"costTimePercent":{
"value":37.754492690333166
},
"total_percent":{
"value":0.2081947484144193
},
"gateway_percent":{
"value":0.18229735287994273
},
"interface_percent":{
"value":0.025897395534476543
}
}
]
}
}
},
"format":{
"property":"aggregations.day.buckets"
}
}
],
"encoding":{
"x":{
"field":"Cylinders",
"type":"ordinal"
},
"y":{
"field":"Origin",
"type":"ordinal"
}
},
"layer":[
{
"mark":"rect",
"encoding":{
"color":{
"field":"doc_count",
"type":"quantitative",
"title":"Count of Records",
"legend":{
"direction":"horizontal",
"gradientLength":120
}
}
}
},
{
"mark":"text",
"encoding":{
"text":{
"field":"doc_count",
"type":"quantitative"
},
"color":{
"condition":{
"test":"datum['doc_count'] < 40",
"value":"black"
},
"value":"white"
}
}
}
],
"config":{
"axis":{
"grid":true,
"tickBand":"extent"
}
}
}
Thank you in advance