Skip to content

Commit

Permalink
Fix Area's baseValue prop (recharts#3013)
Browse files Browse the repository at this point in the history
  • Loading branch information
kotokrad authored Oct 19, 2022
1 parent a78ed04 commit 7354b54
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cartesian/Area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ export class Area extends PureComponent<Props, State> {
animationEasing: 'ease',
};

static getBaseValue = (props: Props, xAxis: Props['xAxis'], yAxis: Props['yAxis']): number => {
const { layout, baseValue } = props;
static getBaseValue = (props: Props, item: Area, xAxis: Props['xAxis'], yAxis: Props['yAxis']): number => {
const { layout } = props;
const { baseValue } = item.props;

if (isNumber(baseValue) && typeof baseValue === 'number') {
return baseValue;
Expand Down Expand Up @@ -154,6 +155,7 @@ export class Area extends PureComponent<Props, State> {

static getComposedData = ({
props,
item,
xAxis,
yAxis,
xAxisTicks,
Expand All @@ -180,7 +182,7 @@ export class Area extends PureComponent<Props, State> {
}) => {
const { layout } = props;
const hasStack = stackedData && stackedData.length;
const baseValue = Area.getBaseValue(props, xAxis, yAxis);
const baseValue = Area.getBaseValue(props, item, xAxis, yAxis);
let isRange = false;

const points = displayedData.map((entry, index) => {
Expand Down

0 comments on commit 7354b54

Please sign in to comment.