diff --git a/packages/charts/src/components/ComposedChart/index.tsx b/packages/charts/src/components/ComposedChart/index.tsx index 842d1054505..af236c0814c 100644 --- a/packages/charts/src/components/ComposedChart/index.tsx +++ b/packages/charts/src/components/ComposedChart/index.tsx @@ -159,8 +159,8 @@ const ComposedChart: FC = forwardRef((props: ComposedChartPr const onDataPointClickInternal = useCallback( (payload, eventOrIndex, event) => { - if (payload.name && onDataPointClick) { - onDataPointClick( + if (payload.name) { + typeof onDataPointClick === 'function' && onDataPointClick( enrichEventWithDetails(event ?? eventOrIndex, { value: payload.value.length ? payload.value[1] - payload.value[0] : payload.value, dataIndex: payload.index ?? eventOrIndex, @@ -176,7 +176,7 @@ const ComposedChart: FC = forwardRef((props: ComposedChartPr }) ); } else { - onDataPointClick( + typeof onDataPointClick === 'function' && onDataPointClick( enrichEventWithDetails( {}, {