-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(react-charts): fix chart width issue in donut chart #35652
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "patch", | ||
| "comment": "fix chart width issue in donut chart", | ||
| "packageName": "@fluentui/react-charts", | ||
| "email": "anushgupta@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -337,37 +337,41 @@ export const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwar | |
| </text> | ||
| )} | ||
| <div className={classes.chartWrapper} {...arrowAttributes}> | ||
| <svg className={classes.chart} aria-label={data?.chartTitle} width={_width} height={_height}> | ||
| <svg | ||
| className={classes.chart} | ||
| aria-label={data?.chartTitle} | ||
| width={_width} | ||
| height={_height! + titleHeight / 2} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why titleHeight / 2
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. adding titleHeight is increasing distance between legends and donut a lot. |
||
| > | ||
| {!hideLegend && data?.chartTitle && ( | ||
| <ChartTitle | ||
| title={data.chartTitle} | ||
| x={_width! / 2} | ||
| y={0} | ||
| maxWidth={_width! - 20} | ||
| className={classes.chartTitle} | ||
| titleStyles={props.titleStyles} | ||
| tooltipClassName={classes.svgTooltip} | ||
| /> | ||
| )} | ||
| <g transform={`translate(0, ${titleHeight})`}> | ||
| <Pie | ||
| width={_width!} | ||
| height={_height!} | ||
| outerRadius={outerRadius} | ||
| innerRadius={props.innerRadius!} | ||
| data={chartData!} | ||
| onFocusCallback={_focusCallback} | ||
| hoverOnCallback={_hoverCallback} | ||
| hoverLeaveCallback={_hoverLeave} | ||
| uniqText={_uniqText} | ||
| onBlurCallback={_onBlur} | ||
| activeArc={_getHighlightedLegend()} | ||
| focusedArcId={focusedArcId || ''} | ||
| href={props.href!} | ||
| valueInsideDonut={_toLocaleString(valueInsideDonut)} | ||
| showLabelsInPercent={props.showLabelsInPercent} | ||
| hideLabels={props.hideLabels} | ||
| /> | ||
| </g> | ||
| <Pie | ||
| width={_width!} | ||
| height={_height!} | ||
| outerRadius={outerRadius} | ||
| innerRadius={props.innerRadius!} | ||
| data={chartData!} | ||
| onFocusCallback={_focusCallback} | ||
| hoverOnCallback={_hoverCallback} | ||
| hoverLeaveCallback={_hoverLeave} | ||
| uniqText={_uniqText} | ||
| onBlurCallback={_onBlur} | ||
| activeArc={_getHighlightedLegend()} | ||
| focusedArcId={focusedArcId || ''} | ||
| href={props.href!} | ||
| valueInsideDonut={_toLocaleString(valueInsideDonut)} | ||
| showLabelsInPercent={props.showLabelsInPercent} | ||
| hideLabels={props.hideLabels} | ||
| /> | ||
| </svg> | ||
| </div> | ||
| <ChartPopover | ||
|
|
@@ -400,6 +404,7 @@ export const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwar | |
| legendContainer.current = e; | ||
| }} | ||
| className={classes.legendContainer} | ||
| style={{ marginTop: data?.chartTitle ? `-${titleHeight}px` : undefined }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| > | ||
| {legendBars} | ||
| </div> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕵🏾♀️ visual changes to review in the Visual Change Report
vr-tests-react-components/Charts-DonutChart 6 screenshots
vr-tests-react-components/Positioning 2 screenshots
vr-tests-react-components/TagPicker 2 screenshots
There were 2 duplicate changes discarded. Check the build logs for more information.