@visactor/vseed 0.0.39 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +20 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -6
- package/dist/index.js.map +1 -1
- package/dist/umd/index.js +20 -6
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1244,6 +1244,7 @@ const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName
|
|
1244
1244
|
const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, unfoldGroupName = UnfoldDimensionGroup, unfoldGroupId = UnfoldDimensionGroupId, foldMeasureId = FoldMeasureId, dimensionsSeparator = Separator)=>{
|
1245
1245
|
if (unfoldStartIndex < 0 || unfoldStartIndex >= dimensions.length) throw new Error('unfoldStartIndex is out of range');
|
1246
1246
|
const dimensionsToBeUnfolded = dimensions.slice(unfoldStartIndex);
|
1247
|
+
const dimensionsToBeRemain = dimensions.slice(0, unfoldStartIndex);
|
1247
1248
|
const unfoldInfo = {
|
1248
1249
|
groupName: unfoldGroupName,
|
1249
1250
|
groupId: unfoldGroupId,
|
@@ -1272,6 +1273,10 @@ const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, u
|
|
1272
1273
|
datum[unfoldGroupId] = colorId;
|
1273
1274
|
colorItems.push(colorId);
|
1274
1275
|
colorMap[colorId] = colorName;
|
1276
|
+
if (dimensionsToBeRemain.length > 0) for (const dim of dimensionsToBeRemain){
|
1277
|
+
const dimValue = datum[dim.id];
|
1278
|
+
if ('number' == typeof dimValue) datum[dim.id] = String(dimValue);
|
1279
|
+
}
|
1275
1280
|
}
|
1276
1281
|
unfoldInfo.colorItems = unique(colorItems);
|
1277
1282
|
unfoldInfo.colorIdMap = colorMap;
|
@@ -3825,12 +3830,15 @@ const initColumnParallel = (spec, context)=>{
|
|
3825
3830
|
...spec
|
3826
3831
|
};
|
3827
3832
|
const { advancedVSeed } = context;
|
3828
|
-
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
3833
|
+
const { encoding, datasetReshapeInfo, dimensions } = advancedVSeed;
|
3829
3834
|
const { unfoldInfo } = datasetReshapeInfo[0];
|
3830
3835
|
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
3836
|
+
const sameDimensionsMode = dimensions.length > 1 && dimensions.every((dim)=>dim.id === dimensions[0].id);
|
3831
3837
|
result.type = 'bar';
|
3832
3838
|
result.direction = 'vertical';
|
3833
|
-
result.xField = [
|
3839
|
+
result.xField = sameDimensionsMode ? [
|
3840
|
+
encoding[0].x[0]
|
3841
|
+
] : [
|
3834
3842
|
encoding[0].x[0],
|
3835
3843
|
unfoldInfo.groupId
|
3836
3844
|
];
|
@@ -4390,12 +4398,15 @@ const initBarParallel = (spec, context)=>{
|
|
4390
4398
|
...spec
|
4391
4399
|
};
|
4392
4400
|
const { advancedVSeed } = context;
|
4393
|
-
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
4401
|
+
const { encoding, datasetReshapeInfo, dimensions } = advancedVSeed;
|
4394
4402
|
const { unfoldInfo } = datasetReshapeInfo[0];
|
4395
4403
|
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
4404
|
+
const sameDimensionsMode = dimensions.length > 1 && dimensions.every((dim)=>dim.id === dimensions[0].id);
|
4396
4405
|
result.type = 'bar';
|
4397
4406
|
result.direction = 'horizontal';
|
4398
|
-
result.yField = [
|
4407
|
+
result.yField = sameDimensionsMode ? [
|
4408
|
+
encoding[0].y[0]
|
4409
|
+
] : [
|
4399
4410
|
encoding[0].y[0],
|
4400
4411
|
unfoldInfo.groupId
|
4401
4412
|
];
|
@@ -7159,11 +7170,14 @@ const initRoseParallel = (spec, context)=>{
|
|
7159
7170
|
...spec
|
7160
7171
|
};
|
7161
7172
|
const { advancedVSeed } = context;
|
7162
|
-
const { encoding, datasetReshapeInfo, dataset } = advancedVSeed;
|
7173
|
+
const { encoding, datasetReshapeInfo, dataset, dimensions } = advancedVSeed;
|
7163
7174
|
const { unfoldInfo, foldInfo } = datasetReshapeInfo[0];
|
7164
7175
|
if (!encoding[0].radius || !encoding[0].angle || !encoding[0].group) return result;
|
7176
|
+
const sameDimensionsMode = dimensions.length > 1 && dimensions.every((dim)=>dim.id === dimensions[0].id);
|
7165
7177
|
result.type = 'rose';
|
7166
|
-
result.categoryField = [
|
7178
|
+
result.categoryField = sameDimensionsMode ? [
|
7179
|
+
encoding[0].angle[0]
|
7180
|
+
] : [
|
7167
7181
|
encoding[0].angle[0],
|
7168
7182
|
unfoldInfo.groupId
|
7169
7183
|
];
|