Skip to content

Commit 1441a0c

Browse files
Anush2303Anush
andauthored
fix(react-charts): fix donut and gauge chart title issue (#35646)
Co-authored-by: Anush <anushgupta@microsoft.com>
1 parent f2d1b66 commit 1441a0c

File tree

8 files changed

+706
-619
lines changed

8 files changed

+706
-619
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix chart title bugs",
4+
"packageName": "@fluentui/react-charts",
5+
"email": "anushgupta@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/charts/react-charts/library/etc/react-charts.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,7 @@ export interface GaugeChartStyles {
952952
segment?: string;
953953
shapeStyles?: string;
954954
sublabel?: string;
955+
svgTooltip?: string;
955956
}
956957

957958
// @public (undocumented)

packages/charts/react-charts/library/src/components/DonutChart/DonutChart.tsx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -348,24 +348,26 @@ export const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwar
348348
tooltipClassName={classes.svgTooltip}
349349
/>
350350
)}
351-
<Pie
352-
width={_width!}
353-
height={_height!}
354-
outerRadius={outerRadius}
355-
innerRadius={props.innerRadius!}
356-
data={chartData!}
357-
onFocusCallback={_focusCallback}
358-
hoverOnCallback={_hoverCallback}
359-
hoverLeaveCallback={_hoverLeave}
360-
uniqText={_uniqText}
361-
onBlurCallback={_onBlur}
362-
activeArc={_getHighlightedLegend()}
363-
focusedArcId={focusedArcId || ''}
364-
href={props.href!}
365-
valueInsideDonut={_toLocaleString(valueInsideDonut)}
366-
showLabelsInPercent={props.showLabelsInPercent}
367-
hideLabels={props.hideLabels}
368-
/>
351+
<g transform={`translate(0, ${titleHeight})`}>
352+
<Pie
353+
width={_width!}
354+
height={_height!}
355+
outerRadius={outerRadius}
356+
innerRadius={props.innerRadius!}
357+
data={chartData!}
358+
onFocusCallback={_focusCallback}
359+
hoverOnCallback={_hoverCallback}
360+
hoverLeaveCallback={_hoverLeave}
361+
uniqText={_uniqText}
362+
onBlurCallback={_onBlur}
363+
activeArc={_getHighlightedLegend()}
364+
focusedArcId={focusedArcId || ''}
365+
href={props.href!}
366+
valueInsideDonut={_toLocaleString(valueInsideDonut)}
367+
showLabelsInPercent={props.showLabelsInPercent}
368+
hideLabels={props.hideLabels}
369+
/>
370+
</g>
369371
</svg>
370372
</div>
371373
<ChartPopover

0 commit comments

Comments
 (0)