@@ -73,6 +73,7 @@ const PieChart: FC<PieChartProps> = forwardRef((props: PieChartProps, ref: Ref<a
73
73
74
74
const chartConfig = useMemo ( ( ) => {
75
75
return {
76
+ margin : { right : 30 , left : 30 , bottom : 30 , top : 30 , ...( props . chartConfig ?. margin ?? { } ) } ,
76
77
legendPosition : 'bottom' ,
77
78
paddingAngle : 0 ,
78
79
...props . chartConfig
@@ -116,7 +117,6 @@ const PieChart: FC<PieChartProps> = forwardRef((props: PieChartProps, ref: Ref<a
116
117
[ onDataPointClick ]
117
118
) ;
118
119
119
- const marginChart = chartConfig ?. margin ?? { right : 30 , left : 30 , bottom : 30 , top : 30 } ;
120
120
const label = useMemo ( ( ) => {
121
121
return {
122
122
position : 'outside' ,
@@ -136,7 +136,7 @@ const PieChart: FC<PieChartProps> = forwardRef((props: PieChartProps, ref: Ref<a
136
136
tooltip = { tooltip }
137
137
slot = { slot }
138
138
>
139
- < PieChartLib margin = { marginChart } >
139
+ < PieChartLib margin = { chartConfig . margin } >
140
140
< Pie
141
141
innerRadius = { chartConfig . innerRadius }
142
142
paddingAngle = { chartConfig . paddingAngle }
@@ -148,16 +148,16 @@ const PieChart: FC<PieChartProps> = forwardRef((props: PieChartProps, ref: Ref<a
148
148
>
149
149
{ centerLabel && < Label position = { 'center' } > { centerLabel } </ Label > }
150
150
{ dataset &&
151
- dataset . map ( ( data , index ) => (
152
- < Cell
153
- key = { index }
154
- name = { dimension . formatter ( getValueByDataKey ( data , dimension . accessor , '' ) ) }
155
- fill = { measure . colors ?. [ index ] ?? `var(--sapChart_OrderedColor_${ ( index % 11 ) + 1 } )` }
156
- />
157
- ) ) }
151
+ dataset . map ( ( data , index ) => (
152
+ < Cell
153
+ key = { index }
154
+ name = { dimension . formatter ( getValueByDataKey ( data , dimension . accessor , '' ) ) }
155
+ fill = { measure . colors ?. [ index ] ?? `var(--sapChart_OrderedColor_${ ( index % 11 ) + 1 } )` }
156
+ />
157
+ ) ) }
158
158
</ Pie >
159
- < Tooltip cursor = { tooltipFillOpacity } formatter = { tooltipValueFormatter } contentStyle = { tooltipContentStyle } />
160
- { ! noLegend && < Legend verticalAlign = { chartConfig . legendPosition } onClick = { onItemLegendClick } /> }
159
+ < Tooltip cursor = { tooltipFillOpacity } formatter = { tooltipValueFormatter } contentStyle = { tooltipContentStyle } />
160
+ { ! noLegend && < Legend verticalAlign = { chartConfig . legendPosition } onClick = { onItemLegendClick } /> }
161
161
</ PieChartLib >
162
162
</ ChartContainer >
163
163
) ;
0 commit comments