fix(charts): DonutChart expands infinitely in vertical direction inside ResponsiveContainer#35848
Open
fix(charts): DonutChart expands infinitely in vertical direction inside ResponsiveContainer#35848
Conversation
Root cause: When DonutChart has a chartTitle, its SVG height is _height + titleHeight/2 and the legend gets marginTop: -titleHeight. These don't fully cancel. Each measurement cycle adds titleHeight/2 (react-charts) or titleHeight (react-charting) to _height, causing infinite vertical expansion when used with ResponsiveContainer. react-charts: Add getChartTitleHeight() helper; use chartTitleHeight/2 as correction factor in _fitParentContainer's legendContainerHeight calculation. react-charting: Add static _computeTitleHeight() method; subtract titleHeight from _height in getDerivedStateFromProps when legend is visible and a chart title is present. Update DonutChart snapshots (SVG height decreases by 18px = titleHeight/2 as expected from the stabilised calculation). Co-authored-by: Hotell <1223799+Hotell@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ResponsiveContainer expanding indefinitely in vertical direction
fix(charts): DonutChart expands infinitely in vertical direction inside ResponsiveContainer
Mar 9, 2026
Collaborator
|
@copilot make sure nx target pass, |
…romProps to fix member-ordering lint error Co-authored-by: Hotell <1223799+Hotell@users.noreply.github.com>
Contributor
Author
Fixed in c4c3b70f. The |
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
Collaborator
|
@copilot generate change files |
…charts Co-authored-by: Hotell <1223799+Hotell@users.noreply.github.com>
Contributor
Author
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.

ResponsiveContainerexpanding indefinitely in vertical directionDonutChart.tsxinreact-charts: ExtractgetChartTitleHeightmodule-level helper; usechartTitleHeight / 2as correction factor in_fitParentContainer'slegendContainerHeightcalculation to stabilise heightDonutChart.base.tsxinreact-charting: Add private static_computeTitleHeightmethod; subtracttitleHeightfrom_heightingetDerivedStateFromPropswhen legend is visible and chart title is present_computeTitleHeight(private static) aftergetDerivedStateFromProps(public static) to satisfy@typescript-eslint/member-orderingruletitleHeight/2as expected)nx run react-charting:lintpasses with 0 errorsreact-charts(867 tests) andreact-charting@fluentui/react-chartingand@fluentui/react-chartsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.