diff --git a/change/@fluentui-react-charts-271be6c9-8e93-4228-8864-be8d0dd48a2d.json b/change/@fluentui-react-charts-271be6c9-8e93-4228-8864-be8d0dd48a2d.json new file mode 100644 index 00000000000000..8f48136c36d4cf --- /dev/null +++ b/change/@fluentui-react-charts-271be6c9-8e93-4228-8864-be8d0dd48a2d.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix chart width issue in donut chart", + "packageName": "@fluentui/react-charts", + "email": "anushgupta@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/charts/react-charts/library/src/components/DonutChart/DonutChart.tsx b/packages/charts/react-charts/library/src/components/DonutChart/DonutChart.tsx index 1e064b7c69e02b..ce38cd20aaa444 100644 --- a/packages/charts/react-charts/library/src/components/DonutChart/DonutChart.tsx +++ b/packages/charts/react-charts/library/src/components/DonutChart/DonutChart.tsx @@ -337,37 +337,41 @@ export const DonutChart: React.FunctionComponent = React.forwar )}
- + {!hideLegend && data?.chartTitle && ( )} - - - +
= React.forwar legendContainer.current = e; }} className={classes.legendContainer} + style={{ marginTop: data?.chartTitle ? `-${titleHeight}px` : undefined }} > {legendBars} diff --git a/packages/charts/react-charts/library/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap b/packages/charts/react-charts/library/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap index 883f391aadb1c0..aa9e4240c65388 100644 --- a/packages/charts/react-charts/library/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap +++ b/packages/charts/react-charts/library/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap @@ -12,7 +12,7 @@ exports[`Donut chart interactions Should hide callout on mouse leave 1`] = ` ... @@ -37,47 +37,43 @@ exports[`Donut chart interactions Should hide callout on mouse leave 1`] = ` hidden="" /> - - - - - - - - - - + + + + + + + + @@ -88,6 +84,7 @@ exports[`Donut chart interactions Should hide callout on mouse leave 1`] = ` />
... @@ -205,47 +202,43 @@ exports[`Donut chart interactions Should reflect theme change 1`] = ` hidden="" /> - - - - - - - - - - + + + + + + + + @@ -256,6 +249,7 @@ exports[`Donut chart interactions Should reflect theme change 1`] = ` />
... @@ -375,47 +369,43 @@ Object { hidden="" /> - - - - - - - - - - + + + + + + + + @@ -467,6 +457,7 @@ Object {
... @@ -597,47 +588,43 @@ Object { hidden="" /> - - - - - - - - - - + + + + + + + + @@ -689,6 +676,7 @@ Object {
... @@ -859,52 +847,48 @@ Object { hidden="" /> - - - - - - - - - - + + - - -
-
+ + + + + + + +
+
@@ -951,6 +935,7 @@ Object {
... @@ -1081,47 +1066,43 @@ Object { hidden="" /> - - - - - - - - - - + + + + + + + + @@ -1173,6 +1154,7 @@ Object {
... @@ -1337,47 +1319,43 @@ exports[`DonutChart snapShot testing Should elevate all smaller values to minimu hidden="" /> - - - - - - - - - - + + + + + + + + @@ -1388,6 +1366,7 @@ exports[`DonutChart snapShot testing Should elevate all smaller values to minimu />
... @@ -1499,77 +1478,73 @@ exports[`DonutChart snapShot testing Should render arc labels 1`] = ` hidden="" /> - - - - - - - - - - - - - + + + + + + + + + + + @@ -1580,6 +1555,7 @@ exports[`DonutChart snapShot testing Should render arc labels 1`] = ` />
... @@ -1691,77 +1667,73 @@ exports[`DonutChart snapShot testing Should render arc labels in percentage form hidden="" /> - - - - - - - - - - - - - + + + + + + + + + + + @@ -1772,6 +1744,7 @@ exports[`DonutChart snapShot testing Should render arc labels in percentage form />
... @@ -1883,47 +1856,43 @@ exports[`DonutChart snapShot testing renders DonutChart correctly 1`] = ` hidden="" /> - - - - - - - - - - + + + + + + + + @@ -1934,6 +1903,7 @@ exports[`DonutChart snapShot testing renders DonutChart correctly 1`] = ` />
... @@ -2045,47 +2015,43 @@ exports[`DonutChart snapShot testing renders DonutChart correctly without color hidden="" /> - - - - - - - - - - + + + + + + + + @@ -2096,6 +2062,7 @@ exports[`DonutChart snapShot testing renders DonutChart correctly without color />
... @@ -2207,47 +2174,43 @@ exports[`DonutChart snapShot testing renders enabledLegendsWrapLines correctly 1 hidden="" /> - - - - - - - - - - + + + + + + + + @@ -2258,6 +2221,7 @@ exports[`DonutChart snapShot testing renders enabledLegendsWrapLines correctly 1 />
- - - - - - - - - - + + + + + + + + @@ -2421,7 +2381,7 @@ exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` ... @@ -2446,47 +2406,43 @@ exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` hidden="" /> - - - - - - - - - - + + + + + + + + @@ -2497,6 +2453,7 @@ exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` />
... @@ -2608,47 +2565,43 @@ exports[`DonutChart snapShot testing renders value inside onf the pie 1`] = ` hidden="" /> - - - - - - - - - - + + + + + + + + @@ -2659,6 +2612,7 @@ exports[`DonutChart snapShot testing renders value inside onf the pie 1`] = ` />