Help

Vega Lite filtering and layering issues

1311 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Richard_Wilcock
4 - Data Explorer
4 - Data Explorer

I am using airtable to track and manage activities in a plan.
the relevant table has a baseline date field, a latest planned date field and an actual date field.

Not every task has each date completed

I want to plot cumulative progress (count the number of tasks due to be complete, or complete) over time.

I am using Vega Lite to plot cumulative graphs.

Within Vega-Lite I am using filters to remove the records with no dates, then use window and count operators to generate cumulative values.
I can plot each graph independently, but if I try to layer, vconcat or hconcat the three graphs together than the filtering either cuts off the baseline fields or creates an incorrect jump at the start of the planned/actual dates as null dates are passed to Vega Lite as 01-01-1970.

Looking for ideas please!

transform and encoding script below:

“transform”:[
{
“filter”: {
“field”: “Baseline Date”,
“gt”: 0
}
},
{
“sort”: [{“field”: “Baseline Date”}],
“window”: [{“op”: “count”, “field”: “count”, “as”: “Cumulative Baseline”}],
“frame”: [null, 0]
},
{
“filter”: {
“field”: “Latest Planned Date”,
“gt”: 0
}
},
{
“sort”: [{“field”: “Latest Planned Date”}],
“window”: [{“op”: “count”, “field”: “count”, “as”: “Cumulative Planned”}],
“frame”: [null, 0]
},

{
“sort”: [{“field”: “Actual Date”}],
“window”: [{“op”: “count”, “field”: “count”, “as”: “Cumulative Actual”}],
“frame”: [null, 0]
}
],

"hconcat": [
        {        
    "mark": {"type": "line", "color": "grey"},
    "encoding":{
      "y": {
        "field": "Cumulative Baseline",
        "type": "quantitative"         
      },  
      "x": { 
        "type":"temporal",
        "field":"Baseline Date",
        "title": "Date"          
        }
    }
},   
  {        
    "mark": {"type": "line", "color": "maroon"},
    "encoding":{
      "y": {
        "field": "Cumulative Planned",
        "type": "quantitative"            
      },  
      "x": {
        "type":"temporal",
        "field":"Latest Planned Date",
        "title": "Date"
           }
    }
},
{        
    "mark": {"type": "line", "stroke": "lightblue", "point": true},
    "encoding":{
      "y": {
        "field": "Cumulative Actual",
        "type": "quantitative"        
        },
        "x": {
        "type":"temporal",
        "field":"Actual Decom Date"
        }
    }
}
]
0 Replies 0