From 3d3b0df5cdc778dc00409ea902f6396682dafdf3 Mon Sep 17 00:00:00 2001 From: susiwen8 Date: Wed, 23 Jun 2021 00:02:12 +0800 Subject: [PATCH 1/2] chore(stack): remove stack only same sign --- src/processor/dataStack.ts | 17 +-- test/stack-area.html | 248 +++++++++++++++++++++++++++++++++++++ 2 files changed, 254 insertions(+), 11 deletions(-) create mode 100644 test/stack-area.html diff --git a/src/processor/dataStack.ts b/src/processor/dataStack.ts index e9559cbad2..819024742e 100644 --- a/src/processor/dataStack.ts +++ b/src/processor/dataStack.ts @@ -121,18 +121,13 @@ function calculateStack(stackInfoList: StackInfo[]) { const val = stackInfo.data.getByRawIndex( stackInfo.stackResultDimension, stackedDataRawIndex ) as number; - // Considering positive stack, negative stack and empty data - if ((sum >= 0 && val > 0) // Positive stack - || (sum <= 0 && val < 0) // Negative stack - ) { - // The sum should be as less as possible to be effected - // by floating arithmetic problem. A wrong result probably - // filtered incorrectly by axis min/max. - sum = addSafe(sum, val); - stackedOver = val; - break; - } + // The sum should be as less as possible to be effected + // by floating arithmetic problem. A wrong result probably + // filtered incorrectly by axis min/max. + sum = addSafe(sum, val); + stackedOver = val; + break; } } diff --git a/test/stack-area.html b/test/stack-area.html new file mode 100644 index 0000000000..61cec3d8b9 --- /dev/null +++ b/test/stack-area.html @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + +
+
+
+
+ + + + \ No newline at end of file From d7450d7964a8fe0a5ec72d56988d076887cdece0 Mon Sep 17 00:00:00 2001 From: susiwen8 Date: Thu, 24 Jun 2021 23:15:32 +0800 Subject: [PATCH 2/2] chore: add test case for bar stack --- test/stack-area.html | 148 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/test/stack-area.html b/test/stack-area.html index 61cec3d8b9..256c1e8e15 100644 --- a/test/stack-area.html +++ b/test/stack-area.html @@ -40,6 +40,8 @@
+
+