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(waffle): fix strange 0 text in legend item extra when label is 0 #1538

Merged
merged 2 commits into from
Dec 30, 2021

Conversation

rshen91
Copy link
Contributor

@rshen91 rshen91 commented Dec 28, 2021

Summary

If the legend item label is "0" or "$0" or of zero value, then the proper legend item extra value will be shown.

Details

I changed the conditional check to const actionExtra = childId !== undefined && itemExtraValues?.get(childId); vs const actionExtra = childId && itemExtraValues?.get(childId); to account for childIds === 0.

Issues

Closes #1512

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)

@rshen91 rshen91 added :partition Partition/PieChart/Donut/Sunburst/Treemap chart related :legend Legend related issue labels Dec 28, 2021
@rshen91 rshen91 marked this pull request as ready for review December 28, 2021 15:30
@rshen91 rshen91 requested review from markov00 and monfera December 28, 2021 15:32
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 solves the issue

@rshen91 rshen91 merged commit 72224b9 into elastic:master Dec 30, 2021
@rshen91 rshen91 deleted the waffle-zero branch December 30, 2021 14:28
nickofthyme pushed a commit that referenced this pull request Jan 5, 2022
# [42.0.0](v41.0.1...v42.0.0) (2022-01-05)

### Bug Fixes

* **flamegraph:** solve animation regression occurring with 6db2677 ([#1541](#1541)) ([5ec6037](5ec6037)), closes [#1540](#1540)
* **heatmap:** render empty state ([#1532](#1532)) ([59002df](59002df))
* **waffle:** fix strange 0 text in legend item extra when label is 0 ([#1538](#1538)) ([72224b9](72224b9))

### Features

* **goal:** add valueFormatter for tooltip ([#1529](#1529)) ([8139973](8139973))
* **heatmap:** add axis titles ([#1503](#1503)) ([a87325d](a87325d))
* **types:** improve generic types in specs, and spec prop types ([#1421](#1421)) ([562929e](562929e))

### BREAKING CHANGES

* **types:** The `xAccessor` and `yAccessor` are now required on all xy chart specs. Stronger typing on `data` prop that may cause type errors when using untyped array (i.e. `const arr: never[] = []`). Other minor type changes related to spec types.
* **heatmap:** The heatmap yAxisLabel.padding style type is changed from Pixel | Partial<Padding> to Pixels | Padding. The heatmap axis labels are now correctly subjected to padding calculations and it will result in a slightly different position of labels.

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
: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] Calculating values for Legend items not working well for some cases.
2 participants