plot icon indicating copy to clipboard operation
plot copied to clipboard

Cumulative group?

Open mbostock opened this issue 4 years ago • 1 comments

I think the group transform could support a cumulative option, as the bin transform does. It’s less rarely needed since group is sometimes used with a categorical dimension, but it should make sense with an ordinal dimension.

mbostock avatar Mar 08 '21 21:03 mbostock

Example workaround using map and cumsum: https://observablehq.com/d/cc6eeed33e366ce8

untitled (40)

Plot.plot({
  marks: [
    Plot.areaY(movies, Plot.mapY("cumsum", Plot.groupX({y: "count"}, {x: "IMDB Rating"}))),
    Plot.ruleY([0])
  ]
})

Ref. https://talk.observablehq.com/t/how-to-translate-vega-lite-window-transform-grammar-to-pure-vega-lite-api-code/6679/4

mbostock avatar Jun 12 '22 16:06 mbostock