diff --git a/src/transforms/bin.js b/src/transforms/bin.js index 6aa9809200..bd70e70395 100644 --- a/src/transforms/bin.js +++ b/src/transforms/bin.js @@ -58,7 +58,7 @@ function binn( // Greedily materialize the z, fill, and stroke channels (if channels and not // constants) so that we can reference them for subdividing groups without // computing them more than once. - const {x, y, z, fill, stroke, ...options} = inputs; + const {x, y, z, fill, stroke, reverse, ...options} = inputs; const [GZ, setGZ] = maybeLazyChannel(z); const [vfill] = maybeColor(fill); const [vstroke] = maybeColor(stroke); @@ -69,6 +69,7 @@ function binn( ..."z" in inputs && {z: GZ || z}, ..."fill" in inputs && {fill: GF || fill}, ..."stroke" in inputs && {stroke: GS || stroke}, + ..."reverse" in inputs && {reverse}, ...maybeTransform(options, (data, facets) => { const K = valueof(data, k); const Z = valueof(data, z); diff --git a/test/output/penguinMassSpecies.svg b/test/output/penguinMassSpecies.svg index af05220a79..184bb11e37 100644 --- a/test/output/penguinMassSpecies.svg +++ b/test/output/penguinMassSpecies.svg @@ -75,15 +75,15 @@ - + - - + + - - + + diff --git a/test/plots/penguin-mass-species.js b/test/plots/penguin-mass-species.js index e2089acfa2..bc72fa80fa 100644 --- a/test/plots/penguin-mass-species.js +++ b/test/plots/penguin-mass-species.js @@ -12,7 +12,7 @@ export default async function() { grid: true }, marks: [ - Plot.rectY(data, Plot.binX({y: "count"}, {x: "body_mass_g", fill: "species"})), + Plot.rectY(data, Plot.binX({y: "count"}, {x: "body_mass_g", fill: "species", order: "value", reverse: true})), Plot.ruleY([0]) ] });