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(partition): consider legend extras when computing the legend size #1611

Merged

Conversation

markov00
Copy link
Member

Summary

To correctly compute the legend size we need to consider multiple aspects:

  • the icon (usually of a fixed width)
  • the formatted label size
  • the formatted extra value
  • the label hierarchical depth

In the partition chart the third point was missing and it was causing short labels to be wrongly rendered as in this example:

Screenshot 2022-02-28 at 11 15 39

Details

The PR fixes the legend size calculation including the extra formatted value when required.

Issues

fix #1511

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 :legend Legend related issue :partition Partition/PieChart/Donut/Sunburst/Treemap chart related labels Feb 28, 2022
@markov00 markov00 force-pushed the 2022_02_28-fix_partition_short_legend branch from 3df4298 to 43afaae Compare February 28, 2022 11:30
Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

Changes look good.

I think in the future we should look at the interaction between chart and legend when resizing. When reducing the width quickly, the legend is often covered up temporarily by the chart canvas.

Screen Recording 2022-02-28 at 10 56 30 AM

@markov00
Copy link
Member Author

Changes look good.

I think in the future we should look at the interaction between chart and legend when resizing. When reducing the width quickly, the legend is often covered up temporarily by the chart canvas.

Screen Recording 2022-02-28 at 10 56 30 AM

@nickofthyme see #308

@markov00 markov00 merged commit ab75147 into elastic:master Mar 1, 2022
nickofthyme pushed a commit that referenced this pull request Mar 1, 2022
…#1611)

* Include the optional extra value to compute the legend items size

* Update VRTs
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 <vettorello.marco@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working :legend Legend related issue :partition Partition/PieChart/Donut/Sunburst/Treemap chart related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Waffle] Truncating the short name in the legend does not work correctly
2 participants