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(axis): correct tick alignment in ordinal scale with numeric values #1609

Merged
merged 2 commits into from
Mar 1, 2022

Conversation

markov00
Copy link
Member

@markov00 markov00 commented Feb 24, 2022

Summary

The tick line and label correctly renders now when using an ordinal scale with numeric values on the x axis.

Details

The changes were applied in #1446 to remove tick labels that were outside the domain in a multi-layer time axis.
The problem was caused by the fact that the tick position was limited to the min value between the domain[0] and the value itself. The domain[0], in a continuous scale is the minimum, but when using an ordinal scale, the domain[0] is the first value of the domain and, in a non ordered or just reversed, numerical domain, it can be different than the actual min. This caused the wrong positioning of the labels.

In the VRT test, the change on the data order is desired to check for regressions.
If you want to double-check locally just replace the changed line to the original version:

const domainClampedValue = typeof value === 'number' && typeof scale.domain[0] === 'number' ? Math.max(scale.domain[0], value) : value;

Issues

fix #1608

Checklist

  • The proper chart type label has been added (e.g. :xy, :partition)
  • The proper feature labels have been added (e.g. :interactions, :axis)
  • All related issues have been linked (i.e. closes #123, fixes #123)
  • Unit tests have been added or updated to match the most common scenarios
  • The proper documentation and/or storybook story has been added or updated

@markov00 markov00 added bug Something isn't working :axis Axis related issue regression :xy Bar/Line/Area chart related labels Feb 24, 2022
@markov00 markov00 merged commit e266420 into elastic:master Mar 1, 2022
nickofthyme pushed a commit that referenced this pull request Mar 1, 2022
#1609)

The tick line and label correctly renders now when using an ordinal scale with numeric values on the x axis.
nickofthyme pushed a commit that referenced this pull request Mar 1, 2022
# [44.0.0](v43.1.1...v44.0.0) (2022-03-01)

### Bug Fixes

* **axis:** correct tick alignment in ordinal scale with numeric values ([#1609](#1609)) ([915349d](915349d))
* **legend:** width with duplicate nested pie slice labels ([#1585](#1585)) ([1073231](1073231))
* **partition:** consider legend extras when computing the legend size ([#1611](#1611)) ([2078f3d](2078f3d))
* **xy:** dataIndex keeps original data order on small multiples ([#1597](#1597)) ([9e2566c](9e2566c))

### Features

* **api:** expose Predicate enum ([#1574](#1574)) ([1f73eec](1f73eec))
* **heatmap:** allow rotation of x axis labels ([#1514](#1514)) ([b655156](b655156))

### BREAKING CHANGES

* **heatmap:** `width`, `align`, and `baseline` style properties are removed from the `xAxisLabels` and `yAxisLabels` style of the Heatmap theme.

Co-authored-by: Marco Vettorello <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:axis Axis related issue bug Something isn't working regression :xy Bar/Line/Area chart related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[XY] Tick labels overlap for numeric values
2 participants