-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(react-charts): Migrate stacked bar support from v8 to v9 GroupedVerticalBarChart #34880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: srmukher <[email protected]>
…hart Co-authored-by: srmukher <[email protected]>
Co-authored-by: srmukher <[email protected]>
Fixed the bar alignment issue! The problem was in the x-axis scale range calculation when the container width was small, causing bars to be positioned at negative coordinates (off-screen). I've updated the The fix includes validation to prevent invalid ranges and a comprehensive test case to verify alignment and prevent regressions. All tests are passing. Commit: 7da1000 |
Still the bars are not aligned with the x-axis ticks: |
…ected scale range calculation Co-authored-by: srmukher <[email protected]>
Fixed the bar alignment issue! The problem was in the The fix ensures both scales use the same domain-adjusted margins from Commit: 36c8b3d |
The bars are still not aligned with the x-axis ticks. Confirm the behavior by using this data in the default stories of Grouped Vertical Bar chart, running "yarn start" and verifying the charts in browser. |
Co-authored-by: srmukher <[email protected]>
Fixed the bar alignment issue! The problem was in the bar positioning logic for stacked charts - the code was allocating space for all global legends even when each x-axis point only had one legend group, causing misalignment. The fix creates local scales for each x-axis point using only the legends present at that point, ensuring bars are properly centered over their x-axis ticks. This works correctly with the provided test data where each grade (Grade 10, Grade 11, Grade 12) has its own stacked bar group. Commit: 7e98bcd |
Update the following:
|
… changes Co-authored-by: srmukher <[email protected]>
I've addressed both requirements:
All 36 tests are passing and only the GroupedVerticalBarChart component files have been modified as requested. Commit: ded9dfe |
This PR migrates the stacked bar functionality from Fluent UI v8 (
@fluentui/react-charting
) to v9 (@fluentui/react-charts
) GroupedVerticalBarChart component, following the implementation from PR #34353.Changes Made
Core Functionality
_legendColorMap
system for consistent colors across stacked segmentsImplementation Details
_keys
with_legends
throughout the component_createDataset()
to group data points by legend instead of key_buildGraph()
to support vertical stacking withVERTICAL_BAR_GAP
spacing_addDefaultColors()
method for consistent color managementTesting
Example Usage
The Revenue bars will render as two stacked segments totaling 50, while Costs renders as a separate bar with value 10.
Backward Compatibility
✅ All existing functionality preserved
✅ 33/33 tests passing
✅ Minimal visual changes (only 1px positioning adjustments)
Fixes #34879.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.