observablehq / observablehq/plot

Should Plot.maxX consume the reverse option?

Open
#800 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
HTML
Stars
5.4k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

See https://observablehq.com/@observablehq/surprising-reverse-gets-eaten: if you have

Plot.stackY(
  Plot.selectMaxX({
    order: "y",
    reverse: true
  }))

reverse: true is "eaten" by the select transform, and doesn't do anything.

Applying maxX after stackY works as expected:

Plot.selectMaxX(
  Plot.stackY({
    order: "y",
    reverse: true
  }))

I'm not sure if this is fixable (we could want all the selection transforms to pass sort and reverse untouched?), but it's at least surprising.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Plot.selectMaxX and Plot.stackY entry points using the two examples in the issue, then inspect how the select transform handles order and reverse. Compare both transform orderings and define done as reverse behaving consistently with the documented or intended selection semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.