Skip to content

Reducer implementations are confused with reducer scale overrides #1363

@Fil

Description

@Fil

This should display a chart in greyscale, by opting in the scale.

Note that it works when reduce is a string (reduce: "mode").

(Seen in #1360)

export async function reducerGroupScaleFunction() {
  const penguins = await d3.csv<any>("data/penguins.csv", d3.autoType);
  return Plot.plot({
    color: {scheme: "greys"},
    marks: [
      Plot.barY(
        penguins,
        Plot.groupX(
          {
            y: "count",
            fill: {
              reduce: (index: number[], values: any[]) => d3.mode(index, (i) => values[i]),
              scale: true // 🌶
            }
          },
          {x: "species", fill: (d) => (d.island === "Biscoe" ? "orange" : "green"), fy: "sex"}
        )
      )
    ]
  });
}

Metadata

Metadata

Assignees

Labels

bugSomething isn’t working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions