-
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 formatting on multiple axis #115552
[XY] Fixes the formatting on multiple axis #115552
Conversation
Pinging @elastic/kibana-vis-editors (Team:VisEditors) |
); | ||
const yAxes = params.valueAxes.map((a) => { | ||
// find the correct aspect for each value axis | ||
const aspectsIdx = params.seriesParams.findIndex((s) => s.valueAxis === a.id); |
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.
nit, I find this slightly more readable but feel free to ignore :) :
const aspectY = params.seriesParams.find((s) => s.valueAxis === a.id) || aspects.y[0];
And then in the line 59 you could just do aspectY
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.
We can't do this unfortunately. I am retrieving the aspect idx from the seriesParams idx and then use it to retrieve the correct aspect. The params.seriesParams.find((s) => s.valueAxis === a.id)
will return the seriesParam not the aspect!
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.
Oh ok 👌🏼 Thanks for the explanation, makes sense!
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.
Tested on FF, the bug is fixed! 🙌🏼
* [XY] fixes the formatting on multiple axis * Move mock data to its own file
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* [XY] fixes the formatting on multiple axis * Move mock data to its own file Co-authored-by: Stratoula Kalafateli <[email protected]>
Summary
Fixes #13866
This PR fixes a bug on the xy plugin. Specifically, it seems that when we have two metrics assigned to different axis, the format of each metric is not respected and only the formatter of the first field is taken under consideration for both axis.
This is wrong. We want this to work like lens, meaning that if we have 2 axes, each axis should have the correct format. If there are multiple metrics to the same axis then the format of the first metric is respected.
Note: the
getConfig
function is untested, so I created a unit test in order to test the bug fix and some other cases irrelevant with this PR.I will create an issue to increase the coverage on this file as I think it calculates many important things and must be well tested.
Checklist