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

Fix missing labels on certain axes and label filter configurations #47563

Merged

Conversation

flash1293
Copy link
Contributor

Fixes #32059

The root cause is that the old filter code assumed that the ticks are traversed from low position numbers to high position numbers, but that's not always the case (not 100% sure why, maybe due to the way to how we use d3).

This PR makes the existing implementation more robust by calculating the start and end edge for each tick and then checking whether they overlap with the last tick placed. This will work for all cases where the ticks are traversed in order (either from left to right or from right to left)

@flash1293 flash1293 added Feature:XYAxis XY-Axis charts (bar, area, line) Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.5.0 labels Oct 8, 2019
@flash1293 flash1293 requested a review from markov00 October 8, 2019 10:48
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@flash1293 flash1293 changed the title Fix missing labels Fix missing labels on certain axes and label filter configurations Oct 8, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

Tested locally and seems that the missing ticks issue in the axis is solved.
Could you please unskip the tests switch between Y axis scale types for area, line and vertical bar functional tests?

@@ -105,15 +106,22 @@ export class AxisLabels {
selection.selectAll('.tick text')
.text(function (d) {
const par = d3.select(this.parentNode).node();
Copy link
Member

Choose a reason for hiding this comment

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

nit: renaming this to const parentNode bring a bit more readability

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@flash1293
Copy link
Contributor Author

Weird, that doesn't happen locally. I will merge master and run again, if the error persists I will dig in.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@flash1293
Copy link
Contributor Author

flash1293 commented Oct 24, 2019

The test that's failing isn't even hitting the code I changed and I don't get that failure locally.

@dmlemeshko do you have an idea what the problem could be here? The number of ticks changes based on the height of the chart, and it seems like the browser window is taller on CI than locally (based on measuring the screenshot in the jenkins job). Is this a known problem? Is there a workaround?

@elasticmachine
Copy link
Contributor

💔 Build Failed

@flash1293 flash1293 added v7.6.0 and removed v7.5.0 labels Dec 16, 2019
@dmlemeshko
Copy link
Member

@dmlemeshko do you have an idea what the problem could be here? The number of ticks changes based on the height of the chart, and it seems like the browser window is taller on CI than locally (based on measuring the screenshot in the jenkins job). Is this a known problem? Is there a workaround?

Sorry for the late reply. This problem is known and there are other tests adjusted to pass on CI and still be failing locally. I don't like that approach since local failures are confusing. A quick solution is to adjust expected results to pass on both local & CI, a better one is to convert tests to visual regression

@flash1293
Copy link
Contributor Author

Wow, that took way too long. @markov00 could you take another look?

@rayafratkina rayafratkina added release_note:fix and removed release_note:skip Skip the PR/issue when compiling release notes labels Jan 21, 2020
@LeeDr
Copy link

LeeDr commented Jan 21, 2020

@flash1293 One issue with the chart size on Jenkins vs locally is that the tests run on Jenkins with headless Chrome. The command browser.setWindowSize(1280, 800); sets the outside size of the whole browser window, not the Kibana page. So the Kibana page is different when headless than when visible.
The command setScreenshotSize() takes the headless or visible execution into account and causes Kibana to be sized the same. An example of it's use is here;

test/functional/apps/dashboard/dashboard_snapshots.js:      await browser.setScreenshotSize(1000, 500);

I think it will take a bit of testing to figure out the right size setting to use to get the tests all passing with the existing expected results, but they should stay consistent in all cases when done.

@flash1293 flash1293 requested a review from a team January 22, 2020 11:17
@flash1293
Copy link
Contributor Author

flash1293 commented Jan 22, 2020

@LeeDr right, I remember now we discussed that. After syncing with @markov00: However as the rest of these suites are still flaky and fixing that would go beyond the scope of this PR (which is fixing the bug with missing tick labels on rotating the chart), we decided to split that part out and resolve it separately - there is already an issue for that: #22322

I added a non-skipped functional test to just check for the bug to prevent a regression.

I also left in some fixes to the page objects that were necessary because the UI changed but went unnoticed because the tests are skipped. Those will be helpful when tackling #22322 in a separate PR.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

LGTM tested locally and it fix the missing labels when rotating the chart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:XYAxis XY-Axis charts (bar, area, line) release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

X-Axis labels lost when moving position from bottom to left
7 participants