This message was deleted.
# help
s
This message was deleted.
a
Copy code
Plot.plot({
  marks: [
    Plot.barX(fruitData, Plot.groupZ({x: "sum"}, {
      x: "value",
      fill: "fruit",
      order: "x",
      // reverse: true // this doesn't seem to change things
    }))
  ]
})
I can't explain why it works
z
Hmm, that still doesn’t seem to be working for me. That order flip reverses for you?
a
the reverse doesn't work
i just swapped the direction of the stacking
@Fil - Any insights about using
reverse
?
f
reverse is applied before grouping, so the groups are made in the reverse order (which is a useless operation)
In this case you want to be explicit that it's the stacking operation that needs order+reverse:
Copy code
Plot.plot({
  marks: [
    Plot.barX(
      fruitData,
      Plot.stackX(
        {
          order: "x",
          reverse: true
        },
        Plot.groupZ(
          { x: "sum" },
          {
            x: "value",
            fill: "fruit"
          }
        )
      )
    )
  ]
})
🙌🏻 1
a
... so to 'reverse' the original, one changes to 'false'
f
no: the order in the original was just not working (since "z" doesn't exist on this dataset)
👍🏻 1
🙏🏻 1
z
Appreciate the help! I find myself doing this a bunch and helpful to see the stack and group transforms separated out.
❤️ 2
Simmering on this, realizing the order in which some of the transformations/groups/etc. are performed seems like a flow I’d like to better understand. Are there any resources for how a Plot chart is rendered as in some of these kinds of orders-of-operation? • I’m reminded of the order a sql query is performed, helpful in constructing a query for desired results. Thanks!
❤️ 1
👍 1