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

Vislib: Fix position calculation of ticks in non-horizontal axes #62309

Merged
merged 3 commits into from
Apr 6, 2020

Conversation

flash1293
Copy link
Contributor

Fixes #21589

This PR fixes the hopefully last instance of the problem discovered here: #62004 (review):

When creating a vertical bar with a Date Range, Ip Range or Range agg like the one mentioned above, if you change the X axis position to left, the resulting chart loses the top most axis label.

Most of this was already cleaned up with this PR: #47563
But it didn't take one case into account:
If Filter labels is enabled, the very first label of the vertical axis is always filtered out, even if there is enough space.

This happens because the calculation of the current tick position didn't correctly take the scale padding into account for vertical scales - it was always added even though it has to be subtracted in this case because vertical scales are inverted.

This PR includes a functional test for this specific case and fixes the existing one for the general case (it confused x and y axis).

@flash1293 flash1293 marked this pull request as ready for review April 2, 2020 14:42
@flash1293 flash1293 requested a review from a team April 2, 2020 14:42
@flash1293 flash1293 added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Apr 2, 2020
@elasticmachine
Copy link
Contributor

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

@flash1293 flash1293 requested a review from markov00 April 2, 2020 14:43
@flash1293
Copy link
Contributor Author

@markov00 down for a last round of filterAxisLabels reviewing? ;)

@flash1293
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@majagrubic majagrubic left a comment

Choose a reason for hiding this comment

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

It wasn't immediately obvious to me what this change is about. Tested with the following scenarios:

  • created vertical bar chart on sample data logs
  • y-axis is sum of bytes
  • x-axis date range on @timstamp field
    Positioning of x-axis:
  • x-axis is bottom
  • x-axis is left
  • x-axis is right

All works as expected. Tested on Mac OS in Chrome 80.

Great for adding a functional test as well 👍 ✅

@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 on Mac Chrome 80 with a vertical bar (date-range aggregation) rotating the chart and all labels are now shown correctly with or without the filter label configuration enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Vislib Vislib chart implementation release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

changing from vertical to horizontal bar chart looses x-axis labels
5 participants