-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Enable 'tozeroy' mode for Area Charts #33581
base: master
Are you sure you want to change the base?
Conversation
📊 Bundle size report✅ No changes found |
f54f284
to
43263f2
Compare
75a3500
to
7fbe2c1
Compare
7fbe2c1
to
561c69e
Compare
Pull request demo site: URL |
/** | ||
* The prop used to define the Y axis mode (tonexty or tozeroy) | ||
*/ | ||
mode?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont see this changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not in any commit here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its in commit "Merging functions and renaming variables". Check the AreaChart.types.ts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I get it. the enum is not removed. You are still using the enum in the base.tsx file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, will keep it as modes can extend to "values": [
"none",
"tozeroy",
"tozerox",
"tonexty",
"tonextx",
"toself",
"tonext"
], as per the plotly schema
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same functionality can be achieved using string enums also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok changing it
packages/charts/react-charting/src/components/AreaChart/AreaChart.base.tsx
Outdated
Show resolved
Hide resolved
packages/charts/react-charting/src/components/AreaChart/AreaChart.base.tsx
Outdated
Show resolved
Hide resolved
packages/charts/react-charting/src/components/AreaChart/AreaChart.base.tsx
Outdated
Show resolved
Hide resolved
private _getData = (keys: string[], dataSet: any) => { | ||
const dataValues = d3Stack().keys(keys)(dataSet); | ||
const maxOfYVal = d3Max(dataValues[dataValues.length - 1], dp => dp[1])!; | ||
const renderData: Array<IAreaChartDataSetPoint[]> = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentStack.push({ | ||
values: d, | ||
currentLayer.push({ | ||
values: this.props.mode === AreaChartModes.toZeroY ? [0, d[1]] : d, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a snapshot test for this change
const stackedValues = d3Stack().keys(keys)(dataSet); | ||
const maxOfYVal = d3Max(stackedValues[stackedValues.length - 1], dp => dp[1])!; | ||
const stackedData: Array<IAreaChartDataSetPoint[]> = []; | ||
private _getData = (keys: string[], dataSet: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const maxOfYVal = d3Max(stackedValues[stackedValues.length - 1], dp => dp[1])!; | ||
const stackedData: Array<IAreaChartDataSetPoint[]> = []; | ||
private _getData = (keys: string[], dataSet: any) => { | ||
const dataValues = d3Stack().keys(keys)(dataSet); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕵 fluentuiv8 No visual regressions between this PR and main |
Enable 'tozeroy' mode for Area Charts