render({
mark: { type: 'line', interpolate: 'step-before' },
data: { values: movies },
transform: [
{ filter: 'datum.Running_Time_min != null' },
{
aggregate: [{ op: 'count', as: 'Count' }],
groupby: ['Running_Time_min']
},
{
window: [{ op: 'sum', field: 'Count', as: 'Cumulative_Sum' }],
sort: [{ field: 'Running_Time_min' }]
}
],
encoding: {
x: { field: 'Running_Time_min', type: 'Q', title: 'Duration (min)' },
y: { field: 'Cumulative_Sum', type: 'Q', title: 'Cumulative Count of Films' }
}
})