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(chart): STACKED BARS VALUES did not show correctly when data has … #19006

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ppjmiao
Copy link

@ppjmiao ppjmiao commented Mar 3, 2022

…negative value

fixed the bug #18996

before:
image

after:
Screen Shot 2022-03-03 at 1 42 30 PM

Screen Shot 2022-03-03 at 1 27 36 PM

@ppjmiao
Copy link
Author

ppjmiao commented Mar 3, 2022

@villebro hi, are you available to review the code?

@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Attention: 32 lines in your changes are missing coverage. Please review.

Comparison is base (be88cb9) 66.58% compared to head (749b760) 65.18%.
Report is 3522 commits behind head on master.

Files Patch % Lines
...tend/plugins/legacy-preset-chart-nvd3/src/utils.js 0.00% 32 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19006      +/-   ##
==========================================
- Coverage   66.58%   65.18%   -1.40%     
==========================================
  Files        1641     2103     +462     
  Lines       63548    90599   +27051     
  Branches     6424    13426    +7002     
==========================================
+ Hits        42312    59061   +16749     
- Misses      19555    28404    +8849     
- Partials     1681     3134    +1453     
Flag Coverage Δ
javascript 55.94% <0.00%> (+4.56%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zhaoyongjie
Copy link
Member

@zhoulijuanmiao Thanks for the fix! I will test it in my local environment.

@zhaoyongjie
Copy link
Member

Hi @zhoulijuanmiao, Could you double-check this PR? I haven't got any change on the PR.

image

@rusackas rusackas requested a review from zhaoyongjie March 3, 2022 19:27
@ppjmiao
Copy link
Author

ppjmiao commented Mar 4, 2022

hi @zhaoyongjie, before i fixed it, the chart was looked like this,could you ignore my change in local environment and check again?
Screen Shot 2022-03-02 at 5 26 39 PM

@zhaoyongjie
Copy link
Member

Hi @zhoulijuanmiao, Thanks for your fix, and I have checked in your PR. Currently, the viz looks good. But it looks like there is an issue(might be too short) with all the negative values in the Viz.

After your PR

image

BTW, I found a workaround for showing labels is that set x tick layout to staggered.

Before your PR

image

@ppjmiao
Copy link
Author

ppjmiao commented Mar 5, 2022

hi @zhaoyongjie, Thanks for your check, seems like I need to explain the pr a bit more specific, as you can see, before my pr, there is a feature of how to show bar value labels, negative value showing on the bottom of the bar, positive value showing on the top of the bar.

The rule is satisfied in unstacked bar chart, to see it clearly, I set filters in all pictures below

Screen Shot 2022-03-05 at 8 25 18 AM

Screen Shot 2022-03-05 at 8 07 19 AM

But the rule is not satisfied in stacked bar chart, my purpose is to fix it

Screen Shot 2022-03-05 at 8 07 00 AM

After my pr, the rule will be satisfied in stacked bar chart, additionally, this may make the viz looks better

Screen Shot 2022-03-05 at 8 38 07 AM

@ppjmiao
Copy link
Author

ppjmiao commented Mar 18, 2022

@zhaoyongjie hi, any progress?

@rusackas rusackas requested a review from villebro January 14, 2023 20:44
@rusackas
Copy link
Member

Tagging @villebro for review since he's played around with stacking negative values in this chart before.

@rusackas
Copy link
Member

rusackas commented Feb 6, 2024

Sorry this never got followed up on @ppjmiao — I'll add @michael-s-molina to the conversation, who recently looked at pos/neg value support in this chart quite closely. I'll also close/reopen this PR to retrigger CI and see if we can get it to pass.

@rusackas rusackas closed this Feb 6, 2024
@rusackas rusackas reopened this Feb 6, 2024
Copy link

Choose a reason for hiding this comment

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

At the line 80, there is repetitive code svg.selectAll('.bar-chart-label-group').remove();, I think we can prune this code on this PR together.

svg.selectAll('.bar-chart-label-group').remove();
  setTimeout(() => {
    svg.selectAll('.bar-chart-label-group').remove();
    .....
}

const yPos = parseFloat(rectObj.attr('y'));
const rectWidth = parseFloat(rectObj.attr('width'));
const rectHeight = parseFloat(rectObj.attr('height'));
const isPositive = rectObj.attr('class').includes('positive');
Copy link

Choose a reason for hiding this comment

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

I think we no need isPositive variable

@rusackas
Copy link
Member

rusackas commented Jan 3, 2025

Seems the last couple comments on this PR have gone unaddressed for the last 10 months or so. Please advise :D

@sadpandajoe
Copy link
Member

Seems the last couple comments on this PR have gone unaddressed for the last 10 months or so. Please advise :D

@rusackas looks like the initial problem that this pr addresses has been fixed, i'd vote to close out this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants