fix(bar-table): honour Rank ordinal semantics instead of length-encoding it - #103
Merged
Chenglong Wang (Chenglong-MS) merged 2 commits intoAug 21, 2026
Conversation
…ing it
The Rank semantic type is an ordinal (a standing), not a magnitude. The
Bar Table template length-encoded it — bar length plus a sequential
colour ramp — which inverted the ranking: rank 1 got the shortest,
palest bar and the last-placed item the longest, darkest one.
Honour the documented behaviour ("Rank → reversed axis (1 on top),
discrete color") in both the Vega-Lite and Plotly templates:
- order rows by rank ascending (1 first / on top),
- use a discrete colour scale instead of a magnitude ramp,
- draw equal-length bars so the mark no longer implies a magnitude
that is not there.
Fixes microsoft#85
Contributor
|
awesome! thanks! I'm merging it to dev, and staged together with the interaction support release planned for the next week. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #85.
The
Ranksemantic type is an ordinal (a standing, not a magnitude). The Bar Table template length-encoded it — bar length plus a sequential colour ramp — which inverted the ranking: rank 1 got the shortest, palest bar and the last-placed item the longest, darkest one.This PR honours the documented
Rankbehaviour (Rank → reversed axis (1 on top), discrete color) in both the Vega-Lite and Plotly Bar Table templates:tableau10for VL / per-rank palette for Plotly) instead of a magnitude ramp,Verification
npm run typecheck— cleaneslinton changed files — cleanvitest run— 1090/1090 pass, including the newtests/bar-table-rank.test.tsregression test covering both backends.Notes
The issue also suggests a
validate_chartwarning for ordinal-on-length-channel as an alternative/generalizing fix. I went with honouring the semantics in the template itself (the direct bug), but I'm happy to add the validator warning on top if maintainers prefer the belt-and-suspenders approach.