From 6020af4a90dfecff42d4de9ee71650fb9db4c45a Mon Sep 17 00:00:00 2001 From: Andreas Gerstmayr Date: Wed, 16 Aug 2023 15:18:54 +0200 Subject: [PATCH] fix(ChartScatter): consider bubbleProperty if it is set (#9282) bubbleProperty is only considered if the size prop is undefined, therefore set default size function only if bubbleProperty is not set. Ref. https://github.com/FormidableLabs/victory/blob/bbc1e2a39448d7fb6724f916afacf5f6eab7d1b3/packages/victory-scatter/src/helper-methods.tsx#L35-L43 Signed-off-by: Andreas Gerstmayr --- .../src/components/ChartScatter/ChartScatter.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/react-charts/src/components/ChartScatter/ChartScatter.tsx b/packages/react-charts/src/components/ChartScatter/ChartScatter.tsx index e49de5d0f9c..68cea3ac019 100644 --- a/packages/react-charts/src/components/ChartScatter/ChartScatter.tsx +++ b/packages/react-charts/src/components/ChartScatter/ChartScatter.tsx @@ -446,7 +446,6 @@ export const ChartScatter: React.FunctionComponent = ({ // destructure last theme = getTheme(themeColor), - size = ({ active }) => (active ? ChartScatterStyles.activeSize : ChartScatterStyles.size), ...rest }: ChartScatterProps) => { // Clone so users can override container props @@ -455,8 +454,14 @@ export const ChartScatter: React.FunctionComponent = ({ ...containerComponent.props }); + // bubbleProperty is only considered if the size prop is undefined, therefore set + // default size function only if bubbleProperty is not set. + if (typeof rest.size === "undefined" && typeof rest.bubbleProperty === "undefined") { + rest.size = ({ active }) => (active ? ChartScatterStyles.activeSize : ChartScatterStyles.size); + } + // Note: containerComponent is required for theme - return ; + return ; }; ChartScatter.displayName = 'ChartScatter';