@visactor/vseed 0.0.8 → 0.0.10
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/builder.d.ts +338 -0
- package/dist/dataReshape/constant.d.ts +1 -0
- package/dist/dataSelector/index.d.ts +1 -0
- package/dist/dataSelector/selector.d.ts +7 -0
- package/dist/index.cjs +652 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +637 -89
- package/dist/index.js.map +1 -1
- package/dist/pipeline/advanced/pipes/annotation/annotation.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/annotation/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipes/index.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/markStyle/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipes/markStyle/markStyle.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/annotationPoint.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/index.d.ts +2 -0
- package/dist/pipeline/spec/pipes/legend/{pivotLegend.d.ts → discreteLegend.d.ts} +1 -1
- package/dist/pipeline/spec/pipes/legend/index.d.ts +2 -2
- package/dist/pipeline/spec/pipes/legend/pivotDiscreteLegend.d.ts +2 -0
- package/dist/pipeline/spec/pipes/{legend/legend.d.ts → markStyle/barStyle.d.ts} +1 -1
- package/dist/pipeline/spec/pipes/markStyle/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/stack/index.d.ts +1 -1
- package/dist/pipeline/spec/pipes/stack/stack.d.ts +2 -2
- package/dist/types/advancedVSeed.d.ts +212 -0
- package/dist/types/chartType/area/area.d.ts +6 -1
- package/dist/types/chartType/areaPercent/areaPercent.d.ts +6 -1
- package/dist/types/chartType/bar/bar.d.ts +15 -1
- package/dist/types/chartType/barParallel/barParallel.d.ts +15 -1
- package/dist/types/chartType/barPercent/barPercent.d.ts +15 -1
- package/dist/types/chartType/column/column.d.ts +15 -1
- package/dist/types/chartType/columnParallel/columnParallel.d.ts +15 -1
- package/dist/types/chartType/columnPercent/columnPercent.d.ts +15 -1
- package/dist/types/chartType/line/line.d.ts +6 -1
- package/dist/types/dataSelector/index.d.ts +1 -0
- package/dist/types/dataSelector/selector.d.ts +34 -0
- package/dist/types/properties/annotation/annotation.d.ts +85 -0
- package/dist/types/properties/annotation/annotationPoint.d.ts +147 -0
- package/dist/types/properties/annotation/index.d.ts +2 -0
- package/dist/types/properties/baseConfig/baseConfig.d.ts +102 -0
- package/dist/types/properties/baseConfig/legend.d.ts +101 -4
- package/dist/types/properties/index.d.ts +2 -0
- package/dist/types/properties/markStyle/barStyle.d.ts +114 -0
- package/dist/types/properties/markStyle/index.d.ts +2 -0
- package/dist/types/properties/markStyle/markStyle.d.ts +29 -0
- package/dist/types/properties/theme/customTheme.d.ts +102 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { clone as external_remeda_clone, mergeDeep as external_remeda_mergeDeep, pick as external_remeda_pick, unique } from "remeda";
|
1
|
+
import { clone as external_remeda_clone, mergeDeep as external_remeda_mergeDeep, omit, pick as external_remeda_pick, unique } from "remeda";
|
2
2
|
import { z } from "zod";
|
3
3
|
const initAdvancedVSeed = (advancedVSeed, context)=>{
|
4
4
|
const { vseed } = context;
|
@@ -128,6 +128,7 @@ const FoldMeasureValue = '__MeaValue__';
|
|
128
128
|
const FoldMeasureId = '__MeaId__';
|
129
129
|
const UnfoldDimensionGroup = '__DimGroup__';
|
130
130
|
const Separator = '-';
|
131
|
+
const ORIGINAL_DATA = '__OriginalData__';
|
131
132
|
const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName = UnfoldDimensionGroup, dimensionsSeparator = Separator)=>{
|
132
133
|
if (unfoldStartIndex < 0 || unfoldStartIndex >= dimensions.length) throw new Error('unfoldStartIndex is out of range');
|
133
134
|
const dimensionsToBeUnfolded = dimensions.slice(unfoldStartIndex);
|
@@ -165,12 +166,15 @@ const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName
|
|
165
166
|
};
|
166
167
|
const result = new Array(dataset.length * measures.length);
|
167
168
|
let index = 0;
|
169
|
+
const ids = measures.map((d)=>d.id);
|
168
170
|
for(let i = 0; i < dataset.length; i++)for(let j = 0; j < measures.length; j++){
|
169
|
-
const datum = {
|
171
|
+
const datum = omit({
|
170
172
|
...dataset[i]
|
171
|
-
};
|
173
|
+
}, ids);
|
174
|
+
datum[ORIGINAL_DATA] = dataset[i];
|
172
175
|
const measure = measures[j];
|
173
176
|
const { id, alias } = measure;
|
177
|
+
datum[id] = dataset[i][id];
|
174
178
|
datum[measureId] = id;
|
175
179
|
datum[measureName] = alias;
|
176
180
|
datum[measureValue] = dataset[i][id];
|
@@ -433,15 +437,16 @@ const encodingXY = (advancedVSeed)=>{
|
|
433
437
|
if (!datasetReshapeInfo || !dimensions) return result;
|
434
438
|
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
435
439
|
const { foldInfo, unfoldInfo } = cur;
|
436
|
-
const isSingleDimension =
|
440
|
+
const isSingleDimension = 1 === dimensions.length;
|
441
|
+
const isZeroDimension = 0 === dimensions.length;
|
437
442
|
const x = [
|
438
|
-
|
443
|
+
isZeroDimension ? foldInfo.measureName : dimensions[0].id
|
439
444
|
];
|
440
445
|
const y = [
|
441
446
|
foldInfo.measureValue
|
442
447
|
];
|
443
448
|
const group = [
|
444
|
-
isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
|
449
|
+
isSingleDimension || isZeroDimension ? foldInfo.measureName : unfoldInfo.groupName
|
445
450
|
];
|
446
451
|
const color = [
|
447
452
|
foldInfo.measureName
|
@@ -469,15 +474,16 @@ const encodingYX = (advancedVSeed)=>{
|
|
469
474
|
if (!datasetReshapeInfo || !dimensions) return result;
|
470
475
|
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
471
476
|
const { foldInfo, unfoldInfo } = cur;
|
472
|
-
const
|
477
|
+
const isZeroDimension = 0 === dimensions.length;
|
478
|
+
const isSingleDimension = 1 === dimensions.length;
|
473
479
|
const y = [
|
474
|
-
|
480
|
+
isZeroDimension ? foldInfo.measureName : dimensions[0].id
|
475
481
|
];
|
476
482
|
const x = [
|
477
483
|
foldInfo.measureValue
|
478
484
|
];
|
479
485
|
const group = [
|
480
|
-
isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
|
486
|
+
isSingleDimension || isZeroDimension ? foldInfo.measureName : unfoldInfo.groupName
|
481
487
|
];
|
482
488
|
const color = [
|
483
489
|
foldInfo.measureName
|
@@ -623,6 +629,26 @@ const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
|
|
623
629
|
if (usePivotChart) return execPipeline(pivotPipeline, context, advancedVSeed);
|
624
630
|
return execPipeline(pipeline, context, advancedVSeed);
|
625
631
|
};
|
632
|
+
const markStyle_markStyle = (advancedVSeed, context)=>{
|
633
|
+
const { vseed } = context;
|
634
|
+
const markStyle = external_remeda_pick(vseed, [
|
635
|
+
'barStyle'
|
636
|
+
]);
|
637
|
+
return {
|
638
|
+
...advancedVSeed,
|
639
|
+
markStyle
|
640
|
+
};
|
641
|
+
};
|
642
|
+
const annotation_annotation = (advancedVSeed, context)=>{
|
643
|
+
const { vseed } = context;
|
644
|
+
const annotation = external_remeda_pick(vseed, [
|
645
|
+
'annotationPoint'
|
646
|
+
]);
|
647
|
+
return {
|
648
|
+
...advancedVSeed,
|
649
|
+
annotation
|
650
|
+
};
|
651
|
+
};
|
626
652
|
const lineAdvancedPipeline = [
|
627
653
|
initAdvancedVSeed,
|
628
654
|
autoMeasures,
|
@@ -635,7 +661,8 @@ const lineAdvancedPipeline = [
|
|
635
661
|
encodingXY,
|
636
662
|
vchartBaseConfig,
|
637
663
|
lineConfig,
|
638
|
-
vchartTheme
|
664
|
+
vchartTheme,
|
665
|
+
annotation_annotation
|
639
666
|
];
|
640
667
|
const barAdvancedPipeline = [
|
641
668
|
initAdvancedVSeed,
|
@@ -649,7 +676,9 @@ const barAdvancedPipeline = [
|
|
649
676
|
encodingYX,
|
650
677
|
barConfig,
|
651
678
|
vchartBaseConfig,
|
652
|
-
vchartTheme
|
679
|
+
vchartTheme,
|
680
|
+
markStyle_markStyle,
|
681
|
+
annotation_annotation
|
653
682
|
];
|
654
683
|
const barParallelAdvancedPipeline = [
|
655
684
|
initAdvancedVSeed,
|
@@ -663,7 +692,9 @@ const barParallelAdvancedPipeline = [
|
|
663
692
|
encodingYX,
|
664
693
|
barParallelConfig,
|
665
694
|
vchartBaseConfig,
|
666
|
-
vchartTheme
|
695
|
+
vchartTheme,
|
696
|
+
markStyle_markStyle,
|
697
|
+
annotation_annotation
|
667
698
|
];
|
668
699
|
const barPercentAdvancedPipeline = [
|
669
700
|
initAdvancedVSeed,
|
@@ -677,7 +708,9 @@ const barPercentAdvancedPipeline = [
|
|
677
708
|
encodingYX,
|
678
709
|
barPercentConfig,
|
679
710
|
vchartBaseConfig,
|
680
|
-
vchartTheme
|
711
|
+
vchartTheme,
|
712
|
+
markStyle_markStyle,
|
713
|
+
annotation_annotation
|
681
714
|
];
|
682
715
|
const columnAdvancedPipeline = [
|
683
716
|
initAdvancedVSeed,
|
@@ -691,7 +724,9 @@ const columnAdvancedPipeline = [
|
|
691
724
|
encodingXY,
|
692
725
|
columnConfig,
|
693
726
|
vchartBaseConfig,
|
694
|
-
vchartTheme
|
727
|
+
vchartTheme,
|
728
|
+
markStyle_markStyle,
|
729
|
+
annotation_annotation
|
695
730
|
];
|
696
731
|
const columnParallelAdvancedPipeline = [
|
697
732
|
initAdvancedVSeed,
|
@@ -705,7 +740,9 @@ const columnParallelAdvancedPipeline = [
|
|
705
740
|
encodingXY,
|
706
741
|
columnParallelConfig,
|
707
742
|
vchartBaseConfig,
|
708
|
-
vchartTheme
|
743
|
+
vchartTheme,
|
744
|
+
markStyle_markStyle,
|
745
|
+
annotation_annotation
|
709
746
|
];
|
710
747
|
const columnPercentAdvancedPipeline = [
|
711
748
|
initAdvancedVSeed,
|
@@ -719,7 +756,9 @@ const columnPercentAdvancedPipeline = [
|
|
719
756
|
encodingXY,
|
720
757
|
columnPercentConfig,
|
721
758
|
vchartBaseConfig,
|
722
|
-
vchartTheme
|
759
|
+
vchartTheme,
|
760
|
+
markStyle_markStyle,
|
761
|
+
annotation_annotation
|
723
762
|
];
|
724
763
|
const areaAdvancedPipeline = [
|
725
764
|
initAdvancedVSeed,
|
@@ -733,7 +772,8 @@ const areaAdvancedPipeline = [
|
|
733
772
|
encodingXY,
|
734
773
|
areaConfig,
|
735
774
|
vchartBaseConfig,
|
736
|
-
vchartTheme
|
775
|
+
vchartTheme,
|
776
|
+
annotation_annotation
|
737
777
|
];
|
738
778
|
const areaPercentAdvancedPipeline = [
|
739
779
|
initAdvancedVSeed,
|
@@ -747,7 +787,8 @@ const areaPercentAdvancedPipeline = [
|
|
747
787
|
encodingXY,
|
748
788
|
areaPercentConfig,
|
749
789
|
vchartBaseConfig,
|
750
|
-
vchartTheme
|
790
|
+
vchartTheme,
|
791
|
+
annotation_annotation
|
751
792
|
];
|
752
793
|
const pieAdvancedPipeline = [
|
753
794
|
initAdvancedVSeed,
|
@@ -761,7 +802,8 @@ const pieAdvancedPipeline = [
|
|
761
802
|
encodingPolar,
|
762
803
|
pieConfig,
|
763
804
|
vchartBaseConfig,
|
764
|
-
vchartTheme
|
805
|
+
vchartTheme,
|
806
|
+
annotation_annotation
|
765
807
|
];
|
766
808
|
const dataset_dataset = (spec, context)=>{
|
767
809
|
const { advancedVSeed } = context;
|
@@ -1290,11 +1332,11 @@ const percent = (spec, context)=>{
|
|
1290
1332
|
result.percent = true;
|
1291
1333
|
return result;
|
1292
1334
|
};
|
1293
|
-
const
|
1335
|
+
const stackInverse = (spec)=>{
|
1294
1336
|
const result = {
|
1295
1337
|
...spec
|
1296
1338
|
};
|
1297
|
-
result.
|
1339
|
+
result.stackInverse = true;
|
1298
1340
|
return result;
|
1299
1341
|
};
|
1300
1342
|
const background_backgroundColor = (spec, context)=>{
|
@@ -1340,24 +1382,103 @@ const label_label = (spec, context)=>{
|
|
1340
1382
|
};
|
1341
1383
|
return result;
|
1342
1384
|
};
|
1343
|
-
const
|
1344
|
-
enable: true
|
1345
|
-
};
|
1346
|
-
const legend_legend = (spec, context)=>{
|
1385
|
+
const discreteLegend = (spec, context)=>{
|
1347
1386
|
const result = {
|
1348
1387
|
...spec
|
1349
1388
|
};
|
1350
1389
|
const { advancedVSeed } = context;
|
1351
1390
|
const baseConfig = advancedVSeed.baseConfig.vchart;
|
1352
1391
|
if (!baseConfig || !baseConfig.legend) return result;
|
1353
|
-
const { legend
|
1354
|
-
const { enable } = legend;
|
1392
|
+
const { legend } = baseConfig;
|
1393
|
+
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight, maxSize, border, shapeType = 'rectRound' } = legend || {};
|
1394
|
+
const orient = [
|
1395
|
+
'bottom',
|
1396
|
+
'bottomLeft',
|
1397
|
+
'bottomRight',
|
1398
|
+
'bl',
|
1399
|
+
'br'
|
1400
|
+
].includes(position) ? 'bottom' : [
|
1401
|
+
'top',
|
1402
|
+
'topLeft',
|
1403
|
+
'topRight',
|
1404
|
+
'tl',
|
1405
|
+
'tr'
|
1406
|
+
].includes(position) ? 'top' : [
|
1407
|
+
'left',
|
1408
|
+
'leftTop',
|
1409
|
+
'leftBottom',
|
1410
|
+
'lt',
|
1411
|
+
'lb'
|
1412
|
+
].includes(position) ? 'left' : 'right';
|
1413
|
+
const legendPosition = [
|
1414
|
+
'topLeft',
|
1415
|
+
'bottomLeft',
|
1416
|
+
'leftTop',
|
1417
|
+
'rightTop',
|
1418
|
+
'lt',
|
1419
|
+
'rt',
|
1420
|
+
'tl',
|
1421
|
+
'bl'
|
1422
|
+
].includes(position) ? 'start' : [
|
1423
|
+
'topRight',
|
1424
|
+
'bottomRight',
|
1425
|
+
'leftBottom',
|
1426
|
+
'rightBottom',
|
1427
|
+
'lb',
|
1428
|
+
'rb',
|
1429
|
+
'rt',
|
1430
|
+
'br'
|
1431
|
+
].includes(position) ? 'end' : 'middle';
|
1355
1432
|
result.legends = {
|
1356
|
-
|
1433
|
+
type: 'discrete',
|
1434
|
+
visible: enable,
|
1435
|
+
maxCol: maxSize,
|
1436
|
+
maxRow: maxSize,
|
1437
|
+
autoPage: true,
|
1438
|
+
orient,
|
1439
|
+
position: legendPosition,
|
1440
|
+
data: border ? (items)=>items.map((item)=>{
|
1441
|
+
item.shape.outerBorder = {
|
1442
|
+
stroke: item.shape.fill,
|
1443
|
+
distance: 3,
|
1444
|
+
lineWidth: 1
|
1445
|
+
};
|
1446
|
+
return item;
|
1447
|
+
}) : void 0,
|
1448
|
+
item: {
|
1449
|
+
focus: true,
|
1450
|
+
focusIconStyle: {
|
1451
|
+
size: labelFontSize + 2,
|
1452
|
+
fill: labelFontColor,
|
1453
|
+
fontWeight: labelFontWeight
|
1454
|
+
},
|
1455
|
+
shape: {
|
1456
|
+
space: border ? 6 : 4,
|
1457
|
+
style: {
|
1458
|
+
symbolType: shapeType,
|
1459
|
+
size: border ? 8 : 10
|
1460
|
+
}
|
1461
|
+
},
|
1462
|
+
label: {
|
1463
|
+
style: {
|
1464
|
+
fontSize: labelFontSize,
|
1465
|
+
fill: labelFontColor,
|
1466
|
+
fontWeight: labelFontWeight
|
1467
|
+
}
|
1468
|
+
},
|
1469
|
+
background: {
|
1470
|
+
state: {
|
1471
|
+
selectedHover: {
|
1472
|
+
fill: labelFontColor,
|
1473
|
+
fillOpacity: 0.05
|
1474
|
+
}
|
1475
|
+
}
|
1476
|
+
}
|
1477
|
+
}
|
1357
1478
|
};
|
1358
1479
|
return result;
|
1359
1480
|
};
|
1360
|
-
const
|
1481
|
+
const pivotDiscreteLegend = (spec, context)=>{
|
1361
1482
|
const result = {
|
1362
1483
|
...spec
|
1363
1484
|
};
|
@@ -1367,38 +1488,94 @@ const pivotLegend = (spec, context)=>{
|
|
1367
1488
|
const { datasetReshapeInfo } = advancedVSeed;
|
1368
1489
|
const colorItems = unique(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
|
1369
1490
|
const { legend, color } = baseConfig;
|
1370
|
-
const { enable } = legend;
|
1371
1491
|
const { colorScheme } = color;
|
1492
|
+
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight, maxSize, border, shapeType = 'rectRound' } = legend || {};
|
1493
|
+
const orient = [
|
1494
|
+
'bottom',
|
1495
|
+
'bottomLeft',
|
1496
|
+
'bottomRight',
|
1497
|
+
'bl',
|
1498
|
+
'br'
|
1499
|
+
].includes(position) ? 'bottom' : [
|
1500
|
+
'top',
|
1501
|
+
'topLeft',
|
1502
|
+
'topRight',
|
1503
|
+
'tl',
|
1504
|
+
'tr'
|
1505
|
+
].includes(position) ? 'top' : [
|
1506
|
+
'left',
|
1507
|
+
'leftTop',
|
1508
|
+
'leftBottom',
|
1509
|
+
'lt',
|
1510
|
+
'lb'
|
1511
|
+
].includes(position) ? 'left' : 'right';
|
1512
|
+
const legendPosition = [
|
1513
|
+
'topLeft',
|
1514
|
+
'bottomLeft',
|
1515
|
+
'leftTop',
|
1516
|
+
'rightTop',
|
1517
|
+
'lt',
|
1518
|
+
'rt',
|
1519
|
+
'tl',
|
1520
|
+
'bl'
|
1521
|
+
].includes(position) ? 'start' : [
|
1522
|
+
'topRight',
|
1523
|
+
'bottomRight',
|
1524
|
+
'leftBottom',
|
1525
|
+
'rightBottom',
|
1526
|
+
'lb',
|
1527
|
+
'rb',
|
1528
|
+
'rt',
|
1529
|
+
'br'
|
1530
|
+
].includes(position) ? 'end' : 'middle';
|
1372
1531
|
const legends = {
|
1373
1532
|
visible: enable,
|
1374
|
-
alignSelf: 'end',
|
1375
1533
|
type: 'discrete',
|
1376
|
-
|
1534
|
+
orient,
|
1535
|
+
position: legendPosition,
|
1536
|
+
maxCol: maxSize,
|
1537
|
+
maxRow: maxSize,
|
1377
1538
|
data: colorItems.map((d, index)=>({
|
1378
1539
|
label: d,
|
1379
1540
|
shape: {
|
1380
|
-
|
1541
|
+
outerBorder: border ? {
|
1542
|
+
stroke: colorScheme[index],
|
1543
|
+
distance: 3,
|
1544
|
+
lineWidth: 1
|
1545
|
+
} : void 0,
|
1381
1546
|
fill: colorScheme[index]
|
1382
1547
|
}
|
1383
1548
|
})),
|
1384
1549
|
item: {
|
1550
|
+
focus: true,
|
1551
|
+
focusIconStyle: {
|
1552
|
+
size: labelFontSize + 2,
|
1553
|
+
fill: labelFontColor,
|
1554
|
+
fontWeight: labelFontWeight
|
1555
|
+
},
|
1556
|
+
shape: {
|
1557
|
+
space: border ? 6 : 4,
|
1558
|
+
style: {
|
1559
|
+
symbolType: shapeType,
|
1560
|
+
size: border ? 8 : 10
|
1561
|
+
}
|
1562
|
+
},
|
1563
|
+
label: {
|
1564
|
+
style: {
|
1565
|
+
fontSize: labelFontSize,
|
1566
|
+
fill: labelFontColor,
|
1567
|
+
fontWeight: labelFontWeight
|
1568
|
+
}
|
1569
|
+
},
|
1385
1570
|
background: {
|
1386
|
-
visible: true,
|
1387
1571
|
state: {
|
1388
1572
|
selectedHover: {
|
1389
|
-
fill:
|
1573
|
+
fill: labelFontColor,
|
1390
1574
|
fillOpacity: 0.05
|
1391
1575
|
}
|
1392
1576
|
}
|
1393
|
-
},
|
1394
|
-
label: {
|
1395
|
-
style: {
|
1396
|
-
fontSize: 12,
|
1397
|
-
fill: '#6F6F6F'
|
1398
|
-
}
|
1399
1577
|
}
|
1400
|
-
}
|
1401
|
-
orient: 'bottom'
|
1578
|
+
}
|
1402
1579
|
};
|
1403
1580
|
return {
|
1404
1581
|
...result,
|
@@ -1647,6 +1824,192 @@ const pivotRowDimensions = (spec, context)=>{
|
|
1647
1824
|
rows: rows
|
1648
1825
|
};
|
1649
1826
|
};
|
1827
|
+
const selector_selector = (datum, selector)=>{
|
1828
|
+
if (!selector) return true;
|
1829
|
+
const selectors = Array.isArray(selector) ? selector : [
|
1830
|
+
selector
|
1831
|
+
];
|
1832
|
+
for (const selector of selectors)if (isValueSelector(selector)) {
|
1833
|
+
if (Object.values(datum).find((v)=>v === selector)) return true;
|
1834
|
+
} else if (isMeasureSelector(selector)) {
|
1835
|
+
const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
|
1836
|
+
selector.value
|
1837
|
+
];
|
1838
|
+
switch(selector.operator){
|
1839
|
+
case '=':
|
1840
|
+
if (datum[selector.field] === selectorValueArr[0]) return true;
|
1841
|
+
break;
|
1842
|
+
case '!=':
|
1843
|
+
if (datum[selector.field] !== selectorValueArr[0]) return true;
|
1844
|
+
break;
|
1845
|
+
case '>':
|
1846
|
+
if (datum[selector.field] > selectorValueArr[0]) return true;
|
1847
|
+
break;
|
1848
|
+
case '<':
|
1849
|
+
if (datum[selector.field] < selectorValueArr[0]) return true;
|
1850
|
+
break;
|
1851
|
+
case '>=':
|
1852
|
+
if (datum[selector.field] >= selectorValueArr[0]) return true;
|
1853
|
+
break;
|
1854
|
+
case '<=':
|
1855
|
+
if (datum[selector.field] <= selectorValueArr[0]) return true;
|
1856
|
+
break;
|
1857
|
+
case 'between':
|
1858
|
+
if (Array.isArray(selector.value) && datum[selector.field] >= selectorValueArr[0] && datum[selector.field] <= selectorValueArr[1]) return true;
|
1859
|
+
break;
|
1860
|
+
default:
|
1861
|
+
break;
|
1862
|
+
}
|
1863
|
+
} else if (isDimensionSelector(selector)) {
|
1864
|
+
const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
|
1865
|
+
selector.value
|
1866
|
+
];
|
1867
|
+
if ('in' === selector.operator && selectorValueArr.includes(datum[selector.field])) return true;
|
1868
|
+
if ('not in' === selector.operator && !selectorValueArr.includes(datum[selector.field])) return true;
|
1869
|
+
} else if (isPartialDatumSelector(selector)) {
|
1870
|
+
if (Object.keys(selector).every((key)=>datum[key] === selector[key])) return true;
|
1871
|
+
}
|
1872
|
+
return false;
|
1873
|
+
};
|
1874
|
+
const isValueSelector = (selector)=>'string' == typeof selector || 'number' == typeof selector;
|
1875
|
+
const isPartialDatumSelector = (selector)=>'object' == typeof selector && null !== selector;
|
1876
|
+
const isMeasureSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
|
1877
|
+
'=',
|
1878
|
+
'!=',
|
1879
|
+
'>',
|
1880
|
+
'<',
|
1881
|
+
'>=',
|
1882
|
+
'<=',
|
1883
|
+
'between'
|
1884
|
+
].includes(selector.operator);
|
1885
|
+
const isDimensionSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
|
1886
|
+
'in',
|
1887
|
+
'not in'
|
1888
|
+
].includes(selector.operator);
|
1889
|
+
const barStyle_barStyle = (spec, context)=>{
|
1890
|
+
const { advancedVSeed } = context;
|
1891
|
+
const { markStyle, encoding } = advancedVSeed;
|
1892
|
+
const { barStyle } = markStyle;
|
1893
|
+
if (!barStyle) return spec;
|
1894
|
+
const result = {
|
1895
|
+
...spec
|
1896
|
+
};
|
1897
|
+
const { selector: barSelector, barBorderColor, barBorderStyle, barBorderWidth, barColor, barColorOpacity, barRadius } = barStyle;
|
1898
|
+
return {
|
1899
|
+
...result,
|
1900
|
+
bar: {
|
1901
|
+
style: {
|
1902
|
+
fill: barColor ? (datum, context)=>{
|
1903
|
+
if (selector_selector(datum, barSelector)) return barColor;
|
1904
|
+
return context.seriesColor(datum[encoding[0]?.group?.[0]]);
|
1905
|
+
} : void 0,
|
1906
|
+
fillOpacity: barColorOpacity ? (datum)=>{
|
1907
|
+
if (selector_selector(datum, barSelector)) return barColorOpacity;
|
1908
|
+
return 1;
|
1909
|
+
} : void 0,
|
1910
|
+
stroke: barBorderColor ? (datum, context)=>{
|
1911
|
+
if (selector_selector(datum, barSelector)) return barBorderColor;
|
1912
|
+
return context.seriesColor(datum[encoding[0]?.group?.[0]]);
|
1913
|
+
} : void 0,
|
1914
|
+
lineWidth: barBorderWidth ? (datum)=>{
|
1915
|
+
if (selector_selector(datum, barSelector)) return barBorderWidth;
|
1916
|
+
return 0;
|
1917
|
+
} : void 0,
|
1918
|
+
lineDash: barBorderStyle ? (datum)=>{
|
1919
|
+
if (selector_selector(datum, barSelector)) {
|
1920
|
+
if ('solid' === barBorderStyle) ;
|
1921
|
+
else if ('dashed' === barBorderStyle) return [
|
1922
|
+
5,
|
1923
|
+
5
|
1924
|
+
];
|
1925
|
+
else if ('dotted' === barBorderStyle) return [
|
1926
|
+
1,
|
1927
|
+
5
|
1928
|
+
];
|
1929
|
+
}
|
1930
|
+
return [
|
1931
|
+
0,
|
1932
|
+
0
|
1933
|
+
];
|
1934
|
+
} : void 0,
|
1935
|
+
cornerRadius: barRadius ? (datum)=>{
|
1936
|
+
if (selector_selector(datum, barSelector)) return barRadius;
|
1937
|
+
return 0;
|
1938
|
+
} : void 0
|
1939
|
+
}
|
1940
|
+
}
|
1941
|
+
};
|
1942
|
+
};
|
1943
|
+
const annotationPoint_annotationPoint = (spec, context)=>{
|
1944
|
+
const { advancedVSeed } = context;
|
1945
|
+
const { annotation } = advancedVSeed;
|
1946
|
+
if (!annotation || !annotation.annotationPoint) return spec;
|
1947
|
+
const { annotationPoint } = annotation;
|
1948
|
+
const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
|
1949
|
+
annotationPoint
|
1950
|
+
];
|
1951
|
+
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
1952
|
+
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'middle', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 4, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
|
1953
|
+
const dataset = advancedVSeed.dataset.flat();
|
1954
|
+
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
1955
|
+
return selectedData.map((datum)=>({
|
1956
|
+
regionRelative: true,
|
1957
|
+
position: (data, context)=>{
|
1958
|
+
const targetDatum = data.find((item)=>isSubset(datum, item));
|
1959
|
+
if (targetDatum) {
|
1960
|
+
const { x, y } = context.dataToPosition(targetDatum);
|
1961
|
+
const xBandWidth = context.scaleX?.bandwidth?.();
|
1962
|
+
const yBandWidth = context.scaleY?.bandwidth?.();
|
1963
|
+
if (xBandWidth) return {
|
1964
|
+
x: x,
|
1965
|
+
y: y
|
1966
|
+
};
|
1967
|
+
if (yBandWidth) return {
|
1968
|
+
x,
|
1969
|
+
y: y
|
1970
|
+
};
|
1971
|
+
}
|
1972
|
+
},
|
1973
|
+
itemLine: {
|
1974
|
+
visible: false
|
1975
|
+
},
|
1976
|
+
itemContent: {
|
1977
|
+
offsetY,
|
1978
|
+
offsetX,
|
1979
|
+
text: {
|
1980
|
+
visible: true,
|
1981
|
+
text: text,
|
1982
|
+
style: {
|
1983
|
+
textAlign: textAlign,
|
1984
|
+
textBaseline: textBaseline,
|
1985
|
+
fill: textColor,
|
1986
|
+
fontSize: textFontSize,
|
1987
|
+
fontWeight: textFontWeight
|
1988
|
+
},
|
1989
|
+
labelBackground: {
|
1990
|
+
visible: backgroundVisible,
|
1991
|
+
padding: backgroundPadding,
|
1992
|
+
style: {
|
1993
|
+
cornerRadius: backgroundBorderRadius ?? 4,
|
1994
|
+
fill: backgroundColor,
|
1995
|
+
stroke: backgroundBorderColor,
|
1996
|
+
strokeWidth: backgroundBorderWidth
|
1997
|
+
}
|
1998
|
+
}
|
1999
|
+
}
|
2000
|
+
}
|
2001
|
+
}));
|
2002
|
+
});
|
2003
|
+
return {
|
2004
|
+
...spec,
|
2005
|
+
markPoint
|
2006
|
+
};
|
2007
|
+
};
|
2008
|
+
const isSubset = (sub, obj)=>Object.entries(sub).every(([key, value])=>{
|
2009
|
+
if ('string' == typeof value) return obj[key] === value;
|
2010
|
+
if ('number' == typeof value) return obj[key] === value;
|
2011
|
+
return true;
|
2012
|
+
});
|
1650
2013
|
const line_line = [
|
1651
2014
|
initLine,
|
1652
2015
|
color_color,
|
@@ -1656,7 +2019,8 @@ const line_line = [
|
|
1656
2019
|
yLinear,
|
1657
2020
|
label_label,
|
1658
2021
|
tooltip_tooltip,
|
1659
|
-
|
2022
|
+
discreteLegend,
|
2023
|
+
annotationPoint_annotationPoint
|
1660
2024
|
];
|
1661
2025
|
const pivotLine = [
|
1662
2026
|
initPivot,
|
@@ -1671,17 +2035,19 @@ const pivotLine = [
|
|
1671
2035
|
xBand,
|
1672
2036
|
yLinear,
|
1673
2037
|
label_label,
|
1674
|
-
tooltip_tooltip
|
2038
|
+
tooltip_tooltip,
|
2039
|
+
annotationPoint_annotationPoint
|
1675
2040
|
]),
|
1676
2041
|
pivotRowDimensions,
|
1677
2042
|
pivotColumnDimensions,
|
1678
|
-
|
2043
|
+
pivotDiscreteLegend
|
1679
2044
|
];
|
1680
2045
|
const lineSpecPipeline = [
|
1681
2046
|
pivotAdapter_pivotAdapter(line_line, pivotLine)
|
1682
2047
|
];
|
1683
2048
|
const column = [
|
1684
2049
|
initColumn,
|
2050
|
+
stackInverse,
|
1685
2051
|
color_color,
|
1686
2052
|
background_backgroundColor,
|
1687
2053
|
dataset_dataset,
|
@@ -1689,7 +2055,9 @@ const column = [
|
|
1689
2055
|
yLinear,
|
1690
2056
|
label_label,
|
1691
2057
|
tooltip_tooltip,
|
1692
|
-
|
2058
|
+
discreteLegend,
|
2059
|
+
barStyle_barStyle,
|
2060
|
+
annotationPoint_annotationPoint
|
1693
2061
|
];
|
1694
2062
|
const pivotColumn = [
|
1695
2063
|
initPivot,
|
@@ -1698,17 +2066,20 @@ const pivotColumn = [
|
|
1698
2066
|
datasetPivot,
|
1699
2067
|
pivotIndicators([
|
1700
2068
|
initColumn,
|
2069
|
+
stackInverse,
|
1701
2070
|
color_color,
|
1702
2071
|
background_backgroundColor,
|
1703
2072
|
datasetPivotPlaceholder,
|
1704
2073
|
xBand,
|
1705
2074
|
yLinear,
|
1706
2075
|
label_label,
|
1707
|
-
tooltip_tooltip
|
2076
|
+
tooltip_tooltip,
|
2077
|
+
barStyle_barStyle,
|
2078
|
+
annotationPoint_annotationPoint
|
1708
2079
|
]),
|
1709
2080
|
pivotRowDimensions,
|
1710
2081
|
pivotColumnDimensions,
|
1711
|
-
|
2082
|
+
pivotDiscreteLegend
|
1712
2083
|
];
|
1713
2084
|
const columnSpecPipeline = [
|
1714
2085
|
pivotAdapter_pivotAdapter(column, pivotColumn)
|
@@ -1722,7 +2093,9 @@ const columnParallel = [
|
|
1722
2093
|
yLinear,
|
1723
2094
|
label_label,
|
1724
2095
|
tooltip_tooltip,
|
1725
|
-
|
2096
|
+
discreteLegend,
|
2097
|
+
barStyle_barStyle,
|
2098
|
+
annotationPoint_annotationPoint
|
1726
2099
|
];
|
1727
2100
|
const pivotColumnParallel = [
|
1728
2101
|
initPivot,
|
@@ -1737,17 +2110,20 @@ const pivotColumnParallel = [
|
|
1737
2110
|
xBand,
|
1738
2111
|
yLinear,
|
1739
2112
|
label_label,
|
1740
|
-
tooltip_tooltip
|
2113
|
+
tooltip_tooltip,
|
2114
|
+
barStyle_barStyle,
|
2115
|
+
annotationPoint_annotationPoint
|
1741
2116
|
]),
|
1742
2117
|
pivotRowDimensions,
|
1743
2118
|
pivotColumnDimensions,
|
1744
|
-
|
2119
|
+
pivotDiscreteLegend
|
1745
2120
|
];
|
1746
2121
|
const columnParallelSpecPipeline = [
|
1747
2122
|
pivotAdapter_pivotAdapter(columnParallel, pivotColumnParallel)
|
1748
2123
|
];
|
1749
2124
|
const columnPercent = [
|
1750
2125
|
initColumn,
|
2126
|
+
stackInverse,
|
1751
2127
|
color_color,
|
1752
2128
|
background_backgroundColor,
|
1753
2129
|
percent,
|
@@ -1756,7 +2132,9 @@ const columnPercent = [
|
|
1756
2132
|
yLinear,
|
1757
2133
|
label_label,
|
1758
2134
|
tooltip_tooltip,
|
1759
|
-
|
2135
|
+
discreteLegend,
|
2136
|
+
barStyle_barStyle,
|
2137
|
+
annotationPoint_annotationPoint
|
1760
2138
|
];
|
1761
2139
|
const pivotColumnPercent = [
|
1762
2140
|
initPivot,
|
@@ -1765,6 +2143,7 @@ const pivotColumnPercent = [
|
|
1765
2143
|
datasetPivot,
|
1766
2144
|
pivotIndicators([
|
1767
2145
|
initColumn,
|
2146
|
+
stackInverse,
|
1768
2147
|
color_color,
|
1769
2148
|
percent,
|
1770
2149
|
background_backgroundColor,
|
@@ -1772,11 +2151,13 @@ const pivotColumnPercent = [
|
|
1772
2151
|
xBand,
|
1773
2152
|
yLinear,
|
1774
2153
|
label_label,
|
1775
|
-
tooltip_tooltip
|
2154
|
+
tooltip_tooltip,
|
2155
|
+
barStyle_barStyle,
|
2156
|
+
annotationPoint_annotationPoint
|
1776
2157
|
]),
|
1777
2158
|
pivotRowDimensions,
|
1778
2159
|
pivotColumnDimensions,
|
1779
|
-
|
2160
|
+
pivotDiscreteLegend
|
1780
2161
|
];
|
1781
2162
|
const columnPercentSpecPipeline = [
|
1782
2163
|
pivotAdapter_pivotAdapter(columnPercent, pivotColumnPercent)
|
@@ -1790,7 +2171,9 @@ const bar = [
|
|
1790
2171
|
yBand,
|
1791
2172
|
label_label,
|
1792
2173
|
tooltip_tooltip,
|
1793
|
-
|
2174
|
+
discreteLegend,
|
2175
|
+
barStyle_barStyle,
|
2176
|
+
annotationPoint_annotationPoint
|
1794
2177
|
];
|
1795
2178
|
const pivotBar = [
|
1796
2179
|
initPivot,
|
@@ -1805,11 +2188,13 @@ const pivotBar = [
|
|
1805
2188
|
yBand,
|
1806
2189
|
label_label,
|
1807
2190
|
label_label,
|
1808
|
-
tooltip_tooltip
|
2191
|
+
tooltip_tooltip,
|
2192
|
+
barStyle_barStyle,
|
2193
|
+
annotationPoint_annotationPoint
|
1809
2194
|
]),
|
1810
2195
|
pivotRowDimensions,
|
1811
2196
|
pivotColumnDimensions,
|
1812
|
-
|
2197
|
+
pivotDiscreteLegend
|
1813
2198
|
];
|
1814
2199
|
const barSpecPipeline = [
|
1815
2200
|
pivotAdapter_pivotAdapter(bar, pivotBar)
|
@@ -1823,7 +2208,9 @@ const barParallel = [
|
|
1823
2208
|
yBand,
|
1824
2209
|
label_label,
|
1825
2210
|
tooltip_tooltip,
|
1826
|
-
|
2211
|
+
discreteLegend,
|
2212
|
+
barStyle_barStyle,
|
2213
|
+
annotationPoint_annotationPoint
|
1827
2214
|
];
|
1828
2215
|
const pivotBarParallel = [
|
1829
2216
|
initPivot,
|
@@ -1838,11 +2225,13 @@ const pivotBarParallel = [
|
|
1838
2225
|
yBand,
|
1839
2226
|
xLinear,
|
1840
2227
|
label_label,
|
1841
|
-
tooltip_tooltip
|
2228
|
+
tooltip_tooltip,
|
2229
|
+
barStyle_barStyle,
|
2230
|
+
annotationPoint_annotationPoint
|
1842
2231
|
]),
|
1843
2232
|
pivotRowDimensions,
|
1844
2233
|
pivotColumnDimensions,
|
1845
|
-
|
2234
|
+
pivotDiscreteLegend
|
1846
2235
|
];
|
1847
2236
|
const barParallelSpecPipeline = [
|
1848
2237
|
pivotAdapter_pivotAdapter(barParallel, pivotBarParallel)
|
@@ -1857,7 +2246,9 @@ const barPercent = [
|
|
1857
2246
|
yBand,
|
1858
2247
|
label_label,
|
1859
2248
|
tooltip_tooltip,
|
1860
|
-
|
2249
|
+
discreteLegend,
|
2250
|
+
barStyle_barStyle,
|
2251
|
+
annotationPoint_annotationPoint
|
1861
2252
|
];
|
1862
2253
|
const pivotBarPercent = [
|
1863
2254
|
initPivot,
|
@@ -1873,26 +2264,29 @@ const pivotBarPercent = [
|
|
1873
2264
|
yBand,
|
1874
2265
|
xLinear,
|
1875
2266
|
label_label,
|
1876
|
-
tooltip_tooltip
|
2267
|
+
tooltip_tooltip,
|
2268
|
+
barStyle_barStyle,
|
2269
|
+
annotationPoint_annotationPoint
|
1877
2270
|
]),
|
1878
2271
|
pivotRowDimensions,
|
1879
2272
|
pivotColumnDimensions,
|
1880
|
-
|
2273
|
+
pivotDiscreteLegend
|
1881
2274
|
];
|
1882
2275
|
const barPercentSpecPipeline = [
|
1883
2276
|
pivotAdapter_pivotAdapter(barPercent, pivotBarPercent)
|
1884
2277
|
];
|
1885
2278
|
const area_area = [
|
1886
2279
|
initArea,
|
2280
|
+
stackInverse,
|
1887
2281
|
color_color,
|
1888
2282
|
background_backgroundColor,
|
1889
|
-
stack,
|
1890
2283
|
dataset_dataset,
|
1891
2284
|
xBand,
|
1892
2285
|
yLinear,
|
1893
2286
|
label_label,
|
1894
2287
|
tooltip_tooltip,
|
1895
|
-
|
2288
|
+
discreteLegend,
|
2289
|
+
annotationPoint_annotationPoint
|
1896
2290
|
];
|
1897
2291
|
const pivotArea = [
|
1898
2292
|
initPivot,
|
@@ -1903,22 +2297,24 @@ const pivotArea = [
|
|
1903
2297
|
initArea,
|
1904
2298
|
color_color,
|
1905
2299
|
background_backgroundColor,
|
1906
|
-
|
2300
|
+
stackInverse,
|
1907
2301
|
datasetPivotPlaceholder,
|
1908
2302
|
xBand,
|
1909
2303
|
yLinear,
|
1910
2304
|
label_label,
|
1911
|
-
tooltip_tooltip
|
2305
|
+
tooltip_tooltip,
|
2306
|
+
annotationPoint_annotationPoint
|
1912
2307
|
]),
|
1913
2308
|
pivotRowDimensions,
|
1914
2309
|
pivotColumnDimensions,
|
1915
|
-
|
2310
|
+
pivotDiscreteLegend
|
1916
2311
|
];
|
1917
2312
|
const areaSpecPipeline = [
|
1918
2313
|
pivotAdapter_pivotAdapter(area_area, pivotArea)
|
1919
2314
|
];
|
1920
2315
|
const areaPercent = [
|
1921
2316
|
initArea,
|
2317
|
+
stackInverse,
|
1922
2318
|
color_color,
|
1923
2319
|
background_backgroundColor,
|
1924
2320
|
percent,
|
@@ -1927,7 +2323,8 @@ const areaPercent = [
|
|
1927
2323
|
yLinear,
|
1928
2324
|
label_label,
|
1929
2325
|
tooltip_tooltip,
|
1930
|
-
|
2326
|
+
discreteLegend,
|
2327
|
+
annotationPoint_annotationPoint
|
1931
2328
|
];
|
1932
2329
|
const pivotAreaPercent = [
|
1933
2330
|
initPivot,
|
@@ -1936,6 +2333,7 @@ const pivotAreaPercent = [
|
|
1936
2333
|
datasetPivot,
|
1937
2334
|
pivotIndicators([
|
1938
2335
|
initArea,
|
2336
|
+
stackInverse,
|
1939
2337
|
color_color,
|
1940
2338
|
background_backgroundColor,
|
1941
2339
|
percent,
|
@@ -1943,11 +2341,12 @@ const pivotAreaPercent = [
|
|
1943
2341
|
xBand,
|
1944
2342
|
yLinear,
|
1945
2343
|
label_label,
|
1946
|
-
tooltip_tooltip
|
2344
|
+
tooltip_tooltip,
|
2345
|
+
annotationPoint_annotationPoint
|
1947
2346
|
]),
|
1948
2347
|
pivotRowDimensions,
|
1949
2348
|
pivotColumnDimensions,
|
1950
|
-
|
2349
|
+
pivotDiscreteLegend
|
1951
2350
|
];
|
1952
2351
|
const areaPercentSpecPipeline = [
|
1953
2352
|
pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
|
@@ -1959,7 +2358,8 @@ const pie = [
|
|
1959
2358
|
dataset_dataset,
|
1960
2359
|
label_label,
|
1961
2360
|
tooltip_tooltip,
|
1962
|
-
|
2361
|
+
discreteLegend,
|
2362
|
+
annotationPoint_annotationPoint
|
1963
2363
|
];
|
1964
2364
|
const pivotPie = [
|
1965
2365
|
initPivot,
|
@@ -1972,11 +2372,12 @@ const pivotPie = [
|
|
1972
2372
|
background_backgroundColor,
|
1973
2373
|
datasetPivotPlaceholder,
|
1974
2374
|
label_label,
|
1975
|
-
tooltip_tooltip
|
2375
|
+
tooltip_tooltip,
|
2376
|
+
annotationPoint_annotationPoint
|
1976
2377
|
]),
|
1977
2378
|
pivotRowDimensions,
|
1978
2379
|
pivotColumnDimensions,
|
1979
|
-
|
2380
|
+
pivotDiscreteLegend
|
1980
2381
|
];
|
1981
2382
|
const pieSpecPipeline = [
|
1982
2383
|
pivotAdapter_pivotAdapter(pie, pivotPie)
|
@@ -2172,10 +2573,10 @@ const darkTheme = ()=>{
|
|
2172
2573
|
return {
|
2173
2574
|
baseConfig: {
|
2174
2575
|
vtable: {
|
2175
|
-
backgroundColor: '
|
2576
|
+
backgroundColor: 'transparent'
|
2176
2577
|
},
|
2177
2578
|
vchart: {
|
2178
|
-
backgroundColor: '
|
2579
|
+
backgroundColor: 'transparent',
|
2179
2580
|
color: {
|
2180
2581
|
colorScheme: [
|
2181
2582
|
'#2E62F1',
|
@@ -2197,7 +2598,14 @@ const darkTheme = ()=>{
|
|
2197
2598
|
enable: true
|
2198
2599
|
},
|
2199
2600
|
legend: {
|
2200
|
-
enable: true
|
2601
|
+
enable: true,
|
2602
|
+
border: true,
|
2603
|
+
maxSize: 1,
|
2604
|
+
position: 'rt',
|
2605
|
+
shapeType: 'rectRound',
|
2606
|
+
labelFontColor: '#FDFDFD',
|
2607
|
+
labelFontSize: 12,
|
2608
|
+
labelFontWeight: 400
|
2201
2609
|
}
|
2202
2610
|
}
|
2203
2611
|
},
|
@@ -2262,18 +2670,18 @@ const lightTheme = ()=>{
|
|
2262
2670
|
},
|
2263
2671
|
grid: {
|
2264
2672
|
visible: true,
|
2265
|
-
gridColor: '
|
2673
|
+
gridColor: '#36415926',
|
2266
2674
|
gridWidth: 0.5
|
2267
2675
|
},
|
2268
2676
|
tick: {
|
2269
2677
|
visible: false,
|
2270
2678
|
tickInside: false,
|
2271
2679
|
tickSize: 4,
|
2272
|
-
tickColor: '
|
2680
|
+
tickColor: '#3641594d'
|
2273
2681
|
},
|
2274
2682
|
line: {
|
2275
2683
|
visible: false,
|
2276
|
-
lineColor: '
|
2684
|
+
lineColor: '#3641594d',
|
2277
2685
|
lineWidth: 1
|
2278
2686
|
}
|
2279
2687
|
};
|
@@ -2304,18 +2712,18 @@ const lightTheme = ()=>{
|
|
2304
2712
|
},
|
2305
2713
|
grid: {
|
2306
2714
|
visible: false,
|
2307
|
-
gridColor: '
|
2715
|
+
gridColor: '#36415926',
|
2308
2716
|
gridWidth: 0.5
|
2309
2717
|
},
|
2310
2718
|
tick: {
|
2311
2719
|
visible: false,
|
2312
2720
|
tickInside: false,
|
2313
2721
|
tickSize: 4,
|
2314
|
-
tickColor: '
|
2722
|
+
tickColor: '#3641594d'
|
2315
2723
|
},
|
2316
2724
|
line: {
|
2317
2725
|
visible: true,
|
2318
|
-
lineColor: '
|
2726
|
+
lineColor: '#3641594d',
|
2319
2727
|
lineWidth: 1
|
2320
2728
|
}
|
2321
2729
|
};
|
@@ -2335,10 +2743,10 @@ const lightTheme = ()=>{
|
|
2335
2743
|
return {
|
2336
2744
|
baseConfig: {
|
2337
2745
|
vtable: {
|
2338
|
-
backgroundColor: '
|
2746
|
+
backgroundColor: 'transparent'
|
2339
2747
|
},
|
2340
2748
|
vchart: {
|
2341
|
-
backgroundColor: '
|
2749
|
+
backgroundColor: 'transparent',
|
2342
2750
|
color: {
|
2343
2751
|
colorScheme: [
|
2344
2752
|
'#8D72F6',
|
@@ -2360,7 +2768,14 @@ const lightTheme = ()=>{
|
|
2360
2768
|
enable: true
|
2361
2769
|
},
|
2362
2770
|
legend: {
|
2363
|
-
enable: true
|
2771
|
+
enable: true,
|
2772
|
+
border: true,
|
2773
|
+
maxSize: 1,
|
2774
|
+
shapeType: 'rectRound',
|
2775
|
+
position: 'rt',
|
2776
|
+
labelFontColor: '#646A73',
|
2777
|
+
labelFontSize: 12,
|
2778
|
+
labelFontWeight: 400
|
2364
2779
|
}
|
2365
2780
|
}
|
2366
2781
|
},
|
@@ -2526,7 +2941,58 @@ const zTooltip = z.object({
|
|
2526
2941
|
enable: z.boolean().default(true).optional()
|
2527
2942
|
});
|
2528
2943
|
const zLegend = z.object({
|
2529
|
-
enable: z.boolean().default(true).optional()
|
2944
|
+
enable: z.boolean().default(true).optional(),
|
2945
|
+
border: z.boolean().default(true).optional(),
|
2946
|
+
maxSize: z.number().default(1).optional(),
|
2947
|
+
shapeType: z["enum"]([
|
2948
|
+
'circle',
|
2949
|
+
'cross',
|
2950
|
+
'diamond',
|
2951
|
+
'square',
|
2952
|
+
'arrow',
|
2953
|
+
'arrow2Left',
|
2954
|
+
'arrow2Right',
|
2955
|
+
'wedge',
|
2956
|
+
'thinTriangle',
|
2957
|
+
'triangle',
|
2958
|
+
'triangleUp',
|
2959
|
+
'triangleDown',
|
2960
|
+
'triangleRight',
|
2961
|
+
'triangleLeft',
|
2962
|
+
'stroke',
|
2963
|
+
'star',
|
2964
|
+
'wye',
|
2965
|
+
'rect',
|
2966
|
+
'arrowLeft',
|
2967
|
+
'arrowRight',
|
2968
|
+
'rectRound',
|
2969
|
+
'roundLine'
|
2970
|
+
]).default('rectRound').optional(),
|
2971
|
+
position: z["enum"]([
|
2972
|
+
'left',
|
2973
|
+
'leftTop',
|
2974
|
+
'leftBottom',
|
2975
|
+
'lt',
|
2976
|
+
'lb',
|
2977
|
+
'top',
|
2978
|
+
'topLeft',
|
2979
|
+
'topRight',
|
2980
|
+
'tl',
|
2981
|
+
'tr',
|
2982
|
+
'right',
|
2983
|
+
'rightTop',
|
2984
|
+
'rightBottom',
|
2985
|
+
'rt',
|
2986
|
+
'rb',
|
2987
|
+
'bottom',
|
2988
|
+
'bottomLeft',
|
2989
|
+
'bottomRight',
|
2990
|
+
'bl',
|
2991
|
+
'br'
|
2992
|
+
]).default('bottom').optional(),
|
2993
|
+
labelFontSize: z.number().default(12).optional(),
|
2994
|
+
labelFontColor: z.string().default('#fff').optional(),
|
2995
|
+
labelFontWeight: z.number().or(z.string()).default(400).optional()
|
2530
2996
|
});
|
2531
2997
|
const zVChartBaseConfig = z.object({
|
2532
2998
|
backgroundColor: zBackgroundColor,
|
@@ -2723,6 +3189,88 @@ const zCustomThemeConfig = z.object({
|
|
2723
3189
|
});
|
2724
3190
|
const zCustomTheme = z.record(z.string(), zCustomThemeConfig).optional();
|
2725
3191
|
const zTheme = z.string();
|
2726
|
-
|
3192
|
+
const zSelector = z.union([
|
3193
|
+
z.string(),
|
3194
|
+
z.number(),
|
3195
|
+
z.object({
|
3196
|
+
field: z.string(),
|
3197
|
+
operator: z.string(),
|
3198
|
+
value: z.union([
|
3199
|
+
z.string(),
|
3200
|
+
z.number(),
|
3201
|
+
z.array(z.union([
|
3202
|
+
z.string(),
|
3203
|
+
z.number()
|
3204
|
+
]))
|
3205
|
+
])
|
3206
|
+
}),
|
3207
|
+
z.object({
|
3208
|
+
field: z.string(),
|
3209
|
+
operator: z.string(),
|
3210
|
+
value: z.union([
|
3211
|
+
z.string(),
|
3212
|
+
z.number(),
|
3213
|
+
z.array(z.union([
|
3214
|
+
z.string(),
|
3215
|
+
z.number()
|
3216
|
+
]))
|
3217
|
+
])
|
3218
|
+
})
|
3219
|
+
]);
|
3220
|
+
const zSelectors = z.array(zSelector);
|
3221
|
+
const zBarStyle = z.object({
|
3222
|
+
selector: z.union([
|
3223
|
+
zSelector,
|
3224
|
+
zSelectors
|
3225
|
+
]).optional(),
|
3226
|
+
barColor: z.string().optional(),
|
3227
|
+
barColorOpacity: z.number().optional(),
|
3228
|
+
barBorderColor: z.string().optional(),
|
3229
|
+
barBorderWidth: z.number().optional(),
|
3230
|
+
barBorderStyle: z.union([
|
3231
|
+
z.literal('solid'),
|
3232
|
+
z.literal('dashed'),
|
3233
|
+
z.literal('dotted')
|
3234
|
+
]).optional(),
|
3235
|
+
barRadius: z.union([
|
3236
|
+
z.number(),
|
3237
|
+
z.array(z.number())
|
3238
|
+
]).optional()
|
3239
|
+
});
|
3240
|
+
const zMarkStyle = z.object({
|
3241
|
+
barStyle: zBarStyle.optional()
|
3242
|
+
});
|
3243
|
+
const zAnnotationPoint = z.object({
|
3244
|
+
selector: z.union([
|
3245
|
+
zSelector,
|
3246
|
+
zSelectors
|
3247
|
+
]),
|
3248
|
+
text: z.string().or(z.array(z.string())).optional(),
|
3249
|
+
textColor: z.string().default('#ffffff').optional(),
|
3250
|
+
textFontSize: z.number().default(12).optional(),
|
3251
|
+
textFontWeight: z.number().default(400).optional(),
|
3252
|
+
textAlign: z["enum"]([
|
3253
|
+
'left',
|
3254
|
+
'right',
|
3255
|
+
'center'
|
3256
|
+
]).default('center').optional(),
|
3257
|
+
textBaseline: z["enum"]([
|
3258
|
+
'top',
|
3259
|
+
'middle',
|
3260
|
+
'bottom'
|
3261
|
+
]).default('middle').optional(),
|
3262
|
+
backgroundVisible: z.boolean().default(true).optional(),
|
3263
|
+
backgroundColor: z.string().default('#212121').optional(),
|
3264
|
+
backgroundBorderColor: z.string().optional(),
|
3265
|
+
backgroundBorderWidth: z.number().default(1).optional(),
|
3266
|
+
backgroundBorderRadius: z.number().default(4).optional(),
|
3267
|
+
backgroundPadding: z.number().optional(),
|
3268
|
+
offsetY: z.number().default(0).optional(),
|
3269
|
+
offsetX: z.number().default(0).optional()
|
3270
|
+
});
|
3271
|
+
const zAnnotation = z.object({
|
3272
|
+
annotationPoint: zAnnotationPoint.or(z.array(zAnnotationPoint)).optional()
|
3273
|
+
});
|
3274
|
+
export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme, dataReshapeFor1D1M, dataReshapeFor2D1M, execPipeline, foldMeasures, isPivotChart, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, all_registerAll as registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerLightTheme, registerLine, unfoldDimensions, zAnnotation, zAnnotationPoint, zAxis, zBackgroundColor, zBarStyle, zBaseConfig, zChartType, zColor, zConfig, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zMarkStyle, zMeasure, zMeasureGroup, zMeasures, zTheme, zTooltip, zUnfoldInfo, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
|
2727
3275
|
|
2728
3276
|
//# sourceMappingURL=index.js.map
|