Skip to content

Commit f5c419f

Browse files
committed
Update RadialChart.tsx
1 parent ca38b6e commit f5c419f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/charts/src/components/RadialChart/RadialChart.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ChartContainer } from '@ui5/webcomponents-react-charts/lib/next/ChartCo
44
import { PieChartPlaceholder } from '@ui5/webcomponents-react-charts/lib/PieChartPlaceholder';
55
import { CommonProps } from '@ui5/webcomponents-react/interfaces/CommonProps';
66
import React, { CSSProperties, FC, forwardRef, Ref, useCallback, useMemo } from 'react';
7-
import { PolarAngleAxis, RadialBar, RadialBarChart as RadialBarChartLib } from 'recharts';
7+
import { PolarAngleAxis, RadialBar, RadialBarChart } from 'recharts';
88

99
export interface RadialChartProps extends CommonProps {
1010
value?: number;
@@ -14,6 +14,10 @@ export interface RadialChartProps extends CommonProps {
1414
onDataPointClick?: (event: CustomEvent<{ value: unknown; payload: unknown; dataIndex: number }>) => void;
1515
}
1616

17+
const radialChartMargin = { right: 30, left: 30, top: 30, bottom: 30 };
18+
const radialBarBackground = { fill: ThemingParameters.sapContent_ImagePlaceholderBackground };
19+
const radialBarLabelStyle = { fontSize: ThemingParameters.sapFontHeader3Size, fill: ThemingParameters.sapTextColor };
20+
1721
/**
1822
* <code>import { RadialChart } from '@ui5/webcomponents-react-charts/lib/next/RadialChart';</code>
1923
* **This component is under active development. The API is not stable yet and might change without further notice.**
@@ -52,8 +56,8 @@ const RadialChart: FC<RadialChartProps> = forwardRef((props: RadialChartProps, r
5256
tooltip={tooltip}
5357
slot={slot}
5458
>
55-
<RadialBarChartLib
56-
margin={{ right: 30, left: 30, top: 30, bottom: 30 }}
59+
<RadialBarChart
60+
margin={radialChartMargin}
5761
innerRadius="90%"
5862
outerRadius="100%"
5963
barSize={10}
@@ -65,7 +69,7 @@ const RadialChart: FC<RadialChartProps> = forwardRef((props: RadialChartProps, r
6569
>
6670
<PolarAngleAxis type="number" domain={range} tick={false} />
6771
<RadialBar
68-
background={{ fill: ThemingParameters.sapContent_ImagePlaceholderBackground }}
72+
background={radialBarBackground}
6973
dataKey="value"
7074
cornerRadius="50%"
7175
fill={color ?? `var(--sapChart_OrderedColor_${(0 % 12) + 1})`}
@@ -77,11 +81,11 @@ const RadialChart: FC<RadialChartProps> = forwardRef((props: RadialChartProps, r
7781
textAnchor="middle"
7882
dominantBaseline="middle"
7983
className="progress-label"
80-
style={{ fontSize: ThemingParameters.sapFontHeader3Size, fill: ThemingParameters.sapTextColor }}
84+
style={radialBarLabelStyle}
8185
>
8286
{displayValue}
8387
</text>
84-
</RadialBarChartLib>
88+
</RadialBarChart>
8589
</ChartContainer>
8690
);
8791
});

0 commit comments

Comments
 (0)