From 6d3d0a09d141e46541d726a2972c0946f4dec510 Mon Sep 17 00:00:00 2001 From: Nikolas Rieble Date: Wed, 4 Jan 2023 15:01:43 +0100 Subject: [PATCH] AreaChart: Respect AreaChart baseValue but allow override with Area baseValue --- src/cartesian/Area.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cartesian/Area.tsx b/src/cartesian/Area.tsx index 589b543f58..886e7845d7 100644 --- a/src/cartesian/Area.tsx +++ b/src/cartesian/Area.tsx @@ -119,8 +119,12 @@ export class Area extends PureComponent { }; static getBaseValue = (props: Props, item: Area, xAxis: Props['xAxis'], yAxis: Props['yAxis']): number => { - const { layout } = props; - const { baseValue } = item.props; + const { layout, baseValue: chartBaseValue } = props; + const { baseValue: itemBaseValue } = item.props; + + // The baseValue can be defined both on the AreaChart as well as on the Area. + // The value for the item takes precedence. + const baseValue = itemBaseValue ?? chartBaseValue; if (isNumber(baseValue) && typeof baseValue === 'number') { return baseValue;