Closed
Description
This works, the definition of the text channel is awkward:
Plot.plot({
marks: [
Plot.barX(penguins, Plot.stackX(Plot.groupZX({fill: "species", normalize: true}))),
Plot.text(penguins, Plot.stackXMid(Plot.groupZX({text: ([d]) => d.species, z: "species", normalize: true}))),
Plot.ruleX([0, 100])
]
})
I’d prefer something like this:
Plot.plot({
marks: [
Plot.barX(penguins, Plot.stackX(Plot.groupZX({fill: "species", normalize: true}))),
Plot.text(penguins, Plot.stackXMid(Plot.groupZX({text: "species", z: "species", normalize: true}))),
Plot.ruleX([0, 100])
]
})
But this would require that the group transform know that text is a channel, and to aggregate it (by selecting the first value, presumably). And currently the group transform doesn’t need to know how to interpret the passed-in options, other than the ones that are specifically eligible for grouping (namely x, y, z, fill, stroke).