@visactor/vseed 0.0.21 → 0.0.22
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/builder/builder/advanced/colorItems.d.ts +1 -0
- package/dist/builder/builder/advanced/index.d.ts +1 -1
- package/dist/builder/builder/builder.d.ts +10 -0
- package/dist/index.cjs +214 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +198 -41
- package/dist/index.js.map +1 -1
- package/dist/pipeline/advanced/chart/pipes/analysis/index.d.ts +1 -0
- package/dist/pipeline/advanced/chart/pipes/analysis/sort.d.ts +4 -0
- package/dist/pipeline/advanced/chart/pipes/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/dataset/datasetPivot.d.ts +0 -1
- package/dist/pipeline/spec/chart/pipes/dataset/index.d.ts +1 -1
- package/dist/types/advancedVSeed.d.ts +3 -0
- package/dist/types/chartType/area/area.d.ts +25 -1
- package/dist/types/chartType/areaPercent/areaPercent.d.ts +25 -1
- package/dist/types/chartType/bar/bar.d.ts +25 -1
- package/dist/types/chartType/barParallel/barParallel.d.ts +25 -1
- package/dist/types/chartType/barPercent/barPercent.d.ts +25 -1
- package/dist/types/chartType/column/column.d.ts +25 -1
- package/dist/types/chartType/columnParallel/columnParallel.d.ts +25 -1
- package/dist/types/chartType/columnPercent/columnPercent.d.ts +25 -1
- package/dist/types/chartType/line/line.d.ts +41 -1
- package/dist/types/properties/analysis/analysis.d.ts +4 -0
- package/dist/types/properties/analysis/index.d.ts +3 -0
- package/dist/types/properties/analysis/sortAxis.d.ts +39 -0
- package/dist/types/properties/analysis/sortLegend.d.ts +39 -0
- package/dist/types/properties/index.d.ts +1 -0
- package/dist/types/vseed.d.ts +16 -0
- package/dist/umd/index.js +8105 -78
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { clone, groupBy, isArray, isEmpty, isNullish, isNumber, isString, mergeDeep, omit, pick, unique } from "remeda";
|
1
|
+
import { clone, groupBy, isArray, isEmpty, isNullish, isNumber, isString, mergeDeep, omit, pick, sort, unique } from "remeda";
|
2
2
|
import { color as external_d3_color_color } from "d3-color";
|
3
|
-
import { z } from "zod";
|
3
|
+
import zod, { z } from "zod";
|
4
4
|
const initAdvancedVSeed = (advancedVSeed, context)=>{
|
5
5
|
const { vseed } = context;
|
6
6
|
const { chartType, locale } = vseed;
|
@@ -62,7 +62,6 @@ const createNumFormatter = (format, locale = intl.getLocale())=>{
|
|
62
62
|
roundingMode,
|
63
63
|
roundingPriority
|
64
64
|
};
|
65
|
-
console.log('debug roundingMode', roundingMode);
|
66
65
|
if (isNumber(fractionDigits)) {
|
67
66
|
if (fractionDigits >= 0) {
|
68
67
|
numFormatterOptions.minimumFractionDigits = fractionDigits;
|
@@ -753,11 +752,12 @@ const encodingXY = (advancedVSeed)=>{
|
|
753
752
|
};
|
754
753
|
const { datasetReshapeInfo, dimensions } = advancedVSeed;
|
755
754
|
if (!datasetReshapeInfo || !dimensions) return result;
|
755
|
+
const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
|
756
756
|
const isZeroDimension = 0 === dimensions.length;
|
757
757
|
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
758
758
|
const { foldInfo, unfoldInfo } = cur;
|
759
759
|
const x = [
|
760
|
-
isZeroDimension ? foldInfo.measureName :
|
760
|
+
isZeroDimension ? foldInfo.measureName : xDimension?.id
|
761
761
|
];
|
762
762
|
const y = [
|
763
763
|
foldInfo.measureValue
|
@@ -789,11 +789,12 @@ const encodingYX = (advancedVSeed)=>{
|
|
789
789
|
};
|
790
790
|
const { datasetReshapeInfo, dimensions } = advancedVSeed;
|
791
791
|
if (!datasetReshapeInfo || !dimensions) return result;
|
792
|
+
const yDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
|
792
793
|
const isZeroDimension = 0 === dimensions.length;
|
793
794
|
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
794
795
|
const { foldInfo, unfoldInfo } = cur;
|
795
796
|
const y = [
|
796
|
-
isZeroDimension ? foldInfo.measureName :
|
797
|
+
isZeroDimension ? foldInfo.measureName : yDimension?.id
|
797
798
|
];
|
798
799
|
const x = [
|
799
800
|
foldInfo.measureValue
|
@@ -861,6 +862,7 @@ const encodingRose = (advancedVSeed)=>{
|
|
861
862
|
};
|
862
863
|
const { datasetReshapeInfo, dimensions, measures } = advancedVSeed;
|
863
864
|
if (!datasetReshapeInfo || !dimensions || !measures) return result;
|
865
|
+
const angleDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
|
864
866
|
const is1D1M = 1 === dimensions.length && 1 === measures.length;
|
865
867
|
const isZeroDimension = 0 === dimensions.length;
|
866
868
|
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
@@ -869,13 +871,13 @@ const encodingRose = (advancedVSeed)=>{
|
|
869
871
|
foldInfo.measureValue
|
870
872
|
];
|
871
873
|
const angle = [
|
872
|
-
isZeroDimension ? foldInfo.measureName :
|
874
|
+
isZeroDimension ? foldInfo.measureName : angleDimension?.id
|
873
875
|
];
|
874
876
|
const group = [
|
875
|
-
is1D1M ?
|
877
|
+
is1D1M ? angleDimension?.id : unfoldInfo.groupId
|
876
878
|
];
|
877
879
|
const color = [
|
878
|
-
is1D1M ?
|
880
|
+
is1D1M ? angleDimension?.id : unfoldInfo.groupId
|
879
881
|
];
|
880
882
|
return [
|
881
883
|
...prev,
|
@@ -1095,6 +1097,81 @@ const annotation_annotation = (advancedVSeed, context)=>{
|
|
1095
1097
|
annotation
|
1096
1098
|
};
|
1097
1099
|
};
|
1100
|
+
const sortXBandAxis = (advancedVSeed, context)=>{
|
1101
|
+
const result = {
|
1102
|
+
...advancedVSeed
|
1103
|
+
};
|
1104
|
+
const { vseed } = context;
|
1105
|
+
const { sortAxis, dataset } = vseed;
|
1106
|
+
const { encoding } = advancedVSeed;
|
1107
|
+
const xField = encoding?.[0]?.x?.[0];
|
1108
|
+
if (!sortAxis || !xField) return advancedVSeed;
|
1109
|
+
if (!result.analysis) result.analysis = {};
|
1110
|
+
if (!result.analysis.orderMapping) result.analysis.orderMapping = {};
|
1111
|
+
const axisOrderResult = calcOrder(sortAxis, xField, dataset);
|
1112
|
+
result.analysis.orderMapping[xField] = axisOrderResult;
|
1113
|
+
return result;
|
1114
|
+
};
|
1115
|
+
const sortYBandAxis = (advancedVSeed, context)=>{
|
1116
|
+
const result = {
|
1117
|
+
...advancedVSeed
|
1118
|
+
};
|
1119
|
+
const { vseed } = context;
|
1120
|
+
const { sortAxis, dataset } = vseed;
|
1121
|
+
const { encoding } = advancedVSeed;
|
1122
|
+
const yField = encoding?.[0]?.y?.[0];
|
1123
|
+
if (!sortAxis || !yField) return advancedVSeed;
|
1124
|
+
if (!result.analysis) result.analysis = {};
|
1125
|
+
if (!result.analysis.orderMapping) result.analysis.orderMapping = {};
|
1126
|
+
const axisOrderResult = calcOrder(sortAxis, yField, dataset);
|
1127
|
+
result.analysis.orderMapping[yField] = axisOrderResult;
|
1128
|
+
return result;
|
1129
|
+
};
|
1130
|
+
const sort_sortLegend = (advancedVSeed, context)=>{
|
1131
|
+
const result = {
|
1132
|
+
...advancedVSeed
|
1133
|
+
};
|
1134
|
+
const { vseed } = context;
|
1135
|
+
const { sortLegend } = vseed;
|
1136
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
1137
|
+
const groupField = datasetReshapeInfo?.[0]?.unfoldInfo?.groupId;
|
1138
|
+
const colorIdMap = datasetReshapeInfo?.[0]?.unfoldInfo?.colorIdMap;
|
1139
|
+
const colorItems = datasetReshapeInfo?.[0]?.unfoldInfo?.colorItems;
|
1140
|
+
if (!sortLegend || !groupField || !colorIdMap || !colorItems) return advancedVSeed;
|
1141
|
+
if (!result.analysis) result.analysis = {};
|
1142
|
+
if (!result.analysis.orderMapping) result.analysis.orderMapping = {};
|
1143
|
+
if (sortLegend.customOrder) {
|
1144
|
+
const nameMap = Object.keys(colorIdMap).reduce((pre, cur)=>{
|
1145
|
+
pre[colorIdMap[cur]] = cur;
|
1146
|
+
return pre;
|
1147
|
+
}, {});
|
1148
|
+
const orderRes = sortLegend.customOrder.map((itemNameOrId)=>nameMap[itemNameOrId] ? nameMap[itemNameOrId] : itemNameOrId);
|
1149
|
+
result.analysis.orderMapping[groupField] = orderRes;
|
1150
|
+
return result;
|
1151
|
+
}
|
1152
|
+
const dataset = advancedVSeed.dataset?.flat(2);
|
1153
|
+
const orderRes = calcOrder(sortLegend, groupField, dataset || []);
|
1154
|
+
result.analysis.orderMapping[groupField] = orderRes;
|
1155
|
+
return result;
|
1156
|
+
};
|
1157
|
+
const calcOrder = (sortAxis, id, dataset)=>{
|
1158
|
+
if (sortAxis.customOrder) return sortAxis.customOrder;
|
1159
|
+
const order = sortAxis.order || 'asc';
|
1160
|
+
const orderBy = sortAxis.orderBy;
|
1161
|
+
const res = sort(dataset, (a, b)=>{
|
1162
|
+
const aValue = a[orderBy || id];
|
1163
|
+
const bValue = b[orderBy || id];
|
1164
|
+
if ('asc' === order) {
|
1165
|
+
if (aValue < bValue) return -1;
|
1166
|
+
if (aValue > bValue) return 1;
|
1167
|
+
return 0;
|
1168
|
+
}
|
1169
|
+
if (aValue > bValue) return -1;
|
1170
|
+
if (aValue < bValue) return 1;
|
1171
|
+
return 0;
|
1172
|
+
});
|
1173
|
+
return unique(res.map((item)=>item[id]));
|
1174
|
+
};
|
1098
1175
|
const lineAdvancedPipeline = [
|
1099
1176
|
initAdvancedVSeed,
|
1100
1177
|
autoMeasures,
|
@@ -1105,6 +1182,8 @@ const lineAdvancedPipeline = [
|
|
1105
1182
|
pivotReshapeTo2D1M
|
1106
1183
|
]),
|
1107
1184
|
encodingXY,
|
1185
|
+
sortXBandAxis,
|
1186
|
+
sort_sortLegend,
|
1108
1187
|
lineConfig,
|
1109
1188
|
theme_theme,
|
1110
1189
|
markStyle_markStyle,
|
@@ -1120,6 +1199,8 @@ const barAdvancedPipeline = [
|
|
1120
1199
|
pivotReshapeTo2D1M
|
1121
1200
|
]),
|
1122
1201
|
encodingYX,
|
1202
|
+
sortYBandAxis,
|
1203
|
+
sort_sortLegend,
|
1123
1204
|
barConfig,
|
1124
1205
|
theme_theme,
|
1125
1206
|
markStyle_markStyle,
|
@@ -1135,6 +1216,8 @@ const barParallelAdvancedPipeline = [
|
|
1135
1216
|
pivotReshapeTo2D1M
|
1136
1217
|
]),
|
1137
1218
|
encodingYX,
|
1219
|
+
sortYBandAxis,
|
1220
|
+
sort_sortLegend,
|
1138
1221
|
barParallelConfig,
|
1139
1222
|
theme_theme,
|
1140
1223
|
markStyle_markStyle,
|
@@ -1150,6 +1233,8 @@ const barPercentAdvancedPipeline = [
|
|
1150
1233
|
pivotReshapeTo2D1M
|
1151
1234
|
]),
|
1152
1235
|
encodingYX,
|
1236
|
+
sortYBandAxis,
|
1237
|
+
sort_sortLegend,
|
1153
1238
|
barPercentConfig,
|
1154
1239
|
theme_theme,
|
1155
1240
|
markStyle_markStyle,
|
@@ -1165,6 +1250,8 @@ const columnAdvancedPipeline = [
|
|
1165
1250
|
pivotReshapeTo2D1M
|
1166
1251
|
]),
|
1167
1252
|
encodingXY,
|
1253
|
+
sortXBandAxis,
|
1254
|
+
sort_sortLegend,
|
1168
1255
|
columnConfig,
|
1169
1256
|
theme_theme,
|
1170
1257
|
markStyle_markStyle,
|
@@ -1180,6 +1267,8 @@ const columnParallelAdvancedPipeline = [
|
|
1180
1267
|
pivotReshapeTo2D1M
|
1181
1268
|
]),
|
1182
1269
|
encodingXY,
|
1270
|
+
sortXBandAxis,
|
1271
|
+
sort_sortLegend,
|
1183
1272
|
columnParallelConfig,
|
1184
1273
|
theme_theme,
|
1185
1274
|
markStyle_markStyle,
|
@@ -1195,6 +1284,8 @@ const columnPercentAdvancedPipeline = [
|
|
1195
1284
|
pivotReshapeTo2D1M
|
1196
1285
|
]),
|
1197
1286
|
encodingXY,
|
1287
|
+
sortXBandAxis,
|
1288
|
+
sort_sortLegend,
|
1198
1289
|
columnPercentConfig,
|
1199
1290
|
theme_theme,
|
1200
1291
|
markStyle_markStyle,
|
@@ -1210,6 +1301,8 @@ const areaAdvancedPipeline = [
|
|
1210
1301
|
pivotReshapeTo2D1M
|
1211
1302
|
]),
|
1212
1303
|
encodingXY,
|
1304
|
+
sortXBandAxis,
|
1305
|
+
sort_sortLegend,
|
1213
1306
|
areaConfig,
|
1214
1307
|
theme_theme,
|
1215
1308
|
markStyle_markStyle,
|
@@ -1225,6 +1318,8 @@ const areaPercentAdvancedPipeline = [
|
|
1225
1318
|
pivotReshapeTo2D1M
|
1226
1319
|
]),
|
1227
1320
|
encodingXY,
|
1321
|
+
sortXBandAxis,
|
1322
|
+
sort_sortLegend,
|
1228
1323
|
areaPercentConfig,
|
1229
1324
|
theme_theme,
|
1230
1325
|
markStyle_markStyle,
|
@@ -1471,23 +1566,54 @@ const tableAdvancedPipeline = [
|
|
1471
1566
|
];
|
1472
1567
|
const dataset_dataset = (spec, context)=>{
|
1473
1568
|
const { advancedVSeed } = context;
|
1474
|
-
const { encoding } = advancedVSeed;
|
1569
|
+
const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
|
1570
|
+
const { orderMapping = {} } = analysis ?? {};
|
1475
1571
|
const angle = encoding[0]?.angle?.[0];
|
1476
1572
|
const x = encoding[0]?.x?.[0];
|
1573
|
+
const y = encoding[0]?.y?.[0];
|
1477
1574
|
const group = encoding[0]?.group?.[0];
|
1575
|
+
const id = datasetReshapeInfo[0].id;
|
1478
1576
|
const fields = {};
|
1479
1577
|
if (angle) fields[angle] = {
|
1480
1578
|
sortIndex: 0
|
1481
1579
|
};
|
1482
|
-
if (x)
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1580
|
+
if (x) {
|
1581
|
+
const order = orderMapping[x];
|
1582
|
+
if (order) fields[x] = {
|
1583
|
+
sortIndex: 0,
|
1584
|
+
domain: order,
|
1585
|
+
lockStatisticsByDomain: true
|
1586
|
+
};
|
1587
|
+
else fields[x] = {
|
1588
|
+
sortIndex: 0
|
1589
|
+
};
|
1590
|
+
}
|
1591
|
+
if (y) {
|
1592
|
+
const order = orderMapping[y];
|
1593
|
+
if (order) fields[y] = {
|
1594
|
+
sortIndex: 0,
|
1595
|
+
domain: order,
|
1596
|
+
lockStatisticsByDomain: true
|
1597
|
+
};
|
1598
|
+
else fields[y] = {
|
1599
|
+
sortIndex: 0
|
1600
|
+
};
|
1601
|
+
}
|
1602
|
+
if (group) {
|
1603
|
+
const order = orderMapping[group];
|
1604
|
+
if (order) fields[group] = {
|
1605
|
+
sortIndex: 0,
|
1606
|
+
domain: order,
|
1607
|
+
lockStatisticsByDomain: true
|
1608
|
+
};
|
1609
|
+
else fields[group] = {
|
1610
|
+
sortIndex: 0
|
1611
|
+
};
|
1612
|
+
}
|
1488
1613
|
return {
|
1489
1614
|
...spec,
|
1490
1615
|
data: {
|
1616
|
+
id,
|
1491
1617
|
values: advancedVSeed.dataset,
|
1492
1618
|
fields: fields
|
1493
1619
|
}
|
@@ -1509,12 +1635,6 @@ const datasetPivot = (spec, context)=>{
|
|
1509
1635
|
records: records
|
1510
1636
|
};
|
1511
1637
|
};
|
1512
|
-
const datasetPivotPlaceholder = (spec)=>({
|
1513
|
-
...spec,
|
1514
|
-
data: {
|
1515
|
-
id: 'placeholderDataId'
|
1516
|
-
}
|
1517
|
-
});
|
1518
1638
|
const initColumn = (spec, context)=>{
|
1519
1639
|
const result = {
|
1520
1640
|
...spec
|
@@ -2543,7 +2663,7 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
2543
2663
|
}), {});
|
2544
2664
|
const { legend, color } = baseConfig;
|
2545
2665
|
const { colorScheme } = color;
|
2546
|
-
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight, maxSize, border, shapeType = 'rectRound' } = legend || {};
|
2666
|
+
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize, border, shapeType = 'rectRound' } = legend || {};
|
2547
2667
|
const orient = [
|
2548
2668
|
'bottom',
|
2549
2669
|
'bottomLeft',
|
@@ -3904,7 +4024,7 @@ const pivotLine = [
|
|
3904
4024
|
initLine,
|
3905
4025
|
color_color,
|
3906
4026
|
background_backgroundColor,
|
3907
|
-
|
4027
|
+
dataset_dataset,
|
3908
4028
|
xBand,
|
3909
4029
|
yLinear,
|
3910
4030
|
label_label,
|
@@ -3955,7 +4075,7 @@ const pivotColumn = [
|
|
3955
4075
|
stackInverse,
|
3956
4076
|
color_color,
|
3957
4077
|
background_backgroundColor,
|
3958
|
-
|
4078
|
+
dataset_dataset,
|
3959
4079
|
xBand,
|
3960
4080
|
yLinear,
|
3961
4081
|
label_label,
|
@@ -4002,7 +4122,7 @@ const pivotColumnParallel = [
|
|
4002
4122
|
stackCornerRadius_stackCornerRadius,
|
4003
4123
|
color_color,
|
4004
4124
|
background_backgroundColor,
|
4005
|
-
|
4125
|
+
dataset_dataset,
|
4006
4126
|
xBand,
|
4007
4127
|
yLinear,
|
4008
4128
|
label_label,
|
@@ -4053,7 +4173,7 @@ const pivotColumnPercent = [
|
|
4053
4173
|
color_color,
|
4054
4174
|
percent,
|
4055
4175
|
background_backgroundColor,
|
4056
|
-
|
4176
|
+
dataset_dataset,
|
4057
4177
|
xBand,
|
4058
4178
|
yLinear,
|
4059
4179
|
label_label,
|
@@ -4100,7 +4220,8 @@ const pivotBar = [
|
|
4100
4220
|
stackCornerRadius_stackCornerRadius,
|
4101
4221
|
color_color,
|
4102
4222
|
background_backgroundColor,
|
4103
|
-
|
4223
|
+
dataset_dataset,
|
4224
|
+
xLinear,
|
4104
4225
|
yBand,
|
4105
4226
|
label_label,
|
4106
4227
|
label_label,
|
@@ -4147,9 +4268,9 @@ const pivotBarParallel = [
|
|
4147
4268
|
stackCornerRadius_stackCornerRadius,
|
4148
4269
|
color_color,
|
4149
4270
|
background_backgroundColor,
|
4150
|
-
|
4151
|
-
yBand,
|
4271
|
+
dataset_dataset,
|
4152
4272
|
xLinear,
|
4273
|
+
yBand,
|
4153
4274
|
label_label,
|
4154
4275
|
tooltip_tooltip,
|
4155
4276
|
horizontalCrosshairRect,
|
@@ -4196,7 +4317,7 @@ const pivotBarPercent = [
|
|
4196
4317
|
color_color,
|
4197
4318
|
background_backgroundColor,
|
4198
4319
|
percent,
|
4199
|
-
|
4320
|
+
dataset_dataset,
|
4200
4321
|
yBand,
|
4201
4322
|
xLinear,
|
4202
4323
|
label_label,
|
@@ -4246,7 +4367,7 @@ const pivotArea = [
|
|
4246
4367
|
color_color,
|
4247
4368
|
background_backgroundColor,
|
4248
4369
|
stackInverse,
|
4249
|
-
|
4370
|
+
dataset_dataset,
|
4250
4371
|
xBand,
|
4251
4372
|
yLinear,
|
4252
4373
|
label_label,
|
@@ -4300,7 +4421,7 @@ const pivotAreaPercent = [
|
|
4300
4421
|
color_color,
|
4301
4422
|
background_backgroundColor,
|
4302
4423
|
percent,
|
4303
|
-
|
4424
|
+
dataset_dataset,
|
4304
4425
|
xBand,
|
4305
4426
|
yLinear,
|
4306
4427
|
label_label,
|
@@ -4343,7 +4464,7 @@ const pivotPie = [
|
|
4343
4464
|
initPie,
|
4344
4465
|
color_color,
|
4345
4466
|
background_backgroundColor,
|
4346
|
-
|
4467
|
+
dataset_dataset,
|
4347
4468
|
label_label,
|
4348
4469
|
tooltip_tooltip,
|
4349
4470
|
annotationPoint_annotationPoint,
|
@@ -4380,7 +4501,7 @@ const pivotDonut = [
|
|
4380
4501
|
initDonut,
|
4381
4502
|
color_color,
|
4382
4503
|
background_backgroundColor,
|
4383
|
-
|
4504
|
+
dataset_dataset,
|
4384
4505
|
label_label,
|
4385
4506
|
tooltip_tooltip,
|
4386
4507
|
annotationPoint_annotationPoint,
|
@@ -4420,7 +4541,7 @@ const pivotRose = [
|
|
4420
4541
|
stackInverse,
|
4421
4542
|
color_color,
|
4422
4543
|
background_backgroundColor,
|
4423
|
-
|
4544
|
+
dataset_dataset,
|
4424
4545
|
radiusAxis,
|
4425
4546
|
angleAxis,
|
4426
4547
|
label_label,
|
@@ -4461,7 +4582,7 @@ const pivotRoseParallel = [
|
|
4461
4582
|
stackCornerRadius_stackCornerRadius,
|
4462
4583
|
color_color,
|
4463
4584
|
background_backgroundColor,
|
4464
|
-
|
4585
|
+
dataset_dataset,
|
4465
4586
|
radiusAxis,
|
4466
4587
|
angleAxis,
|
4467
4588
|
label_label,
|
@@ -4501,7 +4622,7 @@ const pivotFunnel = [
|
|
4501
4622
|
initFunnel,
|
4502
4623
|
color_color,
|
4503
4624
|
background_backgroundColor,
|
4504
|
-
|
4625
|
+
dataset_dataset,
|
4505
4626
|
label_label,
|
4506
4627
|
tooltip_tooltip,
|
4507
4628
|
annotationPoint_annotationPoint,
|
@@ -4544,7 +4665,7 @@ const pivotScatter = [
|
|
4544
4665
|
initScatter,
|
4545
4666
|
color_color,
|
4546
4667
|
background_backgroundColor,
|
4547
|
-
|
4668
|
+
dataset_dataset,
|
4548
4669
|
xLinear,
|
4549
4670
|
yLinear,
|
4550
4671
|
label_label,
|
@@ -4585,6 +4706,9 @@ const initTable = (spec, context)=>{
|
|
4585
4706
|
type: 'one-by-one',
|
4586
4707
|
direction: 'row'
|
4587
4708
|
},
|
4709
|
+
hover: {
|
4710
|
+
highlightMode: 'row'
|
4711
|
+
},
|
4588
4712
|
theme: {
|
4589
4713
|
underlayBackgroundColor: 'transparent'
|
4590
4714
|
}
|
@@ -4749,7 +4873,7 @@ const bodyStyle = (spec, context)=>{
|
|
4749
4873
|
const fontSize = themConfig.bodyFontSize || 12;
|
4750
4874
|
const hoverCellBgColor = themConfig.hoverBodyBackgroundColor || '#bedaff';
|
4751
4875
|
const hoverInlineColor = external_d3_color_color(hoverCellBgColor)?.copy({
|
4752
|
-
opacity: 0.
|
4876
|
+
opacity: 0.2
|
4753
4877
|
}).toString();
|
4754
4878
|
result.theme.bodyStyle = {
|
4755
4879
|
borderColor: borderColor,
|
@@ -4941,7 +5065,7 @@ const frameStyle = (spec, context)=>{
|
|
4941
5065
|
result.theme.frameStyle = {
|
4942
5066
|
borderColor,
|
4943
5067
|
borderLineWidth: 0,
|
4944
|
-
cornerRadius:
|
5068
|
+
cornerRadius: 4
|
4945
5069
|
};
|
4946
5070
|
return result;
|
4947
5071
|
};
|
@@ -5035,6 +5159,16 @@ const getColorItems = (builder)=>{
|
|
5035
5159
|
}), {});
|
5036
5160
|
return colorItems.map((d)=>colorIdMap[d]);
|
5037
5161
|
};
|
5162
|
+
const getColorIdMap = (builder)=>{
|
5163
|
+
const advancedVSeed = builder.advancedVSeed;
|
5164
|
+
if (!advancedVSeed) return {};
|
5165
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
5166
|
+
const colorIdMap = datasetReshapeInfo.reduce((prev, cur)=>({
|
5167
|
+
...prev,
|
5168
|
+
...cur.unfoldInfo.colorIdMap
|
5169
|
+
}), {});
|
5170
|
+
return colorIdMap;
|
5171
|
+
};
|
5038
5172
|
class Builder {
|
5039
5173
|
_vseed;
|
5040
5174
|
_advancedVSeed = null;
|
@@ -5051,6 +5185,7 @@ class Builder {
|
|
5051
5185
|
getTheme = (themeKey)=>Builder._themeMap[themeKey];
|
5052
5186
|
getThemeMap = ()=>Builder._themeMap;
|
5053
5187
|
getColorItems = ()=>getColorItems(this);
|
5188
|
+
getColorIdMap = ()=>getColorIdMap(this);
|
5054
5189
|
get vseed() {
|
5055
5190
|
return this._vseed;
|
5056
5191
|
}
|
@@ -6519,6 +6654,25 @@ const zAnnotation = z.object({
|
|
6519
6654
|
annotationHorizontalLine: zAnnotationHorizontalLine.or(z.array(zAnnotationHorizontalLine)).optional(),
|
6520
6655
|
annotationArea: zAnnotationArea.or(z.array(zAnnotationArea)).optional()
|
6521
6656
|
});
|
6657
|
+
const zSortAxis = z.object({
|
6658
|
+
order: z["enum"]([
|
6659
|
+
'asc',
|
6660
|
+
'desc'
|
6661
|
+
]).default('asc'),
|
6662
|
+
orderBy: z.string().optional(),
|
6663
|
+
customOrder: z.array(z.any()).optional()
|
6664
|
+
});
|
6665
|
+
const zSortLegend = z.object({
|
6666
|
+
order: z["enum"]([
|
6667
|
+
'asc',
|
6668
|
+
'desc'
|
6669
|
+
]).default('asc'),
|
6670
|
+
orderBy: z.string().optional(),
|
6671
|
+
customOrder: z.array(z.any()).optional()
|
6672
|
+
});
|
6673
|
+
const zAnalysis = zod.object({
|
6674
|
+
orderMapping: zod.record(zod.string(), zod.array(zod.string())).optional()
|
6675
|
+
});
|
6522
6676
|
const zLocale = z["enum"]([
|
6523
6677
|
'zh-CN',
|
6524
6678
|
'en-US'
|
@@ -6554,6 +6708,8 @@ const zLine = z.object({
|
|
6554
6708
|
xAxis: zXBandAxis.optional(),
|
6555
6709
|
yAxis: zYLinearAxis.optional(),
|
6556
6710
|
crosshairLine: zCrosshairLine.optional(),
|
6711
|
+
sortAxis: zSortAxis.optional(),
|
6712
|
+
sortLegend: zSortLegend.optional(),
|
6557
6713
|
theme: zTheme.optional(),
|
6558
6714
|
pointStyle: zPointStyle.optional(),
|
6559
6715
|
lineStyle: zLineStyle.optional(),
|
@@ -6854,12 +7010,13 @@ const zAdvancedVSeed = z.object({
|
|
6854
7010
|
measures: zMeasureTree,
|
6855
7011
|
encoding: zEncoding,
|
6856
7012
|
config: zConfig,
|
7013
|
+
analysis: zAnalysis,
|
6857
7014
|
theme: zTheme,
|
6858
7015
|
markStyle: zMarkStyle,
|
6859
7016
|
customTheme: zCustomThemeConfig,
|
6860
7017
|
annotation: zAnnotation,
|
6861
7018
|
locale: zLocale
|
6862
7019
|
});
|
6863
|
-
export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, UnfoldDimensionGroupId, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, autoFormatter, autoNumFormatter, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, createFormatter, createNumFormatter, darkTheme, dataReshapeFor1D1M, dataReshapeFor1D2M, dataReshapeFor2D1M, donutAdvancedPipeline, donutSpecPipeline, execPipeline, findAllDimensions, findAllMeasures, findDimensionById, findFirstDimension, findFirstMeasure, findMeasureById, foldMeasures, funnelAdvancedPipeline, funnelSpecPipeline, i18n, intl, isPivotChart, isPivotTable, isTable, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, pivotTableAdvancedPipeline, pivotTableSpecPipeline, preorderTraverse, registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerDonut, registerFunnel, registerLightTheme, registerLine, registerPie, registerPivotTable, registerRose, registerRoseParallel, registerScatter, registerTable, roseAdvancedPipeline, roseParallelAdvancedPipeline, roseParallelSpecPipeline, roseSpecPipeline, scatterAdvancedPipeline, scatterSpecPipeline, tableAdvancedPipeline, tableSpecPipeline, unfoldDimensions, zAdvancedVSeed, zAnnotation, zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zArea, zAreaConfig, zAreaPercent, zAreaPercentConfig, zAreaStyle, zAxis, zBackgroundColor, zBar, zBarConfig, zBarParallel, zBarParallelConfig, zBarPercent, zBarPercentConfig, zBarStyle, zChartType, zColor, zColumn, zColumnConfig, zColumnParallel, zColumnParallelConfig, zColumnPercent, zColumnPercentConfig, zConfig, zCrosshairLine, zCrosshairRect, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensionGroup, zDimensionTree, zDimensions, zDonut, zDonutConfig, zDualAxisConfig, zEncoding, zFoldInfo, zFunnel, zFunnelConfig, zLabel, zLegend, zLine, zLineConfig, zLineStyle, zLocale, zMarkStyle, zMeasure, zMeasureGroup, zMeasureTree, zMeasures, zNumFormat, zPie, zPieConfig, zPivotTable, zPivotTableConfig, zPointStyle, zRose, zRoseConfig, zRoseParallel, zRoseParallelConfig, zScatter, zScatterConfig, zStackCornerRadius, zTable, zTableConfig, zTheme, zTooltip, zUnfoldInfo, zVSeed, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
|
7020
|
+
export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, UnfoldDimensionGroupId, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, autoFormatter, autoNumFormatter, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, createFormatter, createNumFormatter, darkTheme, dataReshapeFor1D1M, dataReshapeFor1D2M, dataReshapeFor2D1M, donutAdvancedPipeline, donutSpecPipeline, execPipeline, findAllDimensions, findAllMeasures, findDimensionById, findFirstDimension, findFirstMeasure, findMeasureById, foldMeasures, funnelAdvancedPipeline, funnelSpecPipeline, i18n, intl, isPivotChart, isPivotTable, isTable, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, pivotTableAdvancedPipeline, pivotTableSpecPipeline, preorderTraverse, registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerDonut, registerFunnel, registerLightTheme, registerLine, registerPie, registerPivotTable, registerRose, registerRoseParallel, registerScatter, registerTable, roseAdvancedPipeline, roseParallelAdvancedPipeline, roseParallelSpecPipeline, roseSpecPipeline, scatterAdvancedPipeline, scatterSpecPipeline, tableAdvancedPipeline, tableSpecPipeline, unfoldDimensions, zAdvancedVSeed, zAnalysis, zAnnotation, zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zArea, zAreaConfig, zAreaPercent, zAreaPercentConfig, zAreaStyle, zAxis, zBackgroundColor, zBar, zBarConfig, zBarParallel, zBarParallelConfig, zBarPercent, zBarPercentConfig, zBarStyle, zChartType, zColor, zColumn, zColumnConfig, zColumnParallel, zColumnParallelConfig, zColumnPercent, zColumnPercentConfig, zConfig, zCrosshairLine, zCrosshairRect, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensionGroup, zDimensionTree, zDimensions, zDonut, zDonutConfig, zDualAxisConfig, zEncoding, zFoldInfo, zFunnel, zFunnelConfig, zLabel, zLegend, zLine, zLineConfig, zLineStyle, zLocale, zMarkStyle, zMeasure, zMeasureGroup, zMeasureTree, zMeasures, zNumFormat, zPie, zPieConfig, zPivotTable, zPivotTableConfig, zPointStyle, zRose, zRoseConfig, zRoseParallel, zRoseParallelConfig, zScatter, zScatterConfig, zSortAxis, zSortLegend, zStackCornerRadius, zTable, zTableConfig, zTheme, zTooltip, zUnfoldInfo, zVSeed, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
|
6864
7021
|
|
6865
7022
|
//# sourceMappingURL=index.js.map
|