I'm new to Vegalite and have been progressing well, but I'm struggling to find the correct method to omit/ignore NaN and empty field values from my input data. In my example, I have fields that contain a cholesterol panel along the X axis, whilst the Y axis represents dates when each blood sample was taken. As some of the samples are incomplete, fields are empty and I'd like my line chart to simply continue on to the next valid point rather than breaking and leaving a gap.
Example of the broken line chart showing null/empty/NaN data;
{ "title": "Blood Panel Data",
"width": 600,
"height": 300,
"config": {
"axis": {
"grid": true,
"gridColor": "DarkSlateGrey",
"background": "white"}},
"repeat": {
"layer": ["Cholesterol","Triglycerides","HDL Chol","LDL Chol","Non-HDL","Cholesterol/HDL-C Ratio"]},
"spec": {
"mark" : {
"type" : "line",
"interpolate": "monotone",
"point": true },
"encoding": {
"x": {"field": "Date", "type": "temporal"},
"y": {
"field": {"repeat": "layer"},
"type": "quantitative",
"title": "Value"},
"color": { "datum": {"repeat": "layer"}, "type": "nominal" }
}
}
}
Reading through the Vegalite documentation is really hard for inexperienced users - as the majority of their examples skip into complex methodology. I'm assuming that I need to ignore the empty data values via the transform? But my attempts to execute this keep failing.
Appreciate any help with this. My example data is on Airtable.