Skip to content

feat(stack): add order value for per-bucket stacking#568

Open
ljodea wants to merge 4 commits into
mainfrom
feat/stack-order-value
Open

feat(stack): add order value for per-bucket stacking#568
ljodea wants to merge 4 commits into
mainfrom
feat/stack-order-value

Conversation

@ljodea

@ljodea ljodea commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Implements stack.order: 'value' (Observable Plot parity): sorts rows within each stack group by signed magnitude
  • Manual per-bucket stacking path; offset: 'none' / 'diverging' only (other offsets throw)
  • Closes TODO in stack.ts

Tests

Crossover, reverse, stackX, facets, negatives, unit stacking, numeric strings, missing values

Docs

  • API StackOrder updated
  • Area mark docs: value in order list + first interactive select (not streamgraph select — wiggle offset incompatible)

ljodea added 3 commits June 22, 2026 13:53
Implement Observable Plot-compatible stack order 'value' via per-bucket
signed-value sorting and manual cumulative stacking. Supports offset
none only; crossover, facet, stackX, negative, and unit tests included.
Coerce stack magnitudes with unary + like d3, use Map for group keys,
sort null/NaN last with stable index ties, and allow diverging offset
as a no-op alias on the value-order path.
@netlify

netlify Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 7dcc35a
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/6a39886190ab9e0008ab231b
😎 Deploy Preview https://deploy-preview-568--svelteplot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93d215395f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +258 to +259
out.push(
...stackBucketByValue(itemsToStack, byDim, byLow, byHigh, options.reverse)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Respect offset none for negative value-order stacks

When order: 'value' is used with the default or explicit offset: 'none' and a stack bucket contains negative values, this call does not pass the accepted offset into the manual stacker, so offset: 'none' follows the helper's separate positive/negative accumulators and produces the same coordinates as offset: 'diverging'. That flips/places negative segments as diverging stacks (for example -100 becomes [y1=-100, y2=0] rather than the cumulative none-offset [0, -100]), so mixed-sign value-ordered stacks no longer honor the selected offset.

Useful? React with 👍 / 👎.

Narrow STACK_ORDER index type for svelte-check. Use single cumulative
baseline (d3 stackOffsetNone) instead of py/ny split when offset is none.
@ljodea ljodea requested a review from gka June 22, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant