-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[XY] Fixes the broken chart when an agg is placed in another axis and then is hidden #121488
Conversation
Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors) |
Thanx @flash1293 for pointing this out. I changed the implementation of computing the axis and I think that now all cases work fine. |
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.
LGTM but I don't understand a change in an unrelated test
@@ -38,7 +38,31 @@ describe('getConfig', () => { | |||
it('assigns the correct formatter per y axis', () => { | |||
const config = getConfig(visData, visParamsWithTwoYAxes); | |||
expect(config.yAxes.length).toBe(2); | |||
expect(config.yAxes[0].ticks?.formatter).toStrictEqual(config.aspects.y[1].formatter); | |||
expect(config.yAxes[1].ticks?.formatter).toStrictEqual(config.aspects.y[0].formatter); | |||
expect(config.yAxes[0].ticks?.formatter).toStrictEqual(config.aspects.y[0].formatter); |
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.
Can you explain this change? It seems like now another formatter is attached per axis but I can't see why that should happen.
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.
I changed the implementation of calculating the yAxes array. So in the old way (we were looping into the valueAxes array to compute it), the y Axes was : ["left-axis", "right-axis"]
With the current implementation (looping the dimensions.y) the yAxes looks like ["right-axis", "left-axis"].
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
… then is hidden (elastic#121488) * [XY] Fixes the broken chart when an agg is placed in another axis and then is hidden * Fix yAxes ticks * Fix test borkem due to the change of the implementation
… then is hidden (elastic#121488) * [XY] Fixes the broken chart when an agg is placed in another axis and then is hidden * Fix yAxes ticks * Fix test borkem due to the change of the implementation
… then is hidden (elastic#121488) * [XY] Fixes the broken chart when an agg is placed in another axis and then is hidden * Fix yAxes ticks * Fix test borkem due to the change of the implementation
… then is hidden (#121488) (#121554) * [XY] Fixes the broken chart when an agg is placed in another axis and then is hidden * Fix yAxes ticks * Fix test borkem due to the change of the implementation Co-authored-by: Stratoula Kalafateli <[email protected]>
… then is hidden (#121488) (#121555) * [XY] Fixes the broken chart when an agg is placed in another axis and then is hidden * Fix yAxes ticks * Fix test borkem due to the change of the implementation Co-authored-by: Stratoula Kalafateli <[email protected]>
… then is hidden (#121488) (#121556) * [XY] Fixes the broken chart when an agg is placed in another axis and then is hidden * Fix yAxes ticks * Fix test borkem due to the change of the implementation Co-authored-by: Stratoula Kalafateli <[email protected]>
Summary
Closes #121268
There is a bug when you try to create a XY chart with two metrics on two y axes (one in the left and one in the right). If you hide one of the aggs, then the chart was failing with the error:
This PR fixes it:
Checklist