Skip to content

feat(react-charts): Add support for secondary y axis in cartesian charts #34665

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

Merged
merged 14 commits into from
Jun 20, 2025

Conversation

Anush2303
Copy link
Contributor

@Anush2303 Anush2303 commented Jun 17, 2025

New Behavior

Support for secondary y axis is added in cartesian charts.
Corresponding v8 commit migrated to v9:
d5a6890

Related Issue(s)

  • Fixes #

@Anush2303 Anush2303 marked this pull request as ready for review June 17, 2025 10:11
@Anush2303 Anush2303 requested a review from a team as a code owner June 17, 2025 10:11
@AtishayMsft
Copy link
Contributor

Can you resolve merge conflict so we can see the PR storybook

@krkshitij
Copy link
Contributor

krkshitij commented Jun 18, 2025

The findVSBCNumericMinMaxOfY function also needs to be updated:

export function findVSBCNumericMinMaxOfY(dataset: DataPoint[]): { startValue: number; endValue: number } {
const yMax = d3Max(dataset, (point: DataPoint) => point.y)!;
const yMin = d3Min(dataset, (point: DataPoint) => point.y)!;
return { startValue: yMin, endValue: yMax };
}

For reference:

private _getMinMaxOfYAxis = (
dataset: IDataPoint[],
yAxisType?: YAxisType,
useSecondaryYScale?: boolean,
): { startValue: number; endValue: number } => {
if (!useSecondaryYScale) {
return findVSBCNumericMinMaxOfY(dataset);
}
const values: number[] = [];
this.props.data.forEach(xPoint => {
xPoint.lineData?.forEach(point => {
if (point.useSecondaryYScale) {
values.push(point.y as number);
}
});
});
return { startValue: d3Min(values)!, endValue: d3Max(values)! };
};

Copy link

github-actions bot commented Jun 18, 2025

📊 Bundle size report

✅ No changes found

Copy link

Pull request demo site: URL

@AtishayMsft
Copy link
Contributor

Could you run and validate playwright report.

@Anush2303
Copy link
Contributor Author

Could you run and validate playwright report.

Yes, ran the report.

Copy link
Contributor

@AtishayMsft AtishayMsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@Anush2303 Anush2303 merged commit 6ad03ce into microsoft:master Jun 20, 2025
14 of 15 checks passed
@Anush2303 Anush2303 deleted the usr/agupta/portv8Fixes branch June 20, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants