test(charts): cover sub-1 bar label formatting - #36483
Draft
AKnassa wants to merge 1 commit into
Draft
Conversation
Issue microsoft#30213 reported VerticalBarChart labels rendering 0.9 as '900m' (d3 SI prefix, m = milli). The formatter rewrite in PR microsoft#34562 already fixed this on master (shipped in @fluentui/react-charts 9.0.7 and @fluentui/react-charting 5.24.1), but nothing asserted the sub-1 behavior, so it could silently regress. Lock it in with regression tests: formatScientificLimitWidth unit coverage for |value| < 1 in both charting packages, plus a VerticalBarChart render test asserting bar label text for fractional data. Verified the historic bug reproduces through the pre-microsoft#34562 formatter and that current code passes. The issue can be closed as fixed; reporters on older package versions should upgrade. Closes microsoft#30213
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.
Previous Behavior
This issue reported bar chart labels showing "900m" when the value was 0.9 (the "m" means milli, so 0.9 kg looked like 900 mg — very confusing). That bug was actually fixed on master by #34562, but nothing tested it, so it could quietly come back.
New Behavior
No product code changes — this PR adds the missing safety net. New tests lock in that small values render as plain decimals ("0.9", not "900m") in both charting packages, including a rendering test that checks the actual label text on VerticalBarChart bars.
With the tests proving the fix is in place, this issue can be closed; anyone still seeing "900m" just needs to upgrade (
@fluentui/react-charts9.0.7+ /@fluentui/react-charting5.24.1+).What changed
react-chartsand v8react-charting.We confirmed the old formatter really did produce "900m" for 0.9, and that the full react-charts suite stays green (the only failures are 6 HeatMap snapshots that were already failing on untouched master).
Related Issue(s)