From e21aaf78c51ee69c13000d4f6f601e4b0bfb5d48 Mon Sep 17 00:00:00 2001 From: jiawulin001 Date: Fri, 25 Mar 2022 21:45:31 +0800 Subject: [PATCH 1/3] feat: Add stackDim to specify axis to stack --- src/data/helper/dataStackHelper.ts | 5 +++++ src/util/types.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/data/helper/dataStackHelper.ts b/src/data/helper/dataStackHelper.ts index deb3e3e918..3e2cca1ad1 100644 --- a/src/data/helper/dataStackHelper.ts +++ b/src/data/helper/dataStackHelper.ts @@ -102,6 +102,11 @@ export function enableDataStack( } if (mayStack && !dimensionInfo.isExtraCoord) { + //If a dimension is specified by user, use it as stack dimension + let stackDim = seriesModel && seriesModel.get('stackDim'); + if (dimensionInfo && stackDim === dimensionInfo.name){ + stackedDimInfo = dimensionInfo; + } // Find the first ordinal dimension as the stackedByDimInfo. if (!byIndex && !stackedByDimInfo && dimensionInfo.ordinalMeta) { stackedByDimInfo = dimensionInfo; diff --git a/src/util/types.ts b/src/util/types.ts index dbaafc81b6..fb0c08d345 100644 --- a/src/util/types.ts +++ b/src/util/types.ts @@ -1660,7 +1660,8 @@ export interface SeriesLargeOptionMixin { largeThreshold?: number } export interface SeriesStackOptionMixin { - stack?: string + stack?: string, + stackDim?: string } type SamplingFunc = (frame: ArrayLike) => number; From 5039d2bb0d2316a0040cd9f19445b60a3929c909 Mon Sep 17 00:00:00 2001 From: jiawulin001 Date: Fri, 25 Mar 2022 23:28:41 +0800 Subject: [PATCH 2/3] Upload test case for pr#16750 --- test/dataStackDimension.html | 443 +++++++++++++++++++++++++++++++++++ 1 file changed, 443 insertions(+) create mode 100644 test/dataStackDimension.html diff --git a/test/dataStackDimension.html b/test/dataStackDimension.html new file mode 100644 index 0000000000..9b3518125e --- /dev/null +++ b/test/dataStackDimension.html @@ -0,0 +1,443 @@ + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + From 2e52423e471f7b22311dda803f7f8f3645951f96 Mon Sep 17 00:00:00 2001 From: jiawulin001 Date: Wed, 30 Mar 2022 20:22:09 +0800 Subject: [PATCH 3/3] Update for lint flaws --- src/data/helper/dataStackHelper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/helper/dataStackHelper.ts b/src/data/helper/dataStackHelper.ts index 3e2cca1ad1..ebe30e9b7a 100644 --- a/src/data/helper/dataStackHelper.ts +++ b/src/data/helper/dataStackHelper.ts @@ -104,7 +104,7 @@ export function enableDataStack( if (mayStack && !dimensionInfo.isExtraCoord) { //If a dimension is specified by user, use it as stack dimension let stackDim = seriesModel && seriesModel.get('stackDim'); - if (dimensionInfo && stackDim === dimensionInfo.name){ + if (dimensionInfo && stackDim === dimensionInfo.name) { stackedDimInfo = dimensionInfo; } // Find the first ordinal dimension as the stackedByDimInfo.