Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AreaChart: Respect baseValue of AreaChart, but allow override from Area #3140

Merged
merged 2 commits into from
Jan 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cartesian/Area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,12 @@ export class Area extends PureComponent<Props, State> {
};

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;
Expand Down