Skip to content

Commit ae697a9

Browse files
fix(PieChart): fix tooltip font color and add chartConfig option to modify the tooltip styles (#625)
1 parent b2e353d commit ae697a9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/charts/src/components/PieChart/PieChart.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export interface PieChartProps extends IChartBaseProps<IPolarChartConfig> {
5555
measure: MeasureConfig;
5656
}
5757

58+
const tooltipItemDefaultStyle = { color: 'var (--sapTextColor)' };
59+
5860
/**
5961
* <code>import { PieChart } from '@ui5/webcomponents-react-charts/lib/PieChart';</code>
6062
*/
@@ -81,6 +83,7 @@ const PieChart: FC<PieChartProps> = forwardRef((props: PieChartProps, ref: Ref<H
8183
paddingAngle: 0,
8284
outerRadius: '80%',
8385
resizeDebounce: 250,
86+
tooltipItemStyle: tooltipItemDefaultStyle,
8487
...props.chartConfig
8588
};
8689
}, [props.chartConfig]);
@@ -182,7 +185,13 @@ const PieChart: FC<PieChartProps> = forwardRef((props: PieChartProps, ref: Ref<H
182185
/>
183186
))}
184187
</Pie>
185-
<Tooltip cursor={tooltipFillOpacity} formatter={tooltipValueFormatter} contentStyle={tooltipContentStyle} />
188+
<Tooltip
189+
cursor={tooltipFillOpacity}
190+
formatter={tooltipValueFormatter}
191+
contentStyle={tooltipContentStyle}
192+
itemStyle={chartConfig.tooltipItemStyle}
193+
labelStyle={chartConfig.tooltipLabelStyle}
194+
/>
186195
{!noLegend && (
187196
<Legend
188197
verticalAlign={chartConfig.legendPosition}

0 commit comments

Comments
 (0)