| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
handleCategoryOrderDefaults returned early for any axis type other than
'category', so these attributes were a silent no-op on multicategory
axes. Let those axes through and handle the [parent, child] pair shape:
- 'trace' (default): per-parent data order
- 'array': categoryarray entries are [first-level, second-level] pairs;
malformed entries are dropped, and an array holding no valid pair
falls back on 'trace'. Categories absent from categoryarray follow in
trace order, matching 'category' axes
- 'category ascending'/'category descending': sort the pairs by label
- ordering by aggregated value ('total ascending', ...) is not
implemented for these axes (sortAxisCategoriesByValue only handles
'category' axes, and interleaving children across parents would break
the parent grouping), so categoryorder is coerced against the
supported subset via an inline attribute override - the same pattern
axis_defaults.js uses for ticklabelposition - and unsupported values
fall back on the default
The _initialCategories seeding in clearCalc already handles array-valued
categories, so no calc-time changes are needed on top of the per-parent
ordering fix this builds on.
New mock multicategory-categoryorder.json renders the same data under
four orderings; 9 new specs in axes_test.js cover each mode and
fallback.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VuN1reWCtHE6WFsNZjdGCD
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VuN1reWCtHE6WFsNZjdGCD
|
Authored by Claude Code (Fable) CI status: all green except test-baselines / test-baselines-b64, failing on exactly the four expected mocks: the three corrected orderings inherited from #7931 (multicategory2, multicategory-y, multicategory-sorting) plus the new multicategory-categoryorder mock. mock-validation passes for the new mock. CI rendered all four replacement baselines itself — the baselines-default-diff artifact from this run contains them under test_images/ (with visual diffs under test_images_diff/). Once the three shared PNGs land on #7931, this PR only needs multicategory-categoryorder.png from that artifact copied into test/image/baselines/ and committed here (this automation can't download artifacts itself, so that step needs a logged-in GitHub session). Note diff-multicategory-categoryorder.png diffs the new render against nothing committed, so for the new mock the file under test_images/ is the baseline to review — expect four panels: trace / array / category ascending / category descending, each with a distinct ordering and intact year brackets, per the table in the PR description. Generated by Claude Code |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Written with Claude Code
Split out of #7929 (the feature half). Stacked on #7931 — the per-parent ordering fix — so this PR is based on that branch and should be retargeted to master once #7931 lands. Unlike the fix, this half adds meaningful new surface for a long-standing silent no-op, so it's intentionally separated for the size-vs-demand judgement call to be made on its own merits.
Overview
handleCategoryOrderDefaults returned early for any axis type other than category, so categoryorder / categoryarray were never coerced on multicategory axes — setting them was a silent no-op, with no workaround for controlling category order. Reported downstream at plotly/dash-ai-analyst#171.
This lets multicategory axes through and handles the [parent, child] pair shape:
No new attributes; categoryarray is already data_array. Descriptions updated for both, test/plot-schema.json regenerated via npm run schema.
The _initialCategories seeding in clearCalc already handles array-valued categories (setCategoryIndex stringifies pairs to "parent,child" for _categoriesMap and pushes the array onto _categories), so no calc-time changes are needed beyond #7931.
Tests
Unit — 9 new specs in test/jasmine/tests/axes_test.js: each ordering mode, implicit switch to array, malformed-entry handling, and both fallback behaviors for value-based orders (with and without a valid categoryarray). Full axes suite: 409 passing (the 2 insiderange failures in my sandbox fail identically on unmodified master — font-metric tolerances, environmental).
Visual — new mock test/image/mocks/multicategory-categoryorder.json, four panels over identical data so each ordering is distinguishable. Data is supplied as 2023 → Q4, Q3 and 2024 → Q2, Q1, Q4, Q3, so trace order is deliberately not alphabetical and all four panels differ:
Baselines — needs a maintainer
The new mock's baseline needs generating (sandbox kaleido font rendering doesn't match CI's):
Open questions from review (#7929)
🤖 Generated with Claude Code
https://claude.ai/code/session_01VuN1reWCtHE6WFsNZjdGCD
Generated by Claude Code