-
Notifications
You must be signed in to change notification settings - Fork 679
Open
Description
For the following data, StackedAreaSeries will not display correctly.
The Negative+Positive values are not calculated correctly for the stacked graphics
aaaa -52.89 -50.35 -42.11 100 -34.56 -28.33
bbbb 1404.4 1404.4 1327.89 1383.78 1365.07 1235.7
In Excel, it show as bellow
Fix it as bellow
diff --git a/src/LiveChartsCore/Kernel/Stacker.cs b/src/LiveChartsCore/Kernel/Stacker.cs
index 473f2b7c6..1e0341cbb 100644
--- a/src/LiveChartsCore/Kernel/Stacker.cs
+++ b/src/LiveChartsCore/Kernel/Stacker.cs
@@ -125,16 +125,22 @@ public class Stacker
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;
return negativeTotal;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels