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: stack as percentage with 0 or null values #618

Merged

Conversation

markov00
Copy link
Member

@markov00 markov00 commented Apr 3, 2020

Summary

This commit fix a regression related to the rendering of stacked area/bar charts where Y values are 0 or null and the stack is configured as percentage.
A new snapshot test was also added to cover that case

all-test-ts-baseline-visual-tests-for-all-stories-area-chart-stacked-percentage-with-zeros-visually-looks-correct-1-snap

fix #617

Checklist

Delete any items that are not applicable to this PR.

  • Proper documentation or storybook story was added for features that require explanation or tutorials
  • Unit tests were updated or added to match the most common scenarios

This commit fix a regression related to the rendering of stacked area/bar charts where Y values are
0 or null and the stack is configured as percentage

fix elastic#617
@markov00 markov00 added bug Something isn't working :data Data/series/scales related issue regression labels Apr 3, 2020
@markov00 markov00 self-assigned this Apr 3, 2020
@codecov-io
Copy link

codecov-io commented Apr 3, 2020

Codecov Report

Merging #618 into master will decrease coverage by 0.15%.
The diff coverage is 31.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #618      +/-   ##
==========================================
- Coverage   70.79%   70.63%   -0.16%     
==========================================
  Files         220      220              
  Lines        6409     6439      +30     
  Branches     1224     1229       +5     
==========================================
+ Hits         4537     4548      +11     
- Misses       1853     1872      +19     
  Partials       19       19              
Impacted Files Coverage Δ
...types/partition_chart/layout/types/config_types.ts 100.00% <ø> (ø)
...es/partition_chart/layout/types/viewmodel_types.ts 80.00% <ø> (ø)
...rtition_chart/layout/viewmodel/link_text_layout.ts 7.31% <0.00%> (-0.80%) ⬇️
...ypes/partition_chart/layout/viewmodel/viewmodel.ts 13.28% <0.00%> (-0.22%) ⬇️
src/chart_types/xy_chart/specs/line_annotation.tsx 79.48% <ø> (ø)
src/utils/commons.ts 100.00% <ø> (ø)
...artition_chart/renderer/canvas/canvas_renderers.ts 6.29% <3.22%> (-0.72%) ⬇️
...hart_types/partition_chart/layout/config/config.ts 67.74% <100.00%> (+1.07%) ⬆️
...chart_types/xy_chart/utils/stacked_series_utils.ts 97.80% <100.00%> (+0.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3a691b...d985632. Read the comment docs.

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.

LGTM. Checked Chrome and FF locally.

Checked storybook story and confirmed fix. Also checked banded area and bar charts and fitting function stories. All look good 👍
Screen Recording 2020-04-03 at 09 26 AM

Also checked y0Accessor, looks accurate but a little funcky.

image

Copy link
Contributor

@rshen91 rshen91 left a comment

Choose a reason for hiding this comment

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

LGTM checked out locally on Chrome - thanks for writing really clear tests and adding the new story in storybook

@markov00 markov00 merged commit 7be1f63 into elastic:master Apr 3, 2020
@markov00 markov00 deleted the 2020-04-03_fix_rendering_0_stacked branch April 3, 2020 17:06
markov00 added a commit to markov00/elastic-charts that referenced this pull request Apr 3, 2020
This commit fix a regression related to the rendering of stacked area/bar charts where Y values are 0 or null and the stack is configured as percentage

fix elastic#617
markov00 added a commit that referenced this pull request Apr 6, 2020
This commit fix a regression related to the rendering of stacked area/bar charts where Y values are 0 or null and the stack is configured as percentage

fix #617
markov00 pushed a commit that referenced this pull request Apr 6, 2020
## [18.1.2](v18.1.1...v18.1.2) (2020-04-06)

### Bug Fixes

* stack as percentage with 0 or null values ([#618](#618)) ([#619](#619)) ([65634a7](65634a7)), closes [#617](#617)
markov00 pushed a commit that referenced this pull request Apr 7, 2020
## [18.2.1](v18.2.0...v18.2.1) (2020-04-07)

### Bug Fixes

* stack as percentage with 0 or null values ([#618](#618)) ([7be1f63](7be1f63)), closes [#617](#617)
@markov00
Copy link
Member Author

markov00 commented Apr 7, 2020

🎉 This PR is included in version 18.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Apr 7, 2020
markov00 added a commit to markov00/elastic-charts that referenced this pull request Apr 8, 2020
This commit review the work done in elastic#618 to fix the following case: if we are stacking areas in percentage mode and the values for all series are 0 we shall use 0% as value for each point in that bucket. In the aforementioned PR we were handling that case as null, completely disconnecting the previous data points from the following ones on the chart.
markov00 added a commit that referenced this pull request Apr 9, 2020
This commit review the work done in #618 to fix the following case: if we are stacking areas in percentage mode and the values for all series are 0 we shall use 0% as value for each point in that bucket. In the aforementioned PR we were handling that case as null, completely disconnecting the previous data points from the following ones on the chart.
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working :data Data/series/scales related issue regression released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stacked as percentage render in a wrong way areas and bars
4 participants