-
Notifications
You must be signed in to change notification settings - Fork 690
Gang929 fix stacked area series negative #2086
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
Changes from all commits
53739c4
b82ca03
f767ca7
3e1498d
0870b59
cc9fa0c
84742e8
0a57ce5
8d3e614
ac9b8d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,6 @@ permissions: | |
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ master, dev ] | ||
|
|
||
| jobs: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -125,16 +125,22 @@ public double StackPoint(ChartPoint point, int seriesStackPosition) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (value >= 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| currentStack.End += value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| currentStack.NegativeEnd += value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var positiveTotal = _totals[index].Positive + value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _totals[index].Positive = positiveTotal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var negativeTotal = _totals[index].Negative + value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _totals[index].Negative = negativeTotal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return positiveTotal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| currentStack.End += value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| currentStack.NegativeEnd += value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var negativeTotal = _totals[index].Negative + value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _totals[index].Negative = negativeTotal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var positiveTotal = _totals[index].Positive + value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _totals[index].Positive = positiveTotal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
127
to
+143
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| currentStack.End += value; | |
| currentStack.NegativeEnd += value; | |
| var positiveTotal = _totals[index].Positive + value; | |
| _totals[index].Positive = positiveTotal; | |
| var negativeTotal = _totals[index].Negative + value; | |
| _totals[index].Negative = negativeTotal; | |
| return positiveTotal; | |
| } | |
| else | |
| { | |
| currentStack.End += value; | |
| currentStack.NegativeEnd += value; | |
| var negativeTotal = _totals[index].Negative + value; | |
| _totals[index].Negative = negativeTotal; | |
| var positiveTotal = _totals[index].Positive + value; | |
| _totals[index].Positive = positiveTotal; | |
| // positive values contribute only to the positive stack and total | |
| currentStack.End += value; | |
| var positiveTotal = _totals[index].Positive + value; | |
| _totals[index].Positive = positiveTotal; | |
| return positiveTotal; | |
| } | |
| else | |
| { | |
| // negative values contribute only to the negative stack and total | |
| currentStack.NegativeEnd += value; | |
| var negativeTotal = _totals[index].Negative + value; | |
| _totals[index].Negative = negativeTotal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the
value >= 0branch, the code now also adds the positivevaluetocurrentStack.NegativeEndand_totals[index].Negative. That mixes the positive and negative stacks/totals; it will shiftNegativeEndupward and makeNegativeTotalpositive, which breaks later negative stacking (next series usespreviousActiveStack.NegativeEnd) and can produce incorrectStackedValue.Share/ bounds.