@visactor/vseed 0.0.10 → 0.0.12
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 +5168 -511
- package/dist/builder/register/theme.d.ts +4 -1
- package/dist/dataSelector/selector.d.ts +1 -1
- package/dist/index.cjs +1690 -247
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1658 -254
- package/dist/index.js.map +1 -1
- package/dist/pipeline/advanced/pipes/config/config.d.ts +3 -3
- package/dist/pipeline/constant.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/annotationArea.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/annotationAreaBand.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/annotationHorizontalLine.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/annotationVerticalLine.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/index.d.ts +4 -0
- package/dist/pipeline/spec/pipes/annotation/utils.d.ts +2 -0
- package/dist/pipeline/spec/pipes/crosshair/horizontalCrosshairRect.d.ts +2 -0
- package/dist/pipeline/spec/pipes/crosshair/index.d.ts +3 -0
- package/dist/pipeline/spec/pipes/crosshair/verticalCrosshairLine.d.ts +2 -0
- package/dist/pipeline/spec/pipes/crosshair/verticalCrosshairRect.d.ts +2 -0
- package/dist/pipeline/spec/pipes/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/markStyle/areaStyle.d.ts +2 -0
- package/dist/pipeline/spec/pipes/markStyle/index.d.ts +3 -0
- package/dist/pipeline/spec/pipes/markStyle/lineStyle.d.ts +2 -0
- package/dist/pipeline/spec/pipes/markStyle/pointStyle.d.ts +2 -0
- package/dist/pipeline/spec/pipes/stack/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/stack/stackCornerRadius.d.ts +2 -0
- package/dist/pipeline/utils/chatType.d.ts +16 -16
- package/dist/pipeline/utils/format/createFormatter.d.ts +2 -0
- package/dist/pipeline/utils/format/createNumFormatter.d.ts +2 -0
- package/dist/pipeline/utils/format/index.d.ts +2 -0
- package/dist/pipeline/utils/index.d.ts +4 -2
- package/dist/pipeline/utils/measures/findMeasureById.d.ts +2 -0
- package/dist/pipeline/utils/measures/index.d.ts +1 -0
- package/dist/types/advancedVSeed.d.ts +3018 -106
- package/dist/types/builder/builder.d.ts +3 -0
- package/dist/types/chartType/area/area.d.ts +48 -1
- package/dist/types/chartType/areaPercent/areaPercent.d.ts +48 -1
- package/dist/types/chartType/bar/bar.d.ts +28 -2
- package/dist/types/chartType/barParallel/barParallel.d.ts +28 -2
- package/dist/types/chartType/barPercent/barPercent.d.ts +28 -2
- package/dist/types/chartType/column/column.d.ts +28 -2
- package/dist/types/chartType/columnParallel/columnParallel.d.ts +28 -2
- package/dist/types/chartType/columnPercent/columnPercent.d.ts +28 -2
- package/dist/types/chartType/line/line.d.ts +39 -1
- package/dist/types/dataSelector/selector.d.ts +60 -6
- package/dist/types/properties/annotation/annotation.d.ts +747 -8
- package/dist/types/properties/annotation/annotationArea.d.ts +248 -0
- package/dist/types/properties/annotation/annotationHorizontalLine.d.ts +253 -0
- package/dist/types/properties/annotation/annotationPoint.d.ts +56 -4
- package/dist/types/properties/annotation/annotationVerticalLine.d.ts +253 -0
- package/dist/types/properties/annotation/index.d.ts +3 -0
- package/dist/types/properties/config/config.d.ts +105 -36
- package/dist/types/properties/config/crosshair.d.ts +17 -0
- package/dist/types/properties/config/index.d.ts +2 -0
- package/dist/types/properties/config/stackCornerRadius.d.ts +3 -0
- package/dist/types/properties/markStyle/areaStyle.d.ts +129 -0
- package/dist/types/properties/markStyle/barStyle.d.ts +56 -4
- package/dist/types/properties/markStyle/index.d.ts +3 -0
- package/dist/types/properties/markStyle/lineStyle.d.ts +160 -0
- package/dist/types/properties/markStyle/markStyle.d.ts +599 -6
- package/dist/types/properties/markStyle/pointStyle.d.ts +168 -0
- package/dist/types/properties/measures/format/formatter.d.ts +1 -0
- package/dist/types/properties/measures/format/index.d.ts +2 -0
- package/dist/types/properties/measures/format/numFormat.d.ts +20 -0
- package/dist/types/properties/measures/index.d.ts +2 -2
- package/dist/types/properties/measures/measures.d.ts +40 -40
- package/dist/types/properties/theme/customTheme.d.ts +3094 -72
- package/dist/types/vseed.d.ts +20 -20
- 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, omit, pick as external_remeda_pick, unique } from "remeda";
|
1
|
+
import { clone as external_remeda_clone, groupBy, isArray, isNumber, isString, 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;
|
@@ -23,6 +23,43 @@ const isPivotChart = (vseed)=>{
|
|
23
23
|
const hasMeasureGroup = measures && measures.find((measure)=>measure && measure.children);
|
24
24
|
return hasRowOrColumnDimension || hasMeasureGroup;
|
25
25
|
};
|
26
|
+
const createNumFormatter = (format)=>{
|
27
|
+
const { type = 'number', ratio = 1, symbol = '', thousandSeparator = true, decimalPlaces = 2, round = 'round', prefix = '', suffix = '' } = format || {};
|
28
|
+
return (value)=>{
|
29
|
+
let num = Number(value);
|
30
|
+
let typeSymbol = '';
|
31
|
+
if (Number.isNaN(num)) return num.toString();
|
32
|
+
if ('percent' === type) {
|
33
|
+
num *= 100;
|
34
|
+
typeSymbol = '%';
|
35
|
+
} else if ('permille' === type) {
|
36
|
+
num *= 1000;
|
37
|
+
typeSymbol = "\u2030";
|
38
|
+
} else if ('number' === type) num /= ratio || 1;
|
39
|
+
const multiplier = 10 ** decimalPlaces;
|
40
|
+
num = Math[round](num * multiplier) / multiplier;
|
41
|
+
let numStr = num.toFixed(decimalPlaces);
|
42
|
+
if (thousandSeparator) {
|
43
|
+
const parts = numStr.split('.');
|
44
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
45
|
+
numStr = parts.join('.');
|
46
|
+
}
|
47
|
+
return `${prefix}${numStr}${typeSymbol}${symbol}${suffix}`;
|
48
|
+
};
|
49
|
+
};
|
50
|
+
const createFormatter = (format)=>createNumFormatter(format);
|
51
|
+
function findMeasureById(measures, id) {
|
52
|
+
if (!measures) return;
|
53
|
+
const stack = [
|
54
|
+
...measures
|
55
|
+
];
|
56
|
+
while(stack.length > 0){
|
57
|
+
const current = stack.pop();
|
58
|
+
if (!current) continue;
|
59
|
+
if (current.id === id && !('children' in current)) return current;
|
60
|
+
if ('children' in current && current.children) stack.push(...current.children);
|
61
|
+
}
|
62
|
+
}
|
26
63
|
const autoMeasures = (advancedVSeed, context)=>{
|
27
64
|
const result = {
|
28
65
|
...advancedVSeed
|
@@ -73,16 +110,16 @@ const autoMeasureGroup = (advancedVSeed, context)=>{
|
|
73
110
|
const measureGroups = [];
|
74
111
|
for (const measure of measures)if ('children' in measure) {
|
75
112
|
if (currentGroup.children?.length) {
|
76
|
-
currentGroup.id = currentGroup.children.map((item)=>item.id).join('-');
|
77
113
|
currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
|
114
|
+
currentGroup.id = currentGroup.alias + currentGroup.children.map((item)=>item.id).join('-');
|
78
115
|
measureGroups.push(currentGroup);
|
79
116
|
currentGroup = createEmptyMeasureGroup();
|
80
117
|
}
|
81
118
|
measureGroups.push(measure);
|
82
119
|
} else currentGroup.children?.push(measure);
|
83
120
|
if (currentGroup.children?.length) {
|
84
|
-
currentGroup.id = currentGroup.children.map((item)=>item.id).join('-');
|
85
121
|
currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
|
122
|
+
currentGroup.id = currentGroup.alias + currentGroup.children.map((item)=>item.id).join('-');
|
86
123
|
measureGroups.push(currentGroup);
|
87
124
|
currentGroup = createEmptyMeasureGroup();
|
88
125
|
}
|
@@ -565,7 +602,28 @@ const lineConfig = (advancedVSeed, context)=>{
|
|
565
602
|
};
|
566
603
|
const config = external_remeda_pick(vseed, [
|
567
604
|
'xAxis',
|
568
|
-
'yAxis'
|
605
|
+
'yAxis',
|
606
|
+
'crosshairLine'
|
607
|
+
]);
|
608
|
+
result.config = {
|
609
|
+
...result.config || {},
|
610
|
+
[chartType]: {
|
611
|
+
...config
|
612
|
+
}
|
613
|
+
};
|
614
|
+
return result;
|
615
|
+
};
|
616
|
+
const columnConfig = (advancedVSeed, context)=>{
|
617
|
+
const { vseed } = context;
|
618
|
+
const { chartType } = vseed;
|
619
|
+
const result = {
|
620
|
+
...advancedVSeed
|
621
|
+
};
|
622
|
+
const config = external_remeda_pick(vseed, [
|
623
|
+
'xAxis',
|
624
|
+
'yAxis',
|
625
|
+
'crosshairRect',
|
626
|
+
'stackCornerRadius'
|
569
627
|
]);
|
570
628
|
result.config = {
|
571
629
|
...result.config || {},
|
@@ -590,14 +648,13 @@ const pieConfig = (advancedVSeed, context)=>{
|
|
590
648
|
};
|
591
649
|
return result;
|
592
650
|
};
|
593
|
-
const barConfig = lineConfig;
|
594
|
-
const barParallelConfig = lineConfig;
|
595
|
-
const barPercentConfig = lineConfig;
|
596
|
-
const columnConfig = lineConfig;
|
597
|
-
const columnParallelConfig = lineConfig;
|
598
|
-
const columnPercentConfig = lineConfig;
|
599
651
|
const areaConfig = lineConfig;
|
600
652
|
const areaPercentConfig = lineConfig;
|
653
|
+
const barConfig = columnConfig;
|
654
|
+
const barParallelConfig = columnConfig;
|
655
|
+
const barPercentConfig = columnConfig;
|
656
|
+
const columnParallelConfig = columnConfig;
|
657
|
+
const columnPercentConfig = columnConfig;
|
601
658
|
const vchartTheme = (advancedVSeed, context)=>{
|
602
659
|
const { customTheme, vseed } = context;
|
603
660
|
const { theme = 'light', chartType } = vseed;
|
@@ -632,7 +689,10 @@ const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
|
|
632
689
|
const markStyle_markStyle = (advancedVSeed, context)=>{
|
633
690
|
const { vseed } = context;
|
634
691
|
const markStyle = external_remeda_pick(vseed, [
|
635
|
-
'barStyle'
|
692
|
+
'barStyle',
|
693
|
+
'pointStyle',
|
694
|
+
'lineStyle',
|
695
|
+
'areaStyle'
|
636
696
|
]);
|
637
697
|
return {
|
638
698
|
...advancedVSeed,
|
@@ -642,7 +702,10 @@ const markStyle_markStyle = (advancedVSeed, context)=>{
|
|
642
702
|
const annotation_annotation = (advancedVSeed, context)=>{
|
643
703
|
const { vseed } = context;
|
644
704
|
const annotation = external_remeda_pick(vseed, [
|
645
|
-
'annotationPoint'
|
705
|
+
'annotationPoint',
|
706
|
+
'annotationHorizontalLine',
|
707
|
+
'annotationVerticalLine',
|
708
|
+
'annotationArea'
|
646
709
|
]);
|
647
710
|
return {
|
648
711
|
...advancedVSeed,
|
@@ -662,6 +725,7 @@ const lineAdvancedPipeline = [
|
|
662
725
|
vchartBaseConfig,
|
663
726
|
lineConfig,
|
664
727
|
vchartTheme,
|
728
|
+
markStyle_markStyle,
|
665
729
|
annotation_annotation
|
666
730
|
];
|
667
731
|
const barAdvancedPipeline = [
|
@@ -773,6 +837,7 @@ const areaAdvancedPipeline = [
|
|
773
837
|
areaConfig,
|
774
838
|
vchartBaseConfig,
|
775
839
|
vchartTheme,
|
840
|
+
markStyle_markStyle,
|
776
841
|
annotation_annotation
|
777
842
|
];
|
778
843
|
const areaPercentAdvancedPipeline = [
|
@@ -788,6 +853,7 @@ const areaPercentAdvancedPipeline = [
|
|
788
853
|
areaPercentConfig,
|
789
854
|
vchartBaseConfig,
|
790
855
|
vchartTheme,
|
856
|
+
markStyle_markStyle,
|
791
857
|
annotation_annotation
|
792
858
|
];
|
793
859
|
const pieAdvancedPipeline = [
|
@@ -1078,7 +1144,15 @@ const xBand = (spec, context)=>{
|
|
1078
1144
|
lineWidth: line?.lineWidth,
|
1079
1145
|
stroke: line?.lineColor
|
1080
1146
|
}
|
1081
|
-
}
|
1147
|
+
},
|
1148
|
+
paddingInner: [
|
1149
|
+
0.15,
|
1150
|
+
0.1
|
1151
|
+
],
|
1152
|
+
paddingOuter: [
|
1153
|
+
0.075,
|
1154
|
+
0.1
|
1155
|
+
]
|
1082
1156
|
};
|
1083
1157
|
result.axes = [
|
1084
1158
|
...result.axes,
|
@@ -1086,6 +1160,8 @@ const xBand = (spec, context)=>{
|
|
1086
1160
|
];
|
1087
1161
|
return result;
|
1088
1162
|
};
|
1163
|
+
const ANNOTATION_Z_INDEX = 1000;
|
1164
|
+
const LINEAR_AXIS_INNER_OFFSET_TOP = 5;
|
1089
1165
|
const xLinear = (spec, context)=>{
|
1090
1166
|
const result = {
|
1091
1167
|
...spec
|
@@ -1154,6 +1230,9 @@ const xLinear = (spec, context)=>{
|
|
1154
1230
|
lineWidth: line?.lineWidth,
|
1155
1231
|
stroke: line?.lineColor
|
1156
1232
|
}
|
1233
|
+
},
|
1234
|
+
innerOffset: {
|
1235
|
+
top: LINEAR_AXIS_INNER_OFFSET_TOP
|
1157
1236
|
}
|
1158
1237
|
};
|
1159
1238
|
result.axes = [
|
@@ -1241,7 +1320,15 @@ const yBand = (spec, context)=>{
|
|
1241
1320
|
lineWidth: line?.lineWidth,
|
1242
1321
|
stroke: line?.lineColor
|
1243
1322
|
}
|
1244
|
-
}
|
1323
|
+
},
|
1324
|
+
paddingInner: [
|
1325
|
+
0.15,
|
1326
|
+
0.1
|
1327
|
+
],
|
1328
|
+
paddingOuter: [
|
1329
|
+
0.075,
|
1330
|
+
0.1
|
1331
|
+
]
|
1245
1332
|
};
|
1246
1333
|
result.axes = [
|
1247
1334
|
...result.axes,
|
@@ -1317,6 +1404,9 @@ const yLinear = (spec, context)=>{
|
|
1317
1404
|
lineWidth: line?.lineWidth,
|
1318
1405
|
stroke: line?.lineColor
|
1319
1406
|
}
|
1407
|
+
},
|
1408
|
+
innerOffset: {
|
1409
|
+
top: LINEAR_AXIS_INNER_OFFSET_TOP
|
1320
1410
|
}
|
1321
1411
|
};
|
1322
1412
|
result.axes = [
|
@@ -1339,6 +1429,15 @@ const stackInverse = (spec)=>{
|
|
1339
1429
|
result.stackInverse = true;
|
1340
1430
|
return result;
|
1341
1431
|
};
|
1432
|
+
const stackCornerRadius_stackCornerRadius = (spec, context)=>{
|
1433
|
+
const { advancedVSeed, vseed } = context;
|
1434
|
+
const { chartType } = vseed;
|
1435
|
+
const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius;
|
1436
|
+
return {
|
1437
|
+
...spec,
|
1438
|
+
stackCornerRadius
|
1439
|
+
};
|
1440
|
+
};
|
1342
1441
|
const background_backgroundColor = (spec, context)=>{
|
1343
1442
|
const result = {
|
1344
1443
|
...spec
|
@@ -1360,11 +1459,55 @@ const tooltip_tooltip = (spec, context)=>{
|
|
1360
1459
|
...spec
|
1361
1460
|
};
|
1362
1461
|
const { advancedVSeed } = context;
|
1462
|
+
const { measures, datasetReshapeInfo } = advancedVSeed;
|
1363
1463
|
const baseConfig = advancedVSeed.baseConfig.vchart;
|
1364
1464
|
const { tooltip = defaultTooltip } = baseConfig;
|
1365
1465
|
const { enable } = tooltip;
|
1466
|
+
const { measureId, measureName, measureValue } = datasetReshapeInfo[0].foldInfo;
|
1366
1467
|
result.tooltip = {
|
1367
|
-
visible: enable
|
1468
|
+
visible: enable,
|
1469
|
+
mark: {
|
1470
|
+
content: [
|
1471
|
+
{
|
1472
|
+
visible: true,
|
1473
|
+
key: (datum)=>datum && datum[measureName] || '',
|
1474
|
+
value: (datum)=>{
|
1475
|
+
if (!datum) return '';
|
1476
|
+
const value = datum[measureValue];
|
1477
|
+
const id = datum[measureId];
|
1478
|
+
const measure = findMeasureById(measures, id);
|
1479
|
+
if (!measure) return String(value);
|
1480
|
+
const { format = {}, autoFormat = true } = measure;
|
1481
|
+
if (format || autoFormat) {
|
1482
|
+
const formatter = createFormatter(format);
|
1483
|
+
return formatter(value);
|
1484
|
+
}
|
1485
|
+
return String(value);
|
1486
|
+
}
|
1487
|
+
}
|
1488
|
+
]
|
1489
|
+
},
|
1490
|
+
dimension: {
|
1491
|
+
content: [
|
1492
|
+
{
|
1493
|
+
visible: true,
|
1494
|
+
key: (datum)=>datum && datum[measureName] || '',
|
1495
|
+
value: (datum)=>{
|
1496
|
+
if (!datum) return '';
|
1497
|
+
const value = datum[measureValue];
|
1498
|
+
const id = datum[measureId];
|
1499
|
+
const measure = findMeasureById(measures, id);
|
1500
|
+
if (!measure) return String(value);
|
1501
|
+
const { format = {}, autoFormat = true } = measure;
|
1502
|
+
if (format || autoFormat) {
|
1503
|
+
const formatter = createFormatter(format);
|
1504
|
+
return formatter(value);
|
1505
|
+
}
|
1506
|
+
return String(value);
|
1507
|
+
}
|
1508
|
+
}
|
1509
|
+
]
|
1510
|
+
}
|
1368
1511
|
};
|
1369
1512
|
return result;
|
1370
1513
|
};
|
@@ -1373,12 +1516,24 @@ const label_label = (spec, context)=>{
|
|
1373
1516
|
...spec
|
1374
1517
|
};
|
1375
1518
|
const { advancedVSeed } = context;
|
1519
|
+
const { measures, datasetReshapeInfo } = advancedVSeed;
|
1376
1520
|
const baseConfig = advancedVSeed.baseConfig.vchart;
|
1377
1521
|
if (!baseConfig || !baseConfig.label) return result;
|
1522
|
+
const { measureId } = datasetReshapeInfo[0].foldInfo;
|
1378
1523
|
const { label } = baseConfig;
|
1379
1524
|
const { enable } = label;
|
1380
1525
|
result.label = {
|
1381
|
-
visible: enable
|
1526
|
+
visible: enable,
|
1527
|
+
formatMethod: (value, datum)=>{
|
1528
|
+
const id = datum[measureId];
|
1529
|
+
const measure = findMeasureById(measures, id);
|
1530
|
+
if (!measure) return value;
|
1531
|
+
const { format = {}, autoFormat = true } = measure;
|
1532
|
+
if (format || autoFormat) {
|
1533
|
+
const formatter = createFormatter(format);
|
1534
|
+
return formatter(value);
|
1535
|
+
}
|
1536
|
+
}
|
1382
1537
|
};
|
1383
1538
|
return result;
|
1384
1539
|
};
|
@@ -1681,6 +1836,7 @@ const pivotGridStyle = (spec)=>{
|
|
1681
1836
|
...spec
|
1682
1837
|
};
|
1683
1838
|
const transparent = 'rgba(0,0,0,0)';
|
1839
|
+
const hoverBackgroundColor = 'rgba(178,186,207, 0.2)';
|
1684
1840
|
return {
|
1685
1841
|
...result,
|
1686
1842
|
theme: {
|
@@ -1699,7 +1855,10 @@ const pivotGridStyle = (spec)=>{
|
|
1699
1855
|
0,
|
1700
1856
|
1,
|
1701
1857
|
0
|
1702
|
-
]
|
1858
|
+
],
|
1859
|
+
hover: {
|
1860
|
+
cellBgColor: 'transparent'
|
1861
|
+
}
|
1703
1862
|
},
|
1704
1863
|
headerStyle: {
|
1705
1864
|
borderColor: 'rgba(0,4,20,0.2)',
|
@@ -1709,7 +1868,7 @@ const pivotGridStyle = (spec)=>{
|
|
1709
1868
|
borderLineWidth: 0,
|
1710
1869
|
bgColor: transparent,
|
1711
1870
|
hover: {
|
1712
|
-
cellBgColor:
|
1871
|
+
cellBgColor: hoverBackgroundColor
|
1713
1872
|
}
|
1714
1873
|
},
|
1715
1874
|
rowHeaderStyle: {
|
@@ -1719,7 +1878,7 @@ const pivotGridStyle = (spec)=>{
|
|
1719
1878
|
borderLineWidth: 0,
|
1720
1879
|
bgColor: transparent,
|
1721
1880
|
hover: {
|
1722
|
-
cellBgColor:
|
1881
|
+
cellBgColor: hoverBackgroundColor
|
1723
1882
|
}
|
1724
1883
|
},
|
1725
1884
|
cornerHeaderStyle: {
|
@@ -1736,7 +1895,7 @@ const pivotGridStyle = (spec)=>{
|
|
1736
1895
|
],
|
1737
1896
|
bgColor: transparent,
|
1738
1897
|
hover: {
|
1739
|
-
cellBgColor:
|
1898
|
+
cellBgColor: hoverBackgroundColor
|
1740
1899
|
}
|
1741
1900
|
},
|
1742
1901
|
cornerRightTopCellStyle: {
|
@@ -1744,7 +1903,7 @@ const pivotGridStyle = (spec)=>{
|
|
1744
1903
|
borderLineWidth: 0,
|
1745
1904
|
bgColor: transparent,
|
1746
1905
|
hover: {
|
1747
|
-
cellBgColor:
|
1906
|
+
cellBgColor: hoverBackgroundColor
|
1748
1907
|
}
|
1749
1908
|
},
|
1750
1909
|
cornerLeftBottomCellStyle: {
|
@@ -1752,7 +1911,7 @@ const pivotGridStyle = (spec)=>{
|
|
1752
1911
|
borderLineWidth: 0,
|
1753
1912
|
bgColor: transparent,
|
1754
1913
|
hover: {
|
1755
|
-
cellBgColor:
|
1914
|
+
cellBgColor: hoverBackgroundColor
|
1756
1915
|
}
|
1757
1916
|
},
|
1758
1917
|
cornerRightBottomCellStyle: {
|
@@ -1760,7 +1919,7 @@ const pivotGridStyle = (spec)=>{
|
|
1760
1919
|
borderLineWidth: 0,
|
1761
1920
|
bgColor: transparent,
|
1762
1921
|
hover: {
|
1763
|
-
cellBgColor:
|
1922
|
+
cellBgColor: hoverBackgroundColor
|
1764
1923
|
}
|
1765
1924
|
},
|
1766
1925
|
rightFrozenStyle: {
|
@@ -1768,7 +1927,7 @@ const pivotGridStyle = (spec)=>{
|
|
1768
1927
|
borderLineWidth: 0,
|
1769
1928
|
bgColor: transparent,
|
1770
1929
|
hover: {
|
1771
|
-
cellBgColor:
|
1930
|
+
cellBgColor: hoverBackgroundColor
|
1772
1931
|
}
|
1773
1932
|
},
|
1774
1933
|
bottomFrozenStyle: {
|
@@ -1776,7 +1935,7 @@ const pivotGridStyle = (spec)=>{
|
|
1776
1935
|
borderLineWidth: 0,
|
1777
1936
|
bgColor: transparent,
|
1778
1937
|
hover: {
|
1779
|
-
cellBgColor:
|
1938
|
+
cellBgColor: hoverBackgroundColor
|
1780
1939
|
}
|
1781
1940
|
},
|
1782
1941
|
selectionStyle: {
|
@@ -1824,19 +1983,23 @@ const pivotRowDimensions = (spec, context)=>{
|
|
1824
1983
|
rows: rows
|
1825
1984
|
};
|
1826
1985
|
};
|
1827
|
-
const selector_selector = (
|
1986
|
+
const selector_selector = (vchartDatum, selector)=>{
|
1828
1987
|
if (!selector) return true;
|
1988
|
+
const vchartKeys = Object.keys(vchartDatum).filter((k)=>k.toLocaleLowerCase().startsWith('__vchart'));
|
1989
|
+
const datum = omit(vchartDatum, vchartKeys);
|
1829
1990
|
const selectors = Array.isArray(selector) ? selector : [
|
1830
1991
|
selector
|
1831
1992
|
];
|
1832
1993
|
for (const selector of selectors)if (isValueSelector(selector)) {
|
1833
1994
|
if (Object.values(datum).find((v)=>v === selector)) return true;
|
1834
1995
|
} else if (isMeasureSelector(selector)) {
|
1996
|
+
const op = selector.operator || selector.op;
|
1835
1997
|
const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
|
1836
1998
|
selector.value
|
1837
1999
|
];
|
1838
|
-
switch(
|
2000
|
+
switch(op){
|
1839
2001
|
case '=':
|
2002
|
+
case '==':
|
1840
2003
|
if (datum[selector.field] === selectorValueArr[0]) return true;
|
1841
2004
|
break;
|
1842
2005
|
case '!=':
|
@@ -1861,11 +2024,20 @@ const selector_selector = (datum, selector)=>{
|
|
1861
2024
|
break;
|
1862
2025
|
}
|
1863
2026
|
} else if (isDimensionSelector(selector)) {
|
2027
|
+
const op = selector.operator || selector.op;
|
1864
2028
|
const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
|
1865
2029
|
selector.value
|
1866
2030
|
];
|
1867
|
-
|
1868
|
-
|
2031
|
+
switch(op){
|
2032
|
+
case 'in':
|
2033
|
+
if (selectorValueArr.includes(datum[selector.field])) return true;
|
2034
|
+
break;
|
2035
|
+
case 'not in':
|
2036
|
+
if (!selectorValueArr.includes(datum[selector.field])) return true;
|
2037
|
+
break;
|
2038
|
+
default:
|
2039
|
+
break;
|
2040
|
+
}
|
1869
2041
|
} else if (isPartialDatumSelector(selector)) {
|
1870
2042
|
if (Object.keys(selector).every((key)=>datum[key] === selector[key])) return true;
|
1871
2043
|
}
|
@@ -1873,73 +2045,257 @@ const selector_selector = (datum, selector)=>{
|
|
1873
2045
|
};
|
1874
2046
|
const isValueSelector = (selector)=>'string' == typeof selector || 'number' == typeof selector;
|
1875
2047
|
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 && [
|
2048
|
+
const isMeasureSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && ('operator' in selector || 'op' in selector) && 'value' in selector && ([
|
1877
2049
|
'=',
|
2050
|
+
'==',
|
1878
2051
|
'!=',
|
1879
2052
|
'>',
|
1880
2053
|
'<',
|
1881
2054
|
'>=',
|
1882
2055
|
'<=',
|
1883
2056
|
'between'
|
1884
|
-
].includes(selector.operator)
|
1885
|
-
|
2057
|
+
].includes(selector.operator) || [
|
2058
|
+
'=',
|
2059
|
+
'==',
|
2060
|
+
'!=',
|
2061
|
+
'>',
|
2062
|
+
'<',
|
2063
|
+
'>=',
|
2064
|
+
'<=',
|
2065
|
+
'between'
|
2066
|
+
].includes(selector.op));
|
2067
|
+
const isDimensionSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && ('operator' in selector || 'op' in selector) && 'value' in selector && ([
|
2068
|
+
'in',
|
2069
|
+
'not in'
|
2070
|
+
].includes(selector.operator) || [
|
1886
2071
|
'in',
|
1887
2072
|
'not in'
|
1888
|
-
].includes(selector.
|
2073
|
+
].includes(selector.op));
|
1889
2074
|
const barStyle_barStyle = (spec, context)=>{
|
1890
2075
|
const { advancedVSeed } = context;
|
1891
2076
|
const { markStyle, encoding } = advancedVSeed;
|
1892
2077
|
const { barStyle } = markStyle;
|
1893
|
-
if (!barStyle) return spec;
|
1894
2078
|
const result = {
|
1895
|
-
...spec
|
2079
|
+
...spec,
|
2080
|
+
bar: {
|
2081
|
+
state: {
|
2082
|
+
hover: {
|
2083
|
+
stroke: (datum, context)=>{
|
2084
|
+
const field = encoding[0]?.group?.[0];
|
2085
|
+
const color = context.seriesColor(datum[field]);
|
2086
|
+
return color;
|
2087
|
+
},
|
2088
|
+
lineWidth: 4,
|
2089
|
+
fillOpacity: 0.6
|
2090
|
+
}
|
2091
|
+
}
|
2092
|
+
}
|
1896
2093
|
};
|
1897
|
-
|
2094
|
+
if (!barStyle) return result;
|
2095
|
+
const barStyles = Array.isArray(barStyle) ? barStyle : [
|
2096
|
+
barStyle
|
2097
|
+
];
|
2098
|
+
const customMap = barStyles.reduce((result, style, index)=>{
|
2099
|
+
const { barBorderColor, barBorderStyle, barBorderWidth, barColor, barColorOpacity, barRadius } = style;
|
2100
|
+
const lineDash = 'dashed' === barBorderStyle ? [
|
2101
|
+
5,
|
2102
|
+
2
|
2103
|
+
] : 'dotted' === barBorderStyle ? [
|
2104
|
+
2,
|
2105
|
+
5
|
2106
|
+
] : [
|
2107
|
+
0,
|
2108
|
+
0
|
2109
|
+
];
|
2110
|
+
return {
|
2111
|
+
...result,
|
2112
|
+
[`custom${index + 1}`]: {
|
2113
|
+
level: index + 1,
|
2114
|
+
filter: (datum)=>{
|
2115
|
+
if (selector_selector(datum, style.selector)) return true;
|
2116
|
+
return false;
|
2117
|
+
},
|
2118
|
+
style: {
|
2119
|
+
fill: barColor,
|
2120
|
+
fillOpacity: barColorOpacity,
|
2121
|
+
stroke: barBorderColor,
|
2122
|
+
lineWidth: barBorderWidth,
|
2123
|
+
lineDash: lineDash,
|
2124
|
+
cornerRadius: barRadius
|
2125
|
+
}
|
2126
|
+
}
|
2127
|
+
};
|
2128
|
+
}, {});
|
1898
2129
|
return {
|
1899
2130
|
...result,
|
1900
2131
|
bar: {
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
2132
|
+
state: {
|
2133
|
+
...customMap
|
2134
|
+
}
|
2135
|
+
}
|
2136
|
+
};
|
2137
|
+
};
|
2138
|
+
const pointStyle_pointStyle = (spec, context)=>{
|
2139
|
+
const { advancedVSeed } = context;
|
2140
|
+
const { markStyle } = advancedVSeed;
|
2141
|
+
const { pointStyle } = markStyle;
|
2142
|
+
const result = {
|
2143
|
+
...spec,
|
2144
|
+
point: {
|
2145
|
+
state: {
|
2146
|
+
dimension_hover: {
|
2147
|
+
scaleX: 1.4,
|
2148
|
+
scaleY: 1.4
|
2149
|
+
}
|
2150
|
+
}
|
2151
|
+
}
|
2152
|
+
};
|
2153
|
+
if (!pointStyle) return result;
|
2154
|
+
const pointStyles = Array.isArray(pointStyle) ? pointStyle : [
|
2155
|
+
pointStyle
|
2156
|
+
];
|
2157
|
+
const customMap = pointStyles.reduce((result, style, index)=>{
|
2158
|
+
const { pointBorderColor, pointBorderStyle, pointBorderWidth, pointColor, pointColorOpacity, pointSize } = style;
|
2159
|
+
const lineDash = 'dashed' === pointBorderStyle ? [
|
2160
|
+
5,
|
2161
|
+
2
|
2162
|
+
] : 'dotted' === pointBorderStyle ? [
|
2163
|
+
2,
|
2164
|
+
5
|
2165
|
+
] : [
|
2166
|
+
0,
|
2167
|
+
0
|
2168
|
+
];
|
2169
|
+
return {
|
2170
|
+
...result,
|
2171
|
+
[`custom${index + 1}`]: {
|
2172
|
+
level: index + 1,
|
2173
|
+
filter: (datum)=>{
|
2174
|
+
if (selector_selector(datum, style.selector)) return true;
|
2175
|
+
return false;
|
2176
|
+
},
|
2177
|
+
style: {
|
2178
|
+
size: pointSize,
|
2179
|
+
fill: pointColor,
|
2180
|
+
fillOpacity: pointColorOpacity,
|
2181
|
+
stroke: pointBorderColor,
|
2182
|
+
lineWidth: pointBorderWidth,
|
2183
|
+
lineDash: lineDash
|
2184
|
+
}
|
2185
|
+
}
|
2186
|
+
};
|
2187
|
+
}, {});
|
2188
|
+
return {
|
2189
|
+
...result,
|
2190
|
+
point: {
|
2191
|
+
state: {
|
2192
|
+
...customMap
|
2193
|
+
}
|
2194
|
+
}
|
2195
|
+
};
|
2196
|
+
};
|
2197
|
+
const lineStyle_lineStyle = (spec, context)=>{
|
2198
|
+
const { advancedVSeed } = context;
|
2199
|
+
const { markStyle, encoding, dataset } = advancedVSeed;
|
2200
|
+
const { lineStyle } = markStyle;
|
2201
|
+
if (!lineStyle) return spec;
|
2202
|
+
const result = {
|
2203
|
+
...spec
|
2204
|
+
};
|
2205
|
+
const lineStyles = Array.isArray(lineStyle) ? lineStyle : [
|
2206
|
+
lineStyle
|
2207
|
+
];
|
2208
|
+
const group = encoding[0]?.group?.[0];
|
2209
|
+
const lineGroups = groupBy(dataset, (d)=>d[group ?? '']);
|
2210
|
+
const customMap = lineStyles.reduce((result, style, index)=>{
|
2211
|
+
const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth } = style;
|
2212
|
+
const dashSegment = (lineWidth ?? 2) * 2;
|
2213
|
+
const dashGap = lineWidth ?? 2;
|
2214
|
+
const lineDash = 'dashed' === lineStyle ? [
|
2215
|
+
dashSegment,
|
2216
|
+
dashSegment
|
2217
|
+
] : 'dotted' === lineStyle ? [
|
2218
|
+
dashGap / 2,
|
2219
|
+
2 * dashGap
|
2220
|
+
] : [
|
2221
|
+
0,
|
2222
|
+
0
|
2223
|
+
];
|
2224
|
+
const curveType = lineSmooth ? 'monotone' : 'linear';
|
2225
|
+
return {
|
2226
|
+
...result,
|
2227
|
+
[`custom${index + 1}`]: {
|
2228
|
+
level: index + 1,
|
2229
|
+
filter: (datum)=>{
|
2230
|
+
const lineData = lineGroups[datum[group ?? '']];
|
2231
|
+
for (const d of lineData)if (selector_selector(d, style.selector)) return true;
|
2232
|
+
return false;
|
2233
|
+
},
|
2234
|
+
style: {
|
2235
|
+
curveType: curveType,
|
2236
|
+
fill: lineColor,
|
2237
|
+
fillOpacity: lineColorOpacity,
|
2238
|
+
stroke: lineColor,
|
2239
|
+
lineWidth: lineWidth,
|
2240
|
+
lineDash: lineDash
|
2241
|
+
}
|
2242
|
+
}
|
2243
|
+
};
|
2244
|
+
}, {});
|
2245
|
+
return {
|
2246
|
+
...result,
|
2247
|
+
line: {
|
2248
|
+
state: {
|
2249
|
+
...customMap
|
2250
|
+
}
|
2251
|
+
}
|
2252
|
+
};
|
2253
|
+
};
|
2254
|
+
const areaStyle_areaStyle = (spec, context)=>{
|
2255
|
+
const { advancedVSeed } = context;
|
2256
|
+
const { markStyle, encoding, dataset } = advancedVSeed;
|
2257
|
+
const { areaStyle } = markStyle;
|
2258
|
+
if (!areaStyle) return spec;
|
2259
|
+
const result = {
|
2260
|
+
...spec
|
2261
|
+
};
|
2262
|
+
const areaStyles = Array.isArray(areaStyle) ? areaStyle : [
|
2263
|
+
areaStyle
|
2264
|
+
];
|
2265
|
+
const group = encoding[0]?.group?.[0];
|
2266
|
+
const lineGroups = groupBy(dataset, (d)=>d[group ?? '']);
|
2267
|
+
const customMap = areaStyles.reduce((result, style, index)=>{
|
2268
|
+
const { areaColor, areaColorOpacity } = style;
|
2269
|
+
return {
|
2270
|
+
...result,
|
2271
|
+
[`custom${index + 1}`]: {
|
2272
|
+
level: index + 1,
|
2273
|
+
filter: (datum)=>{
|
2274
|
+
const lineData = lineGroups[datum[group ?? '']];
|
2275
|
+
for (const d of lineData)if (selector_selector(d, style.selector)) return true;
|
2276
|
+
return false;
|
2277
|
+
},
|
2278
|
+
style: {
|
2279
|
+
fill: areaColor,
|
2280
|
+
fillOpacity: areaColorOpacity
|
2281
|
+
}
|
2282
|
+
}
|
2283
|
+
};
|
2284
|
+
}, {});
|
2285
|
+
return {
|
2286
|
+
...result,
|
2287
|
+
area: {
|
2288
|
+
state: {
|
2289
|
+
...customMap
|
1939
2290
|
}
|
1940
2291
|
}
|
1941
2292
|
};
|
1942
2293
|
};
|
2294
|
+
const isSubset = (sub, obj)=>Object.entries(sub).every(([key, value])=>{
|
2295
|
+
if ('string' == typeof value) return obj[key] === value;
|
2296
|
+
if ('number' == typeof value) return obj[key] === value;
|
2297
|
+
return true;
|
2298
|
+
});
|
1943
2299
|
const annotationPoint_annotationPoint = (spec, context)=>{
|
1944
2300
|
const { advancedVSeed } = context;
|
1945
2301
|
const { annotation } = advancedVSeed;
|
@@ -1949,24 +2305,19 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
1949
2305
|
annotationPoint
|
1950
2306
|
];
|
1951
2307
|
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 =
|
2308
|
+
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'middle', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
|
1953
2309
|
const dataset = advancedVSeed.dataset.flat();
|
1954
2310
|
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
1955
2311
|
return selectedData.map((datum)=>({
|
2312
|
+
zIndex: ANNOTATION_Z_INDEX,
|
1956
2313
|
regionRelative: true,
|
1957
2314
|
position: (data, context)=>{
|
1958
2315
|
const targetDatum = data.find((item)=>isSubset(datum, item));
|
1959
2316
|
if (targetDatum) {
|
1960
2317
|
const { x, y } = context.dataToPosition(targetDatum);
|
1961
|
-
|
1962
|
-
const yBandWidth = context.scaleY?.bandwidth?.();
|
1963
|
-
if (xBandWidth) return {
|
1964
|
-
x: x,
|
1965
|
-
y: y
|
1966
|
-
};
|
1967
|
-
if (yBandWidth) return {
|
2318
|
+
return {
|
1968
2319
|
x,
|
1969
|
-
y
|
2320
|
+
y
|
1970
2321
|
};
|
1971
2322
|
}
|
1972
2323
|
},
|
@@ -2005,77 +2356,646 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
2005
2356
|
markPoint
|
2006
2357
|
};
|
2007
2358
|
};
|
2008
|
-
const
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2359
|
+
const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
2360
|
+
const { advancedVSeed } = context;
|
2361
|
+
const { annotation, encoding } = advancedVSeed;
|
2362
|
+
if (!annotation || !annotation.annotationVerticalLine) return spec;
|
2363
|
+
const { annotationVerticalLine } = annotation;
|
2364
|
+
const annotationVerticalLineList = Array.isArray(annotationVerticalLine) ? annotationVerticalLine : [
|
2365
|
+
annotationVerticalLine
|
2366
|
+
];
|
2367
|
+
const positionMap = {
|
2368
|
+
outsideStart: 'start',
|
2369
|
+
outsideEnd: 'end',
|
2370
|
+
outsideMiddle: 'middle',
|
2371
|
+
insideStart: 'insideStartTop',
|
2372
|
+
insideMiddle: 'insideMiddleTop',
|
2373
|
+
insideEnd: 'insideEndTop'
|
2374
|
+
};
|
2375
|
+
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2376
|
+
const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1 } = annotationVerticalLine;
|
2377
|
+
const dataset = advancedVSeed.dataset.flat();
|
2378
|
+
const generateOneMarkLine = (x)=>({
|
2379
|
+
x: x,
|
2380
|
+
zIndex: ANNOTATION_Z_INDEX,
|
2381
|
+
line: {
|
2382
|
+
visible: lineVisible,
|
2383
|
+
style: {
|
2384
|
+
offsetX,
|
2385
|
+
offsetY,
|
2386
|
+
stroke: lineColor,
|
2387
|
+
lineStyle: lineStyle,
|
2388
|
+
lineWidth: lineWidth,
|
2389
|
+
lineDash: 'dashed' === lineStyle ? [
|
2390
|
+
5,
|
2391
|
+
2
|
2392
|
+
] : 'dotted' === lineStyle ? [
|
2393
|
+
2,
|
2394
|
+
5
|
2395
|
+
] : [
|
2396
|
+
0
|
2397
|
+
]
|
2398
|
+
}
|
2399
|
+
},
|
2400
|
+
label: {
|
2401
|
+
text: text,
|
2402
|
+
position: positionMap[textPosition],
|
2403
|
+
style: {
|
2404
|
+
offsetX,
|
2405
|
+
offsetY,
|
2406
|
+
visible: true,
|
2407
|
+
textAlign: textAlign,
|
2408
|
+
textBaseline: textBaseline,
|
2409
|
+
fill: textColor,
|
2410
|
+
fontSize: textFontSize,
|
2411
|
+
fontWeight: textFontWeight
|
2412
|
+
},
|
2413
|
+
labelBackground: {
|
2414
|
+
visible: backgroundVisible,
|
2415
|
+
padding: backgroundPadding,
|
2416
|
+
style: {
|
2417
|
+
offsetX,
|
2418
|
+
offsetY,
|
2419
|
+
cornerRadius: backgroundBorderRadius ?? 4,
|
2420
|
+
fill: backgroundColor,
|
2421
|
+
stroke: backgroundBorderColor,
|
2422
|
+
strokeWidth: backgroundBorderWidth
|
2423
|
+
}
|
2424
|
+
}
|
2425
|
+
},
|
2426
|
+
endSymbol: {
|
2427
|
+
visible: true,
|
2428
|
+
style: {
|
2429
|
+
fill: lineColor
|
2430
|
+
}
|
2431
|
+
}
|
2432
|
+
});
|
2433
|
+
if (!selectorPoint && isArray(xValue) || isString(xValue) || isNumber(xValue)) {
|
2434
|
+
const xValueArr = Array.isArray(xValue) ? xValue : [
|
2435
|
+
xValue
|
2436
|
+
];
|
2437
|
+
return xValueArr.map(generateOneMarkLine);
|
2438
|
+
}
|
2439
|
+
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
2440
|
+
return selectedData.map((datum)=>{
|
2441
|
+
const x = encoding[0]?.x?.[0];
|
2442
|
+
if (!x) return {};
|
2443
|
+
return generateOneMarkLine(datum[x]);
|
2444
|
+
});
|
2012
2445
|
});
|
2013
|
-
const
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
const
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
]
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2077
|
-
|
2078
|
-
|
2446
|
+
const specMarkLine = spec.markLine || [];
|
2447
|
+
const newMarkLine = [
|
2448
|
+
...specMarkLine,
|
2449
|
+
...markLine || []
|
2450
|
+
];
|
2451
|
+
return {
|
2452
|
+
...spec,
|
2453
|
+
markLine: newMarkLine
|
2454
|
+
};
|
2455
|
+
};
|
2456
|
+
const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
|
2457
|
+
const { advancedVSeed } = context;
|
2458
|
+
const { annotation, encoding } = advancedVSeed;
|
2459
|
+
if (!annotation || !annotation.annotationHorizontalLine) return spec;
|
2460
|
+
const { annotationHorizontalLine } = annotation;
|
2461
|
+
const annotationVerticalLineList = Array.isArray(annotationHorizontalLine) ? annotationHorizontalLine : [
|
2462
|
+
annotationHorizontalLine
|
2463
|
+
];
|
2464
|
+
const positionMap = {
|
2465
|
+
outsideStart: 'start',
|
2466
|
+
outsideEnd: 'end',
|
2467
|
+
outsideMiddle: 'middle',
|
2468
|
+
insideStart: 'insideStartTop',
|
2469
|
+
insideMiddle: 'insideMiddleTop',
|
2470
|
+
insideEnd: 'insideEndTop'
|
2471
|
+
};
|
2472
|
+
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2473
|
+
const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'bottom', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1 } = annotationVerticalLine;
|
2474
|
+
const dataset = advancedVSeed.dataset.flat();
|
2475
|
+
const generateOneMarkLine = (y)=>({
|
2476
|
+
y,
|
2477
|
+
zIndex: ANNOTATION_Z_INDEX,
|
2478
|
+
line: {
|
2479
|
+
visible: lineVisible,
|
2480
|
+
style: {
|
2481
|
+
offsetX,
|
2482
|
+
offsetY,
|
2483
|
+
stroke: lineColor,
|
2484
|
+
lineStyle: lineStyle,
|
2485
|
+
lineWidth: lineWidth,
|
2486
|
+
lineDash: 'dashed' === lineStyle ? [
|
2487
|
+
5,
|
2488
|
+
2
|
2489
|
+
] : 'dotted' === lineStyle ? [
|
2490
|
+
2,
|
2491
|
+
5
|
2492
|
+
] : [
|
2493
|
+
0
|
2494
|
+
]
|
2495
|
+
}
|
2496
|
+
},
|
2497
|
+
label: {
|
2498
|
+
text: text,
|
2499
|
+
position: positionMap[textPosition],
|
2500
|
+
style: {
|
2501
|
+
offsetX,
|
2502
|
+
offsetY,
|
2503
|
+
visible: true,
|
2504
|
+
textAlign: textAlign,
|
2505
|
+
textBaseline: textBaseline,
|
2506
|
+
fill: textColor,
|
2507
|
+
fontSize: textFontSize,
|
2508
|
+
fontWeight: textFontWeight
|
2509
|
+
},
|
2510
|
+
labelBackground: {
|
2511
|
+
visible: backgroundVisible,
|
2512
|
+
padding: backgroundPadding,
|
2513
|
+
style: {
|
2514
|
+
offsetX,
|
2515
|
+
offsetY,
|
2516
|
+
cornerRadius: backgroundBorderRadius ?? 4,
|
2517
|
+
fill: backgroundColor,
|
2518
|
+
stroke: backgroundBorderColor,
|
2519
|
+
strokeWidth: backgroundBorderWidth
|
2520
|
+
}
|
2521
|
+
}
|
2522
|
+
},
|
2523
|
+
endSymbol: {
|
2524
|
+
visible: true,
|
2525
|
+
style: {
|
2526
|
+
fill: lineColor
|
2527
|
+
}
|
2528
|
+
}
|
2529
|
+
});
|
2530
|
+
if (!selectorPoint && isArray(yValue) || isString(yValue) || isNumber(yValue)) {
|
2531
|
+
const yValueArr = Array.isArray(yValue) ? yValue : [
|
2532
|
+
yValue
|
2533
|
+
];
|
2534
|
+
return yValueArr.map(generateOneMarkLine);
|
2535
|
+
}
|
2536
|
+
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
2537
|
+
return selectedData.map((datum)=>{
|
2538
|
+
const y = encoding[0]?.y?.[0];
|
2539
|
+
if (!y) return {};
|
2540
|
+
return generateOneMarkLine(datum[y]);
|
2541
|
+
});
|
2542
|
+
});
|
2543
|
+
const specMarkLine = spec.markLine || [];
|
2544
|
+
const newMarkLine = [
|
2545
|
+
...specMarkLine,
|
2546
|
+
...markLine || []
|
2547
|
+
];
|
2548
|
+
return {
|
2549
|
+
...spec,
|
2550
|
+
markLine: newMarkLine
|
2551
|
+
};
|
2552
|
+
};
|
2553
|
+
const annotationArea_annotationArea = (spec, context)=>{
|
2554
|
+
const { advancedVSeed } = context;
|
2555
|
+
const { annotation } = advancedVSeed;
|
2556
|
+
if (!annotation || !annotation.annotationArea) return spec;
|
2557
|
+
const { annotationArea } = annotation;
|
2558
|
+
const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [
|
2559
|
+
annotationArea
|
2560
|
+
];
|
2561
|
+
const positionMap = {
|
2562
|
+
top: 'insideTop',
|
2563
|
+
topRight: 'insideTopRight',
|
2564
|
+
topLeft: 'insideTopLeft',
|
2565
|
+
bottom: 'insideBottom',
|
2566
|
+
bottomLeft: 'insideBottomLeft',
|
2567
|
+
bottomRight: 'insideBottomRight',
|
2568
|
+
left: 'insideLeft',
|
2569
|
+
right: 'insideRight'
|
2570
|
+
};
|
2571
|
+
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
2572
|
+
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#191d24', backgroundPadding = 4, backgroundVisible = true, outerPadding = 0, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth } = annotationArea;
|
2573
|
+
const dataset = advancedVSeed.dataset.flat();
|
2574
|
+
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
2575
|
+
return {
|
2576
|
+
zIndex: ANNOTATION_Z_INDEX,
|
2577
|
+
regionRelative: true,
|
2578
|
+
positions: (data, context)=>{
|
2579
|
+
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
2580
|
+
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
2581
|
+
const yAxisHelper = context.getYAxisHelper();
|
2582
|
+
const xAxisHelper = context.getXAxisHelper();
|
2583
|
+
if ('function' == typeof xAxisHelper?.getBandwidth) {
|
2584
|
+
const yScale = yAxisHelper.getScale();
|
2585
|
+
const minX = Math.min(...xyList.map((item)=>item.x)) - outerPadding;
|
2586
|
+
const maxX = Math.max(...xyList.map((item)=>item.x)) + outerPadding;
|
2587
|
+
const minY = Math.min(...yScale.range());
|
2588
|
+
const maxY = Math.max(...yScale.range());
|
2589
|
+
return [
|
2590
|
+
{
|
2591
|
+
x: minX,
|
2592
|
+
y: minY
|
2593
|
+
},
|
2594
|
+
{
|
2595
|
+
x: maxX,
|
2596
|
+
y: minY
|
2597
|
+
},
|
2598
|
+
{
|
2599
|
+
x: maxX,
|
2600
|
+
y: maxY
|
2601
|
+
},
|
2602
|
+
{
|
2603
|
+
x: minX,
|
2604
|
+
y: maxY
|
2605
|
+
}
|
2606
|
+
];
|
2607
|
+
}
|
2608
|
+
if ('function' == typeof yAxisHelper?.getBandwidth) {
|
2609
|
+
const xScale = xAxisHelper.getScale();
|
2610
|
+
const minY = Math.min(...xyList.map((item)=>item.y)) - outerPadding;
|
2611
|
+
const maxY = Math.max(...xyList.map((item)=>item.y)) + outerPadding;
|
2612
|
+
const minX = Math.min(...xScale.range());
|
2613
|
+
const maxX = Math.max(...xScale.range());
|
2614
|
+
return [
|
2615
|
+
{
|
2616
|
+
x: minX,
|
2617
|
+
y: minY
|
2618
|
+
},
|
2619
|
+
{
|
2620
|
+
x: maxX,
|
2621
|
+
y: minY
|
2622
|
+
},
|
2623
|
+
{
|
2624
|
+
x: maxX,
|
2625
|
+
y: maxY
|
2626
|
+
},
|
2627
|
+
{
|
2628
|
+
x: minX,
|
2629
|
+
y: maxY
|
2630
|
+
}
|
2631
|
+
];
|
2632
|
+
}
|
2633
|
+
return [];
|
2634
|
+
},
|
2635
|
+
label: {
|
2636
|
+
position: positionMap[textPosition],
|
2637
|
+
visible: true,
|
2638
|
+
text: text,
|
2639
|
+
style: {
|
2640
|
+
textAlign: textAlign,
|
2641
|
+
textBaseline: textBaseline,
|
2642
|
+
fill: textColor,
|
2643
|
+
fontSize: textFontSize,
|
2644
|
+
fontWeight: textFontWeight
|
2645
|
+
},
|
2646
|
+
labelBackground: {
|
2647
|
+
visible: backgroundVisible,
|
2648
|
+
padding: backgroundPadding,
|
2649
|
+
style: {
|
2650
|
+
cornerRadius: backgroundBorderRadius ?? 4,
|
2651
|
+
fill: backgroundColor,
|
2652
|
+
stroke: backgroundBorderColor,
|
2653
|
+
strokeWidth: backgroundBorderWidth
|
2654
|
+
}
|
2655
|
+
}
|
2656
|
+
},
|
2657
|
+
area: {
|
2658
|
+
style: {
|
2659
|
+
visible: true,
|
2660
|
+
fill: areaColor,
|
2661
|
+
fillOpacity: areaColorOpacity,
|
2662
|
+
stroke: areaBorderColor,
|
2663
|
+
strokeWidth: areaBorderWidth,
|
2664
|
+
cornerRadius: areaBorderRadius
|
2665
|
+
}
|
2666
|
+
}
|
2667
|
+
};
|
2668
|
+
});
|
2669
|
+
return {
|
2670
|
+
...spec,
|
2671
|
+
markArea: markArea
|
2672
|
+
};
|
2673
|
+
};
|
2674
|
+
const annotationAreaBand = (spec, context)=>{
|
2675
|
+
const { advancedVSeed } = context;
|
2676
|
+
const { annotation } = advancedVSeed;
|
2677
|
+
if (!annotation || !annotation.annotationArea) return spec;
|
2678
|
+
const { annotationArea } = annotation;
|
2679
|
+
const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [
|
2680
|
+
annotationArea
|
2681
|
+
];
|
2682
|
+
const positionMap = {
|
2683
|
+
top: 'insideTop',
|
2684
|
+
topRight: 'insideTopRight',
|
2685
|
+
topLeft: 'insideTopLeft',
|
2686
|
+
bottom: 'insideBottom',
|
2687
|
+
bottomLeft: 'insideBottomLeft',
|
2688
|
+
bottomRight: 'insideBottomRight',
|
2689
|
+
left: 'insideLeft',
|
2690
|
+
right: 'insideRight'
|
2691
|
+
};
|
2692
|
+
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
2693
|
+
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#191d24', backgroundPadding = 4, backgroundVisible = true, outerPadding = 8, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth } = annotationArea;
|
2694
|
+
const dataset = advancedVSeed.dataset.flat();
|
2695
|
+
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
2696
|
+
return {
|
2697
|
+
zIndex: ANNOTATION_Z_INDEX,
|
2698
|
+
regionRelative: true,
|
2699
|
+
positions: (data, context)=>{
|
2700
|
+
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
2701
|
+
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
2702
|
+
const yAxisHelper = context.getYAxisHelper();
|
2703
|
+
const xAxisHelper = context.getXAxisHelper();
|
2704
|
+
if ('function' == typeof xAxisHelper?.getBandwidth) {
|
2705
|
+
const depth = context.fieldX.length ?? 0;
|
2706
|
+
const xBandWidth = xAxisHelper?.getBandwidth?.(depth - 1);
|
2707
|
+
const yScale = yAxisHelper.getScale();
|
2708
|
+
const minX = Math.min(...xyList.map((item)=>item.x)) - outerPadding;
|
2709
|
+
const maxX = Math.max(...xyList.map((item)=>item.x)) + xBandWidth + outerPadding;
|
2710
|
+
const minY = Math.min(...yScale.range());
|
2711
|
+
const maxY = Math.max(...yScale.range());
|
2712
|
+
return [
|
2713
|
+
{
|
2714
|
+
x: minX,
|
2715
|
+
y: minY
|
2716
|
+
},
|
2717
|
+
{
|
2718
|
+
x: maxX,
|
2719
|
+
y: minY
|
2720
|
+
},
|
2721
|
+
{
|
2722
|
+
x: maxX,
|
2723
|
+
y: maxY
|
2724
|
+
},
|
2725
|
+
{
|
2726
|
+
x: minX,
|
2727
|
+
y: maxY
|
2728
|
+
}
|
2729
|
+
];
|
2730
|
+
}
|
2731
|
+
if ('function' == typeof yAxisHelper?.getBandwidth) {
|
2732
|
+
const depth = context.fieldY.length ?? 0;
|
2733
|
+
const yBandWidth = yAxisHelper?.getBandwidth?.(depth - 1);
|
2734
|
+
const xScale = xAxisHelper.getScale();
|
2735
|
+
const minY = Math.min(...xyList.map((item)=>item.y)) - outerPadding;
|
2736
|
+
const maxY = Math.max(...xyList.map((item)=>item.y)) + yBandWidth + outerPadding;
|
2737
|
+
const minX = Math.min(...xScale.range());
|
2738
|
+
const maxX = Math.max(...xScale.range());
|
2739
|
+
return [
|
2740
|
+
{
|
2741
|
+
x: minX,
|
2742
|
+
y: minY
|
2743
|
+
},
|
2744
|
+
{
|
2745
|
+
x: maxX,
|
2746
|
+
y: minY
|
2747
|
+
},
|
2748
|
+
{
|
2749
|
+
x: maxX,
|
2750
|
+
y: maxY
|
2751
|
+
},
|
2752
|
+
{
|
2753
|
+
x: minX,
|
2754
|
+
y: maxY
|
2755
|
+
}
|
2756
|
+
];
|
2757
|
+
}
|
2758
|
+
return [];
|
2759
|
+
},
|
2760
|
+
label: {
|
2761
|
+
position: positionMap[textPosition],
|
2762
|
+
visible: true,
|
2763
|
+
text: text,
|
2764
|
+
style: {
|
2765
|
+
textAlign: textAlign,
|
2766
|
+
textBaseline: textBaseline,
|
2767
|
+
fill: textColor,
|
2768
|
+
fontSize: textFontSize,
|
2769
|
+
fontWeight: textFontWeight
|
2770
|
+
},
|
2771
|
+
labelBackground: {
|
2772
|
+
visible: backgroundVisible,
|
2773
|
+
padding: backgroundPadding,
|
2774
|
+
style: {
|
2775
|
+
cornerRadius: backgroundBorderRadius ?? 4,
|
2776
|
+
fill: backgroundColor,
|
2777
|
+
stroke: backgroundBorderColor,
|
2778
|
+
strokeWidth: backgroundBorderWidth
|
2779
|
+
}
|
2780
|
+
}
|
2781
|
+
},
|
2782
|
+
area: {
|
2783
|
+
style: {
|
2784
|
+
visible: true,
|
2785
|
+
fill: areaColor,
|
2786
|
+
fillOpacity: areaColorOpacity,
|
2787
|
+
stroke: areaBorderColor,
|
2788
|
+
strokeWidth: areaBorderWidth,
|
2789
|
+
cornerRadius: areaBorderRadius
|
2790
|
+
}
|
2791
|
+
}
|
2792
|
+
};
|
2793
|
+
});
|
2794
|
+
return {
|
2795
|
+
...spec,
|
2796
|
+
markArea: markArea
|
2797
|
+
};
|
2798
|
+
};
|
2799
|
+
const verticalCrosshairLine = (spec, context)=>{
|
2800
|
+
const result = {
|
2801
|
+
...spec
|
2802
|
+
};
|
2803
|
+
const { advancedVSeed, vseed } = context;
|
2804
|
+
const { chartType } = vseed;
|
2805
|
+
const config = advancedVSeed.config?.[chartType]?.crosshairLine;
|
2806
|
+
if (!config) return result;
|
2807
|
+
if (!result.crosshair) result.crosshair = {};
|
2808
|
+
const { visible = true, lineColor, labelColor, labelVisible, labelBackgroundColor } = config;
|
2809
|
+
const crosshair = result.crosshair;
|
2810
|
+
crosshair.xField = {
|
2811
|
+
visible,
|
2812
|
+
line: {
|
2813
|
+
type: 'line',
|
2814
|
+
style: {
|
2815
|
+
lineWidth: 1,
|
2816
|
+
opacity: 1,
|
2817
|
+
stroke: lineColor,
|
2818
|
+
lineDash: [
|
2819
|
+
4,
|
2820
|
+
2
|
2821
|
+
]
|
2822
|
+
}
|
2823
|
+
},
|
2824
|
+
label: {
|
2825
|
+
visible: labelVisible,
|
2826
|
+
labelBackground: {
|
2827
|
+
visible: labelVisible,
|
2828
|
+
style: {
|
2829
|
+
fill: labelBackgroundColor
|
2830
|
+
}
|
2831
|
+
},
|
2832
|
+
style: {
|
2833
|
+
fill: labelColor
|
2834
|
+
}
|
2835
|
+
}
|
2836
|
+
};
|
2837
|
+
return result;
|
2838
|
+
};
|
2839
|
+
const verticalCrosshairRect = (spec, context)=>{
|
2840
|
+
const result = {
|
2841
|
+
...spec
|
2842
|
+
};
|
2843
|
+
const { advancedVSeed, vseed } = context;
|
2844
|
+
const { chartType } = vseed;
|
2845
|
+
const config = advancedVSeed.config?.[chartType]?.crosshairRect;
|
2846
|
+
if (!config) return result;
|
2847
|
+
if (!result.crosshair) result.crosshair = {};
|
2848
|
+
const { visible = true, rectColor, labelColor, labelVisible, labelBackgroundColor } = config;
|
2849
|
+
const crosshair = result.crosshair;
|
2850
|
+
crosshair.xField = {
|
2851
|
+
visible,
|
2852
|
+
line: {
|
2853
|
+
type: 'rect',
|
2854
|
+
style: {
|
2855
|
+
lineWidth: 0,
|
2856
|
+
opacity: 0.2,
|
2857
|
+
fill: rectColor
|
2858
|
+
}
|
2859
|
+
},
|
2860
|
+
label: {
|
2861
|
+
visible: labelVisible,
|
2862
|
+
labelBackground: {
|
2863
|
+
visible: labelVisible,
|
2864
|
+
style: {
|
2865
|
+
fill: labelBackgroundColor
|
2866
|
+
}
|
2867
|
+
},
|
2868
|
+
style: {
|
2869
|
+
fill: labelColor
|
2870
|
+
}
|
2871
|
+
}
|
2872
|
+
};
|
2873
|
+
return result;
|
2874
|
+
};
|
2875
|
+
const horizontalCrosshairRect = (spec, context)=>{
|
2876
|
+
const result = {
|
2877
|
+
...spec
|
2878
|
+
};
|
2879
|
+
const { advancedVSeed, vseed } = context;
|
2880
|
+
const { chartType } = vseed;
|
2881
|
+
const config = advancedVSeed.config?.[chartType]?.crosshairRect;
|
2882
|
+
if (!config) return result;
|
2883
|
+
if (!result.crosshair) result.crosshair = {};
|
2884
|
+
const { visible = true, rectColor, labelColor, labelVisible, labelBackgroundColor } = config;
|
2885
|
+
const crosshair = result.crosshair;
|
2886
|
+
crosshair.yField = {
|
2887
|
+
visible,
|
2888
|
+
line: {
|
2889
|
+
type: 'rect',
|
2890
|
+
style: {
|
2891
|
+
lineWidth: 0,
|
2892
|
+
opacity: 0.2,
|
2893
|
+
fill: rectColor
|
2894
|
+
}
|
2895
|
+
},
|
2896
|
+
label: {
|
2897
|
+
visible: labelVisible,
|
2898
|
+
labelBackground: {
|
2899
|
+
visible: labelVisible,
|
2900
|
+
style: {
|
2901
|
+
fill: labelBackgroundColor
|
2902
|
+
}
|
2903
|
+
},
|
2904
|
+
style: {
|
2905
|
+
fill: labelColor
|
2906
|
+
}
|
2907
|
+
}
|
2908
|
+
};
|
2909
|
+
return result;
|
2910
|
+
};
|
2911
|
+
const line_line = [
|
2912
|
+
initLine,
|
2913
|
+
color_color,
|
2914
|
+
background_backgroundColor,
|
2915
|
+
dataset_dataset,
|
2916
|
+
xBand,
|
2917
|
+
yLinear,
|
2918
|
+
label_label,
|
2919
|
+
tooltip_tooltip,
|
2920
|
+
verticalCrosshairLine,
|
2921
|
+
discreteLegend,
|
2922
|
+
pointStyle_pointStyle,
|
2923
|
+
lineStyle_lineStyle,
|
2924
|
+
annotationPoint_annotationPoint,
|
2925
|
+
annotationVerticalLine_annotationVerticalLine,
|
2926
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2927
|
+
annotationArea_annotationArea
|
2928
|
+
];
|
2929
|
+
const pivotLine = [
|
2930
|
+
initPivot,
|
2931
|
+
pivotGridStyle,
|
2932
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
2933
|
+
datasetPivot,
|
2934
|
+
pivotIndicators([
|
2935
|
+
initLine,
|
2936
|
+
color_color,
|
2937
|
+
background_backgroundColor,
|
2938
|
+
datasetPivotPlaceholder,
|
2939
|
+
xBand,
|
2940
|
+
yLinear,
|
2941
|
+
label_label,
|
2942
|
+
tooltip_tooltip,
|
2943
|
+
verticalCrosshairLine,
|
2944
|
+
pointStyle_pointStyle,
|
2945
|
+
lineStyle_lineStyle,
|
2946
|
+
annotationPoint_annotationPoint,
|
2947
|
+
annotationVerticalLine_annotationVerticalLine,
|
2948
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2949
|
+
annotationArea_annotationArea
|
2950
|
+
]),
|
2951
|
+
pivotRowDimensions,
|
2952
|
+
pivotColumnDimensions,
|
2953
|
+
pivotDiscreteLegend
|
2954
|
+
];
|
2955
|
+
const lineSpecPipeline = [
|
2956
|
+
pivotAdapter_pivotAdapter(line_line, pivotLine)
|
2957
|
+
];
|
2958
|
+
const column = [
|
2959
|
+
initColumn,
|
2960
|
+
stackCornerRadius_stackCornerRadius,
|
2961
|
+
stackInverse,
|
2962
|
+
color_color,
|
2963
|
+
background_backgroundColor,
|
2964
|
+
dataset_dataset,
|
2965
|
+
xBand,
|
2966
|
+
yLinear,
|
2967
|
+
label_label,
|
2968
|
+
tooltip_tooltip,
|
2969
|
+
verticalCrosshairRect,
|
2970
|
+
discreteLegend,
|
2971
|
+
barStyle_barStyle,
|
2972
|
+
annotationPoint_annotationPoint,
|
2973
|
+
annotationVerticalLine_annotationVerticalLine,
|
2974
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2975
|
+
annotationAreaBand
|
2976
|
+
];
|
2977
|
+
const pivotColumn = [
|
2978
|
+
initPivot,
|
2979
|
+
pivotGridStyle,
|
2980
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
2981
|
+
datasetPivot,
|
2982
|
+
pivotIndicators([
|
2983
|
+
initColumn,
|
2984
|
+
stackCornerRadius_stackCornerRadius,
|
2985
|
+
stackInverse,
|
2986
|
+
color_color,
|
2987
|
+
background_backgroundColor,
|
2988
|
+
datasetPivotPlaceholder,
|
2989
|
+
xBand,
|
2990
|
+
yLinear,
|
2991
|
+
label_label,
|
2992
|
+
tooltip_tooltip,
|
2993
|
+
verticalCrosshairRect,
|
2994
|
+
barStyle_barStyle,
|
2995
|
+
annotationPoint_annotationPoint,
|
2996
|
+
annotationVerticalLine_annotationVerticalLine,
|
2997
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2998
|
+
annotationAreaBand
|
2079
2999
|
]),
|
2080
3000
|
pivotRowDimensions,
|
2081
3001
|
pivotColumnDimensions,
|
@@ -2086,6 +3006,7 @@ const columnSpecPipeline = [
|
|
2086
3006
|
];
|
2087
3007
|
const columnParallel = [
|
2088
3008
|
initColumnParallel,
|
3009
|
+
stackCornerRadius_stackCornerRadius,
|
2089
3010
|
color_color,
|
2090
3011
|
background_backgroundColor,
|
2091
3012
|
dataset_dataset,
|
@@ -2094,8 +3015,12 @@ const columnParallel = [
|
|
2094
3015
|
label_label,
|
2095
3016
|
tooltip_tooltip,
|
2096
3017
|
discreteLegend,
|
3018
|
+
verticalCrosshairRect,
|
2097
3019
|
barStyle_barStyle,
|
2098
|
-
annotationPoint_annotationPoint
|
3020
|
+
annotationPoint_annotationPoint,
|
3021
|
+
annotationVerticalLine_annotationVerticalLine,
|
3022
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3023
|
+
annotationAreaBand
|
2099
3024
|
];
|
2100
3025
|
const pivotColumnParallel = [
|
2101
3026
|
initPivot,
|
@@ -2104,6 +3029,7 @@ const pivotColumnParallel = [
|
|
2104
3029
|
datasetPivot,
|
2105
3030
|
pivotIndicators([
|
2106
3031
|
initColumnParallel,
|
3032
|
+
stackCornerRadius_stackCornerRadius,
|
2107
3033
|
color_color,
|
2108
3034
|
background_backgroundColor,
|
2109
3035
|
datasetPivotPlaceholder,
|
@@ -2111,8 +3037,12 @@ const pivotColumnParallel = [
|
|
2111
3037
|
yLinear,
|
2112
3038
|
label_label,
|
2113
3039
|
tooltip_tooltip,
|
3040
|
+
verticalCrosshairRect,
|
2114
3041
|
barStyle_barStyle,
|
2115
|
-
annotationPoint_annotationPoint
|
3042
|
+
annotationPoint_annotationPoint,
|
3043
|
+
annotationVerticalLine_annotationVerticalLine,
|
3044
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3045
|
+
annotationAreaBand
|
2116
3046
|
]),
|
2117
3047
|
pivotRowDimensions,
|
2118
3048
|
pivotColumnDimensions,
|
@@ -2123,6 +3053,7 @@ const columnParallelSpecPipeline = [
|
|
2123
3053
|
];
|
2124
3054
|
const columnPercent = [
|
2125
3055
|
initColumn,
|
3056
|
+
stackCornerRadius_stackCornerRadius,
|
2126
3057
|
stackInverse,
|
2127
3058
|
color_color,
|
2128
3059
|
background_backgroundColor,
|
@@ -2132,9 +3063,13 @@ const columnPercent = [
|
|
2132
3063
|
yLinear,
|
2133
3064
|
label_label,
|
2134
3065
|
tooltip_tooltip,
|
3066
|
+
verticalCrosshairRect,
|
2135
3067
|
discreteLegend,
|
2136
3068
|
barStyle_barStyle,
|
2137
|
-
annotationPoint_annotationPoint
|
3069
|
+
annotationPoint_annotationPoint,
|
3070
|
+
annotationVerticalLine_annotationVerticalLine,
|
3071
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3072
|
+
annotationAreaBand
|
2138
3073
|
];
|
2139
3074
|
const pivotColumnPercent = [
|
2140
3075
|
initPivot,
|
@@ -2143,6 +3078,7 @@ const pivotColumnPercent = [
|
|
2143
3078
|
datasetPivot,
|
2144
3079
|
pivotIndicators([
|
2145
3080
|
initColumn,
|
3081
|
+
stackCornerRadius_stackCornerRadius,
|
2146
3082
|
stackInverse,
|
2147
3083
|
color_color,
|
2148
3084
|
percent,
|
@@ -2152,8 +3088,12 @@ const pivotColumnPercent = [
|
|
2152
3088
|
yLinear,
|
2153
3089
|
label_label,
|
2154
3090
|
tooltip_tooltip,
|
3091
|
+
verticalCrosshairRect,
|
2155
3092
|
barStyle_barStyle,
|
2156
|
-
annotationPoint_annotationPoint
|
3093
|
+
annotationPoint_annotationPoint,
|
3094
|
+
annotationVerticalLine_annotationVerticalLine,
|
3095
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3096
|
+
annotationAreaBand
|
2157
3097
|
]),
|
2158
3098
|
pivotRowDimensions,
|
2159
3099
|
pivotColumnDimensions,
|
@@ -2164,6 +3104,7 @@ const columnPercentSpecPipeline = [
|
|
2164
3104
|
];
|
2165
3105
|
const bar = [
|
2166
3106
|
initBar,
|
3107
|
+
stackCornerRadius_stackCornerRadius,
|
2167
3108
|
color_color,
|
2168
3109
|
background_backgroundColor,
|
2169
3110
|
dataset_dataset,
|
@@ -2171,9 +3112,13 @@ const bar = [
|
|
2171
3112
|
yBand,
|
2172
3113
|
label_label,
|
2173
3114
|
tooltip_tooltip,
|
3115
|
+
horizontalCrosshairRect,
|
2174
3116
|
discreteLegend,
|
2175
3117
|
barStyle_barStyle,
|
2176
|
-
annotationPoint_annotationPoint
|
3118
|
+
annotationPoint_annotationPoint,
|
3119
|
+
annotationVerticalLine_annotationVerticalLine,
|
3120
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3121
|
+
annotationAreaBand
|
2177
3122
|
];
|
2178
3123
|
const pivotBar = [
|
2179
3124
|
initPivot,
|
@@ -2182,6 +3127,7 @@ const pivotBar = [
|
|
2182
3127
|
datasetPivot,
|
2183
3128
|
pivotIndicators([
|
2184
3129
|
initBar,
|
3130
|
+
stackCornerRadius_stackCornerRadius,
|
2185
3131
|
color_color,
|
2186
3132
|
background_backgroundColor,
|
2187
3133
|
datasetPivotPlaceholder,
|
@@ -2189,8 +3135,12 @@ const pivotBar = [
|
|
2189
3135
|
label_label,
|
2190
3136
|
label_label,
|
2191
3137
|
tooltip_tooltip,
|
3138
|
+
horizontalCrosshairRect,
|
2192
3139
|
barStyle_barStyle,
|
2193
|
-
annotationPoint_annotationPoint
|
3140
|
+
annotationPoint_annotationPoint,
|
3141
|
+
annotationVerticalLine_annotationVerticalLine,
|
3142
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3143
|
+
annotationAreaBand
|
2194
3144
|
]),
|
2195
3145
|
pivotRowDimensions,
|
2196
3146
|
pivotColumnDimensions,
|
@@ -2201,6 +3151,7 @@ const barSpecPipeline = [
|
|
2201
3151
|
];
|
2202
3152
|
const barParallel = [
|
2203
3153
|
initBarParallel,
|
3154
|
+
stackCornerRadius_stackCornerRadius,
|
2204
3155
|
color_color,
|
2205
3156
|
background_backgroundColor,
|
2206
3157
|
dataset_dataset,
|
@@ -2208,9 +3159,13 @@ const barParallel = [
|
|
2208
3159
|
yBand,
|
2209
3160
|
label_label,
|
2210
3161
|
tooltip_tooltip,
|
3162
|
+
horizontalCrosshairRect,
|
2211
3163
|
discreteLegend,
|
2212
3164
|
barStyle_barStyle,
|
2213
|
-
annotationPoint_annotationPoint
|
3165
|
+
annotationPoint_annotationPoint,
|
3166
|
+
annotationVerticalLine_annotationVerticalLine,
|
3167
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3168
|
+
annotationAreaBand
|
2214
3169
|
];
|
2215
3170
|
const pivotBarParallel = [
|
2216
3171
|
initPivot,
|
@@ -2219,6 +3174,7 @@ const pivotBarParallel = [
|
|
2219
3174
|
datasetPivot,
|
2220
3175
|
pivotIndicators([
|
2221
3176
|
initBarParallel,
|
3177
|
+
stackCornerRadius_stackCornerRadius,
|
2222
3178
|
color_color,
|
2223
3179
|
background_backgroundColor,
|
2224
3180
|
datasetPivotPlaceholder,
|
@@ -2226,8 +3182,12 @@ const pivotBarParallel = [
|
|
2226
3182
|
xLinear,
|
2227
3183
|
label_label,
|
2228
3184
|
tooltip_tooltip,
|
3185
|
+
horizontalCrosshairRect,
|
2229
3186
|
barStyle_barStyle,
|
2230
|
-
annotationPoint_annotationPoint
|
3187
|
+
annotationPoint_annotationPoint,
|
3188
|
+
annotationVerticalLine_annotationVerticalLine,
|
3189
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3190
|
+
annotationAreaBand
|
2231
3191
|
]),
|
2232
3192
|
pivotRowDimensions,
|
2233
3193
|
pivotColumnDimensions,
|
@@ -2238,6 +3198,7 @@ const barParallelSpecPipeline = [
|
|
2238
3198
|
];
|
2239
3199
|
const barPercent = [
|
2240
3200
|
initBar,
|
3201
|
+
stackCornerRadius_stackCornerRadius,
|
2241
3202
|
color_color,
|
2242
3203
|
background_backgroundColor,
|
2243
3204
|
percent,
|
@@ -2246,9 +3207,13 @@ const barPercent = [
|
|
2246
3207
|
yBand,
|
2247
3208
|
label_label,
|
2248
3209
|
tooltip_tooltip,
|
3210
|
+
horizontalCrosshairRect,
|
2249
3211
|
discreteLegend,
|
2250
3212
|
barStyle_barStyle,
|
2251
|
-
annotationPoint_annotationPoint
|
3213
|
+
annotationPoint_annotationPoint,
|
3214
|
+
annotationVerticalLine_annotationVerticalLine,
|
3215
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3216
|
+
annotationAreaBand
|
2252
3217
|
];
|
2253
3218
|
const pivotBarPercent = [
|
2254
3219
|
initPivot,
|
@@ -2257,6 +3222,7 @@ const pivotBarPercent = [
|
|
2257
3222
|
datasetPivot,
|
2258
3223
|
pivotIndicators([
|
2259
3224
|
initBar,
|
3225
|
+
stackCornerRadius_stackCornerRadius,
|
2260
3226
|
color_color,
|
2261
3227
|
background_backgroundColor,
|
2262
3228
|
percent,
|
@@ -2265,8 +3231,12 @@ const pivotBarPercent = [
|
|
2265
3231
|
xLinear,
|
2266
3232
|
label_label,
|
2267
3233
|
tooltip_tooltip,
|
3234
|
+
horizontalCrosshairRect,
|
2268
3235
|
barStyle_barStyle,
|
2269
|
-
annotationPoint_annotationPoint
|
3236
|
+
annotationPoint_annotationPoint,
|
3237
|
+
annotationVerticalLine_annotationVerticalLine,
|
3238
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3239
|
+
annotationAreaBand
|
2270
3240
|
]),
|
2271
3241
|
pivotRowDimensions,
|
2272
3242
|
pivotColumnDimensions,
|
@@ -2285,8 +3255,15 @@ const area_area = [
|
|
2285
3255
|
yLinear,
|
2286
3256
|
label_label,
|
2287
3257
|
tooltip_tooltip,
|
3258
|
+
verticalCrosshairLine,
|
2288
3259
|
discreteLegend,
|
2289
|
-
|
3260
|
+
pointStyle_pointStyle,
|
3261
|
+
lineStyle_lineStyle,
|
3262
|
+
areaStyle_areaStyle,
|
3263
|
+
annotationPoint_annotationPoint,
|
3264
|
+
annotationVerticalLine_annotationVerticalLine,
|
3265
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3266
|
+
annotationArea_annotationArea
|
2290
3267
|
];
|
2291
3268
|
const pivotArea = [
|
2292
3269
|
initPivot,
|
@@ -2303,7 +3280,14 @@ const pivotArea = [
|
|
2303
3280
|
yLinear,
|
2304
3281
|
label_label,
|
2305
3282
|
tooltip_tooltip,
|
2306
|
-
|
3283
|
+
verticalCrosshairLine,
|
3284
|
+
pointStyle_pointStyle,
|
3285
|
+
lineStyle_lineStyle,
|
3286
|
+
areaStyle_areaStyle,
|
3287
|
+
annotationPoint_annotationPoint,
|
3288
|
+
annotationVerticalLine_annotationVerticalLine,
|
3289
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3290
|
+
annotationArea_annotationArea
|
2307
3291
|
]),
|
2308
3292
|
pivotRowDimensions,
|
2309
3293
|
pivotColumnDimensions,
|
@@ -2323,8 +3307,15 @@ const areaPercent = [
|
|
2323
3307
|
yLinear,
|
2324
3308
|
label_label,
|
2325
3309
|
tooltip_tooltip,
|
3310
|
+
verticalCrosshairLine,
|
2326
3311
|
discreteLegend,
|
2327
|
-
|
3312
|
+
pointStyle_pointStyle,
|
3313
|
+
lineStyle_lineStyle,
|
3314
|
+
areaStyle_areaStyle,
|
3315
|
+
annotationPoint_annotationPoint,
|
3316
|
+
annotationVerticalLine_annotationVerticalLine,
|
3317
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3318
|
+
annotationArea_annotationArea
|
2328
3319
|
];
|
2329
3320
|
const pivotAreaPercent = [
|
2330
3321
|
initPivot,
|
@@ -2342,7 +3333,14 @@ const pivotAreaPercent = [
|
|
2342
3333
|
yLinear,
|
2343
3334
|
label_label,
|
2344
3335
|
tooltip_tooltip,
|
2345
|
-
|
3336
|
+
verticalCrosshairLine,
|
3337
|
+
pointStyle_pointStyle,
|
3338
|
+
lineStyle_lineStyle,
|
3339
|
+
areaStyle_areaStyle,
|
3340
|
+
annotationPoint_annotationPoint,
|
3341
|
+
annotationVerticalLine_annotationVerticalLine,
|
3342
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3343
|
+
annotationArea_annotationArea
|
2346
3344
|
]),
|
2347
3345
|
pivotRowDimensions,
|
2348
3346
|
pivotColumnDimensions,
|
@@ -2359,7 +3357,10 @@ const pie = [
|
|
2359
3357
|
label_label,
|
2360
3358
|
tooltip_tooltip,
|
2361
3359
|
discreteLegend,
|
2362
|
-
annotationPoint_annotationPoint
|
3360
|
+
annotationPoint_annotationPoint,
|
3361
|
+
annotationVerticalLine_annotationVerticalLine,
|
3362
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3363
|
+
annotationArea_annotationArea
|
2363
3364
|
];
|
2364
3365
|
const pivotPie = [
|
2365
3366
|
initPivot,
|
@@ -2373,7 +3374,10 @@ const pivotPie = [
|
|
2373
3374
|
datasetPivotPlaceholder,
|
2374
3375
|
label_label,
|
2375
3376
|
tooltip_tooltip,
|
2376
|
-
annotationPoint_annotationPoint
|
3377
|
+
annotationPoint_annotationPoint,
|
3378
|
+
annotationVerticalLine_annotationVerticalLine,
|
3379
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3380
|
+
annotationArea_annotationArea
|
2377
3381
|
]),
|
2378
3382
|
pivotRowDimensions,
|
2379
3383
|
pivotColumnDimensions,
|
@@ -2415,17 +3419,17 @@ const buildSpec = (builder, advancedVSeed)=>{
|
|
2415
3419
|
}
|
2416
3420
|
};
|
2417
3421
|
const build = (builder)=>{
|
2418
|
-
console.log('debug vseed', builder.vseed);
|
2419
3422
|
const advancedVSeed = builder.buildAdvanced();
|
2420
|
-
|
3423
|
+
builder.advancedVSeed = advancedVSeed;
|
2421
3424
|
if (!advancedVSeed) throw new Error('advancedVSeed is null');
|
2422
3425
|
const spec = builder.buildSpec(advancedVSeed);
|
2423
|
-
|
3426
|
+
builder.spec = spec;
|
2424
3427
|
return spec;
|
2425
3428
|
};
|
2426
3429
|
class Builder {
|
2427
3430
|
_vseed;
|
2428
3431
|
_advancedVSeed = null;
|
3432
|
+
_spec = null;
|
2429
3433
|
constructor(vseed){
|
2430
3434
|
this._vseed = vseed;
|
2431
3435
|
}
|
@@ -2448,6 +3452,12 @@ class Builder {
|
|
2448
3452
|
set advancedVSeed(value) {
|
2449
3453
|
this._advancedVSeed = value;
|
2450
3454
|
}
|
3455
|
+
get spec() {
|
3456
|
+
return this._spec;
|
3457
|
+
}
|
3458
|
+
set spec(value) {
|
3459
|
+
this._spec = value;
|
3460
|
+
}
|
2451
3461
|
static _advancedPipelineMap = {};
|
2452
3462
|
static _specPipelineMap = {};
|
2453
3463
|
static _themeMap = {};
|
@@ -2533,7 +3543,7 @@ const darkTheme = ()=>{
|
|
2533
3543
|
labelAutoHideGap: 4,
|
2534
3544
|
labelAutoLimit: true,
|
2535
3545
|
labelAutoLimitLength: 100,
|
2536
|
-
labelAutoRotate:
|
3546
|
+
labelAutoRotate: false,
|
2537
3547
|
labelAutoRotateAngleRange: [
|
2538
3548
|
0,
|
2539
3549
|
-45,
|
@@ -2570,6 +3580,33 @@ const darkTheme = ()=>{
|
|
2570
3580
|
lineWidth: 1
|
2571
3581
|
}
|
2572
3582
|
};
|
3583
|
+
const barBandAxis = {
|
3584
|
+
...bandAxis,
|
3585
|
+
labelAutoHide: false,
|
3586
|
+
labelAutoHideGap: 1,
|
3587
|
+
labelAutoLimit: false,
|
3588
|
+
labelAutoLimitLength: void 0,
|
3589
|
+
labelAutoRotate: false,
|
3590
|
+
labelAutoRotateAngleRange: [
|
3591
|
+
0,
|
3592
|
+
-45,
|
3593
|
+
-90
|
3594
|
+
]
|
3595
|
+
};
|
3596
|
+
const crosshairLine = {
|
3597
|
+
visible: true,
|
3598
|
+
labelVisible: true,
|
3599
|
+
lineColor: '#E2E3E6',
|
3600
|
+
labelColor: '#4B4F54',
|
3601
|
+
labelBackgroundColor: '#ffffff'
|
3602
|
+
};
|
3603
|
+
const crosshairRect = {
|
3604
|
+
visible: true,
|
3605
|
+
labelVisible: true,
|
3606
|
+
lineColor: '#E2E3E6',
|
3607
|
+
labelColor: '#4B4F54',
|
3608
|
+
labelBackgroundColor: '#ffffff'
|
3609
|
+
};
|
2573
3610
|
return {
|
2574
3611
|
baseConfig: {
|
2575
3612
|
vtable: {
|
@@ -2612,39 +3649,84 @@ const darkTheme = ()=>{
|
|
2612
3649
|
config: {
|
2613
3650
|
line: {
|
2614
3651
|
xAxis: bandAxis,
|
2615
|
-
yAxis: linearAxis
|
3652
|
+
yAxis: linearAxis,
|
3653
|
+
crosshairLine: crosshairLine
|
2616
3654
|
},
|
2617
3655
|
column: {
|
2618
3656
|
xAxis: bandAxis,
|
2619
|
-
yAxis: linearAxis
|
3657
|
+
yAxis: linearAxis,
|
3658
|
+
crosshairRect: crosshairRect,
|
3659
|
+
stackCornerRadius: [
|
3660
|
+
4,
|
3661
|
+
4,
|
3662
|
+
0,
|
3663
|
+
0
|
3664
|
+
]
|
2620
3665
|
},
|
2621
3666
|
columnParallel: {
|
2622
3667
|
xAxis: bandAxis,
|
2623
|
-
yAxis: linearAxis
|
3668
|
+
yAxis: linearAxis,
|
3669
|
+
crosshairRect: crosshairRect,
|
3670
|
+
stackCornerRadius: [
|
3671
|
+
4,
|
3672
|
+
4,
|
3673
|
+
0,
|
3674
|
+
0
|
3675
|
+
]
|
2624
3676
|
},
|
2625
3677
|
columnPercent: {
|
2626
3678
|
xAxis: bandAxis,
|
2627
|
-
yAxis: linearAxis
|
3679
|
+
yAxis: linearAxis,
|
3680
|
+
crosshairRect: crosshairRect,
|
3681
|
+
stackCornerRadius: [
|
3682
|
+
4,
|
3683
|
+
4,
|
3684
|
+
0,
|
3685
|
+
0
|
3686
|
+
]
|
2628
3687
|
},
|
2629
3688
|
bar: {
|
2630
3689
|
xAxis: linearAxis,
|
2631
|
-
yAxis:
|
3690
|
+
yAxis: barBandAxis,
|
3691
|
+
crosshairRect: crosshairRect,
|
3692
|
+
stackCornerRadius: [
|
3693
|
+
0,
|
3694
|
+
4,
|
3695
|
+
4,
|
3696
|
+
0
|
3697
|
+
]
|
2632
3698
|
},
|
2633
3699
|
barParallel: {
|
2634
3700
|
xAxis: linearAxis,
|
2635
|
-
yAxis:
|
3701
|
+
yAxis: barBandAxis,
|
3702
|
+
crosshairRect: crosshairRect,
|
3703
|
+
stackCornerRadius: [
|
3704
|
+
0,
|
3705
|
+
4,
|
3706
|
+
4,
|
3707
|
+
0
|
3708
|
+
]
|
2636
3709
|
},
|
2637
3710
|
barPercent: {
|
2638
3711
|
xAxis: linearAxis,
|
2639
|
-
yAxis:
|
3712
|
+
yAxis: barBandAxis,
|
3713
|
+
crosshairRect: crosshairRect,
|
3714
|
+
stackCornerRadius: [
|
3715
|
+
0,
|
3716
|
+
4,
|
3717
|
+
4,
|
3718
|
+
0
|
3719
|
+
]
|
2640
3720
|
},
|
2641
3721
|
area: {
|
2642
3722
|
xAxis: bandAxis,
|
2643
|
-
yAxis: linearAxis
|
3723
|
+
yAxis: linearAxis,
|
3724
|
+
crosshairLine: crosshairLine
|
2644
3725
|
},
|
2645
3726
|
areaPercent: {
|
2646
3727
|
xAxis: bandAxis,
|
2647
|
-
yAxis: linearAxis
|
3728
|
+
yAxis: linearAxis,
|
3729
|
+
crosshairLine: crosshairLine
|
2648
3730
|
}
|
2649
3731
|
}
|
2650
3732
|
};
|
@@ -2690,7 +3772,7 @@ const lightTheme = ()=>{
|
|
2690
3772
|
labelAutoHideGap: 4,
|
2691
3773
|
labelAutoLimit: true,
|
2692
3774
|
labelAutoLimitLength: 100,
|
2693
|
-
labelAutoRotate:
|
3775
|
+
labelAutoRotate: false,
|
2694
3776
|
labelAutoRotateAngleRange: [
|
2695
3777
|
0,
|
2696
3778
|
-45,
|
@@ -2740,6 +3822,20 @@ const lightTheme = ()=>{
|
|
2740
3822
|
-90
|
2741
3823
|
]
|
2742
3824
|
};
|
3825
|
+
const crosshairLine = {
|
3826
|
+
visible: true,
|
3827
|
+
labelVisible: true,
|
3828
|
+
lineColor: '#3641594d',
|
3829
|
+
labelColor: '#ffffff',
|
3830
|
+
labelBackgroundColor: '#364159'
|
3831
|
+
};
|
3832
|
+
const crosshairRect = {
|
3833
|
+
visible: true,
|
3834
|
+
labelVisible: true,
|
3835
|
+
rectColor: '#3641594d',
|
3836
|
+
labelColor: '#ffffff',
|
3837
|
+
labelBackgroundColor: '#364159'
|
3838
|
+
};
|
2743
3839
|
return {
|
2744
3840
|
baseConfig: {
|
2745
3841
|
vtable: {
|
@@ -2782,45 +3878,94 @@ const lightTheme = ()=>{
|
|
2782
3878
|
config: {
|
2783
3879
|
line: {
|
2784
3880
|
xAxis: bandAxis,
|
2785
|
-
yAxis: linearAxis
|
3881
|
+
yAxis: linearAxis,
|
3882
|
+
crosshairLine
|
2786
3883
|
},
|
2787
3884
|
column: {
|
2788
3885
|
xAxis: bandAxis,
|
2789
|
-
yAxis: linearAxis
|
3886
|
+
yAxis: linearAxis,
|
3887
|
+
crosshairRect,
|
3888
|
+
stackCornerRadius: [
|
3889
|
+
4,
|
3890
|
+
4,
|
3891
|
+
0,
|
3892
|
+
0
|
3893
|
+
]
|
2790
3894
|
},
|
2791
3895
|
columnParallel: {
|
2792
3896
|
xAxis: bandAxis,
|
2793
|
-
yAxis: linearAxis
|
3897
|
+
yAxis: linearAxis,
|
3898
|
+
crosshairRect,
|
3899
|
+
stackCornerRadius: [
|
3900
|
+
4,
|
3901
|
+
4,
|
3902
|
+
0,
|
3903
|
+
0
|
3904
|
+
]
|
2794
3905
|
},
|
2795
3906
|
columnPercent: {
|
2796
3907
|
xAxis: bandAxis,
|
2797
|
-
yAxis: linearAxis
|
3908
|
+
yAxis: linearAxis,
|
3909
|
+
crosshairRect,
|
3910
|
+
stackCornerRadius: [
|
3911
|
+
4,
|
3912
|
+
4,
|
3913
|
+
0,
|
3914
|
+
0
|
3915
|
+
]
|
2798
3916
|
},
|
2799
3917
|
bar: {
|
2800
3918
|
xAxis: linearAxis,
|
2801
|
-
yAxis: barBandAxis
|
3919
|
+
yAxis: barBandAxis,
|
3920
|
+
crosshairRect,
|
3921
|
+
stackCornerRadius: [
|
3922
|
+
0,
|
3923
|
+
4,
|
3924
|
+
4,
|
3925
|
+
0
|
3926
|
+
]
|
2802
3927
|
},
|
2803
3928
|
barParallel: {
|
2804
3929
|
xAxis: linearAxis,
|
2805
|
-
yAxis: barBandAxis
|
3930
|
+
yAxis: barBandAxis,
|
3931
|
+
crosshairRect,
|
3932
|
+
stackCornerRadius: [
|
3933
|
+
0,
|
3934
|
+
4,
|
3935
|
+
4,
|
3936
|
+
0
|
3937
|
+
]
|
2806
3938
|
},
|
2807
3939
|
barPercent: {
|
2808
3940
|
xAxis: linearAxis,
|
2809
|
-
yAxis: barBandAxis
|
3941
|
+
yAxis: barBandAxis,
|
3942
|
+
crosshairRect,
|
3943
|
+
stackCornerRadius: [
|
3944
|
+
0,
|
3945
|
+
4,
|
3946
|
+
4,
|
3947
|
+
0
|
3948
|
+
]
|
2810
3949
|
},
|
2811
3950
|
area: {
|
2812
3951
|
xAxis: bandAxis,
|
2813
|
-
yAxis: linearAxis
|
3952
|
+
yAxis: linearAxis,
|
3953
|
+
crosshairLine
|
2814
3954
|
},
|
2815
3955
|
areaPercent: {
|
2816
3956
|
xAxis: bandAxis,
|
2817
|
-
yAxis: linearAxis
|
3957
|
+
yAxis: linearAxis,
|
3958
|
+
crosshairLine
|
2818
3959
|
}
|
2819
3960
|
}
|
2820
3961
|
};
|
2821
3962
|
};
|
2822
3963
|
const registerCustomTheme = (key, themeConfig)=>{
|
2823
|
-
|
3964
|
+
const customTheme = 'function' == typeof themeConfig ? themeConfig({
|
3965
|
+
lightTheme: lightTheme(),
|
3966
|
+
darkTheme: darkTheme()
|
3967
|
+
}) : themeConfig;
|
3968
|
+
Builder._themeMap[key] = customTheme;
|
2824
3969
|
};
|
2825
3970
|
const registerLightTheme = ()=>{
|
2826
3971
|
registerCustomTheme('light', lightTheme());
|
@@ -2872,29 +4017,30 @@ const zDimension = z.object({
|
|
2872
4017
|
])
|
2873
4018
|
});
|
2874
4019
|
const zDimensions = z.array(zDimension).optional();
|
4020
|
+
const zNumFormat = z.object({
|
4021
|
+
type: z["enum"]([
|
4022
|
+
'number',
|
4023
|
+
'percent',
|
4024
|
+
'permille'
|
4025
|
+
]).default('number').optional(),
|
4026
|
+
ratio: z.number().default(1).optional(),
|
4027
|
+
symbol: z.string().default('').optional(),
|
4028
|
+
thousandSeparator: z.boolean().default(false).optional(),
|
4029
|
+
decimalPlaces: z.number().default(2).optional(),
|
4030
|
+
round: z["enum"]([
|
4031
|
+
'round',
|
4032
|
+
'floor',
|
4033
|
+
'ceil'
|
4034
|
+
]).default('round').optional(),
|
4035
|
+
prefix: z.string().default('').optional(),
|
4036
|
+
suffix: z.string().default('').optional()
|
4037
|
+
}).optional();
|
2875
4038
|
const zMeasure = z.object({
|
2876
4039
|
id: z.string(),
|
2877
4040
|
alias: z.string().optional(),
|
2878
4041
|
visible: z.boolean().default(true).optional(),
|
2879
4042
|
autoFormat: z.boolean().default(true).optional(),
|
2880
|
-
format:
|
2881
|
-
type: z["enum"]([
|
2882
|
-
'number',
|
2883
|
-
'percent',
|
2884
|
-
'permille'
|
2885
|
-
]).optional().default('number'),
|
2886
|
-
ratio: z.number().optional().default(1),
|
2887
|
-
symbol: z.string().optional().default(''),
|
2888
|
-
thousandSeparator: z.boolean().optional().default(false),
|
2889
|
-
decimalPlaces: z.number().optional().default(2),
|
2890
|
-
round: z["enum"]([
|
2891
|
-
'round',
|
2892
|
-
'floor',
|
2893
|
-
'ceil'
|
2894
|
-
]).optional().default('round'),
|
2895
|
-
prefix: z.string().optional().default(''),
|
2896
|
-
suffix: z.string().optional().default('')
|
2897
|
-
}).optional()
|
4043
|
+
format: zNumFormat.optional()
|
2898
4044
|
});
|
2899
4045
|
const zMeasureGroup = z.object({
|
2900
4046
|
id: z.string(),
|
@@ -3139,42 +4285,77 @@ const zXLinearAxis = z.object({
|
|
3139
4285
|
}).optional()
|
3140
4286
|
});
|
3141
4287
|
const zYLinearAxis = zXLinearAxis;
|
4288
|
+
const zCrosshairLine = z.object({
|
4289
|
+
visible: z.boolean().optional(),
|
4290
|
+
lineColor: z.string().optional(),
|
4291
|
+
labelColor: z.string().optional(),
|
4292
|
+
labelVisible: z.boolean().optional(),
|
4293
|
+
labelBackgroundColor: z.string().optional()
|
4294
|
+
});
|
4295
|
+
const zCrosshairRect = z.object({
|
4296
|
+
visible: z.boolean().optional(),
|
4297
|
+
rectColor: z.string().optional(),
|
4298
|
+
labelColor: z.string().optional(),
|
4299
|
+
labelVisible: z.boolean().optional(),
|
4300
|
+
labelBackgroundColor: z.string().optional()
|
4301
|
+
});
|
4302
|
+
const zStackCornerRadius = z.number().or(z.array(z.number())).default([
|
4303
|
+
3,
|
4304
|
+
3,
|
4305
|
+
0,
|
4306
|
+
0
|
4307
|
+
]);
|
3142
4308
|
const zConfig = z.object({
|
3143
4309
|
line: z.object({
|
3144
|
-
xAxis: zXBandAxis,
|
3145
|
-
yAxis: zYLinearAxis
|
4310
|
+
xAxis: zXBandAxis.optional(),
|
4311
|
+
yAxis: zYLinearAxis.optional(),
|
4312
|
+
crosshairLine: zCrosshairLine.optional()
|
3146
4313
|
}).optional(),
|
3147
4314
|
column: z.object({
|
3148
|
-
xAxis: zXBandAxis,
|
3149
|
-
yAxis: zYLinearAxis
|
4315
|
+
xAxis: zXBandAxis.optional(),
|
4316
|
+
yAxis: zYLinearAxis.optional(),
|
4317
|
+
crosshairRect: zCrosshairRect.optional(),
|
4318
|
+
stackCornerRadius: zStackCornerRadius.optional()
|
3150
4319
|
}).optional(),
|
3151
4320
|
columnParallel: z.object({
|
3152
|
-
xAxis: zXBandAxis,
|
3153
|
-
yAxis: zYLinearAxis
|
4321
|
+
xAxis: zXBandAxis.optional(),
|
4322
|
+
yAxis: zYLinearAxis.optional(),
|
4323
|
+
crosshairRect: zCrosshairRect.optional(),
|
4324
|
+
stackCornerRadius: zStackCornerRadius.optional()
|
3154
4325
|
}).optional(),
|
3155
4326
|
columnPercent: z.object({
|
3156
|
-
xAxis: zXBandAxis,
|
3157
|
-
yAxis: zYLinearAxis
|
4327
|
+
xAxis: zXBandAxis.optional(),
|
4328
|
+
yAxis: zYLinearAxis.optional(),
|
4329
|
+
crosshairRect: zCrosshairRect.optional(),
|
4330
|
+
stackCornerRadius: zStackCornerRadius.optional()
|
3158
4331
|
}).optional(),
|
3159
4332
|
bar: z.object({
|
3160
|
-
xAxis: zXLinearAxis,
|
3161
|
-
yAxis: zYBandAxis
|
4333
|
+
xAxis: zXLinearAxis.optional(),
|
4334
|
+
yAxis: zYBandAxis.optional(),
|
4335
|
+
crosshairRect: zCrosshairRect.optional(),
|
4336
|
+
stackCornerRadius: zStackCornerRadius.optional()
|
3162
4337
|
}).optional(),
|
3163
4338
|
barParallel: z.object({
|
3164
|
-
xAxis: zXLinearAxis,
|
3165
|
-
yAxis: zYBandAxis
|
4339
|
+
xAxis: zXLinearAxis.optional(),
|
4340
|
+
yAxis: zYBandAxis.optional(),
|
4341
|
+
crosshairRect: zCrosshairRect.optional(),
|
4342
|
+
stackCornerRadius: zStackCornerRadius.optional()
|
3166
4343
|
}).optional(),
|
3167
4344
|
barPercent: z.object({
|
3168
|
-
xAxis: zXLinearAxis,
|
3169
|
-
yAxis: zYBandAxis
|
4345
|
+
xAxis: zXLinearAxis.optional(),
|
4346
|
+
yAxis: zYBandAxis.optional(),
|
4347
|
+
crosshairRect: zCrosshairRect.optional(),
|
4348
|
+
stackCornerRadius: zStackCornerRadius.optional()
|
3170
4349
|
}).optional(),
|
3171
4350
|
area: z.object({
|
3172
|
-
xAxis: zXBandAxis,
|
3173
|
-
yAxis: zYLinearAxis
|
4351
|
+
xAxis: zXBandAxis.optional(),
|
4352
|
+
yAxis: zYLinearAxis.optional(),
|
4353
|
+
crosshairLine: zCrosshairLine.optional()
|
3174
4354
|
}).optional(),
|
3175
4355
|
areaPercent: z.object({
|
3176
|
-
xAxis: zXBandAxis,
|
3177
|
-
yAxis: zYLinearAxis
|
4356
|
+
xAxis: zXBandAxis.optional(),
|
4357
|
+
yAxis: zYLinearAxis.optional(),
|
4358
|
+
crosshairLine: zCrosshairLine.optional()
|
3178
4359
|
}).optional(),
|
3179
4360
|
pie: z.object({}).optional(),
|
3180
4361
|
donut: z.object({}).optional(),
|
@@ -3183,18 +4364,31 @@ const zConfig = z.object({
|
|
3183
4364
|
table: z.object({}).optional(),
|
3184
4365
|
pivotTable: z.object({}).optional()
|
3185
4366
|
});
|
3186
|
-
const zCustomThemeConfig = z.object({
|
3187
|
-
baseConfig: zBaseConfig.optional(),
|
3188
|
-
config: zConfig.optional()
|
3189
|
-
});
|
3190
|
-
const zCustomTheme = z.record(z.string(), zCustomThemeConfig).optional();
|
3191
|
-
const zTheme = z.string();
|
3192
4367
|
const zSelector = z.union([
|
3193
4368
|
z.string(),
|
3194
4369
|
z.number(),
|
3195
4370
|
z.object({
|
3196
4371
|
field: z.string(),
|
3197
|
-
operator: z
|
4372
|
+
operator: z["enum"]([
|
4373
|
+
'=',
|
4374
|
+
'==',
|
4375
|
+
'!=',
|
4376
|
+
'>',
|
4377
|
+
'<',
|
4378
|
+
'>=',
|
4379
|
+
'<=',
|
4380
|
+
'between'
|
4381
|
+
]).optional(),
|
4382
|
+
op: z["enum"]([
|
4383
|
+
'=',
|
4384
|
+
'==',
|
4385
|
+
'!=',
|
4386
|
+
'>',
|
4387
|
+
'<',
|
4388
|
+
'>=',
|
4389
|
+
'<=',
|
4390
|
+
'between'
|
4391
|
+
]).optional(),
|
3198
4392
|
value: z.union([
|
3199
4393
|
z.string(),
|
3200
4394
|
z.number(),
|
@@ -3206,7 +4400,14 @@ const zSelector = z.union([
|
|
3206
4400
|
}),
|
3207
4401
|
z.object({
|
3208
4402
|
field: z.string(),
|
3209
|
-
operator: z
|
4403
|
+
operator: z["enum"]([
|
4404
|
+
'in',
|
4405
|
+
'not in'
|
4406
|
+
]).optional(),
|
4407
|
+
op: z["enum"]([
|
4408
|
+
'in',
|
4409
|
+
'not in'
|
4410
|
+
]).optional(),
|
3210
4411
|
value: z.union([
|
3211
4412
|
z.string(),
|
3212
4413
|
z.number(),
|
@@ -3218,33 +4419,153 @@ const zSelector = z.union([
|
|
3218
4419
|
})
|
3219
4420
|
]);
|
3220
4421
|
const zSelectors = z.array(zSelector);
|
3221
|
-
const
|
4422
|
+
const zAnnotationPoint = z.object({
|
4423
|
+
selector: z.union([
|
4424
|
+
zSelector,
|
4425
|
+
zSelectors
|
4426
|
+
]),
|
4427
|
+
text: z.string().or(z.array(z.string())).optional(),
|
4428
|
+
textColor: z.string().default('#ffffff').optional(),
|
4429
|
+
textFontSize: z.number().default(12).optional(),
|
4430
|
+
textFontWeight: z.number().default(400).optional(),
|
4431
|
+
textAlign: z["enum"]([
|
4432
|
+
'left',
|
4433
|
+
'right',
|
4434
|
+
'center'
|
4435
|
+
]).default('center').optional(),
|
4436
|
+
textBaseline: z["enum"]([
|
4437
|
+
'top',
|
4438
|
+
'middle',
|
4439
|
+
'bottom'
|
4440
|
+
]).default('middle').optional(),
|
4441
|
+
backgroundVisible: z.boolean().default(true).optional(),
|
4442
|
+
backgroundColor: z.string().default('#212121').optional(),
|
4443
|
+
backgroundBorderColor: z.string().optional(),
|
4444
|
+
backgroundBorderWidth: z.number().default(1).optional(),
|
4445
|
+
backgroundBorderRadius: z.number().default(4).optional(),
|
4446
|
+
backgroundPadding: z.number().optional(),
|
4447
|
+
offsetY: z.number().default(0).optional(),
|
4448
|
+
offsetX: z.number().default(0).optional()
|
4449
|
+
});
|
4450
|
+
const zAnnotationVerticalLine = z.object({
|
3222
4451
|
selector: z.union([
|
3223
4452
|
zSelector,
|
3224
4453
|
zSelectors
|
3225
4454
|
]).optional(),
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
4455
|
+
xValue: z.union([
|
4456
|
+
z.number(),
|
4457
|
+
z.string(),
|
4458
|
+
z.array(z.union([
|
4459
|
+
z.number(),
|
4460
|
+
z.string()
|
4461
|
+
]))
|
4462
|
+
]).optional(),
|
4463
|
+
text: z.string().or(z.array(z.string())).optional(),
|
4464
|
+
textPosition: z["enum"]([
|
4465
|
+
'outsideStart',
|
4466
|
+
'outsideEnd',
|
4467
|
+
'outsideMiddle',
|
4468
|
+
'insideStart',
|
4469
|
+
'insideMiddle',
|
4470
|
+
'insideEnd'
|
4471
|
+
]).default('insideEnd').optional(),
|
4472
|
+
textColor: z.string().default('#ffffff').optional(),
|
4473
|
+
textFontSize: z.number().default(12).optional(),
|
4474
|
+
textFontWeight: z.number().default(400).optional(),
|
4475
|
+
textAlign: z["enum"]([
|
4476
|
+
'left',
|
4477
|
+
'right',
|
4478
|
+
'center'
|
4479
|
+
]).default('right').optional(),
|
4480
|
+
textBaseline: z["enum"]([
|
4481
|
+
'top',
|
4482
|
+
'middle',
|
4483
|
+
'bottom'
|
4484
|
+
]).default('top').optional(),
|
4485
|
+
lineVisible: z.boolean().optional(),
|
4486
|
+
lineColor: z.string().optional(),
|
4487
|
+
lineWidth: z.number().optional(),
|
4488
|
+
lineStyle: z.union([
|
3231
4489
|
z.literal('solid'),
|
3232
4490
|
z.literal('dashed'),
|
3233
4491
|
z.literal('dotted')
|
3234
4492
|
]).optional(),
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
4493
|
+
backgroundVisible: z.boolean().default(true).optional(),
|
4494
|
+
backgroundColor: z.string().default('#212121').optional(),
|
4495
|
+
backgroundBorderColor: z.string().optional(),
|
4496
|
+
backgroundBorderWidth: z.number().default(1).optional(),
|
4497
|
+
backgroundBorderRadius: z.number().default(4).optional(),
|
4498
|
+
backgroundPadding: z.number().optional(),
|
4499
|
+
offsetY: z.number().default(0).optional(),
|
4500
|
+
offsetX: z.number().default(0).optional()
|
3239
4501
|
});
|
3240
|
-
const
|
3241
|
-
|
4502
|
+
const zAnnotationHorizontalLine = z.object({
|
4503
|
+
selector: z.union([
|
4504
|
+
zSelector,
|
4505
|
+
zSelectors
|
4506
|
+
]).optional(),
|
4507
|
+
yValue: z.union([
|
4508
|
+
z.number(),
|
4509
|
+
z.string(),
|
4510
|
+
z.array(z.union([
|
4511
|
+
z.number(),
|
4512
|
+
z.string()
|
4513
|
+
]))
|
4514
|
+
]).optional(),
|
4515
|
+
text: z.string().or(z.array(z.string())).optional(),
|
4516
|
+
textPosition: z["enum"]([
|
4517
|
+
'outsideStart',
|
4518
|
+
'outsideEnd',
|
4519
|
+
'outsideMiddle',
|
4520
|
+
'insideStart',
|
4521
|
+
'insideMiddle',
|
4522
|
+
'insideEnd'
|
4523
|
+
]).default('insideMiddle').optional(),
|
4524
|
+
textColor: z.string().default('#ffffff').optional(),
|
4525
|
+
textFontSize: z.number().default(12).optional(),
|
4526
|
+
textFontWeight: z.number().default(400).optional(),
|
4527
|
+
textAlign: z["enum"]([
|
4528
|
+
'left',
|
4529
|
+
'right',
|
4530
|
+
'center'
|
4531
|
+
]).default('center').optional(),
|
4532
|
+
textBaseline: z["enum"]([
|
4533
|
+
'top',
|
4534
|
+
'middle',
|
4535
|
+
'bottom'
|
4536
|
+
]).default('bottom').optional(),
|
4537
|
+
lineVisible: z.boolean().optional(),
|
4538
|
+
lineColor: z.string().optional(),
|
4539
|
+
lineWidth: z.number().optional(),
|
4540
|
+
lineStyle: z.union([
|
4541
|
+
z.literal('solid'),
|
4542
|
+
z.literal('dashed'),
|
4543
|
+
z.literal('dotted')
|
4544
|
+
]).optional(),
|
4545
|
+
backgroundVisible: z.boolean().default(true).optional(),
|
4546
|
+
backgroundColor: z.string().default('#212121').optional(),
|
4547
|
+
backgroundBorderColor: z.string().optional(),
|
4548
|
+
backgroundBorderWidth: z.number().default(1).optional(),
|
4549
|
+
backgroundBorderRadius: z.number().default(4).optional(),
|
4550
|
+
backgroundPadding: z.number().optional(),
|
4551
|
+
offsetY: z.number().default(0).optional(),
|
4552
|
+
offsetX: z.number().default(0).optional()
|
3242
4553
|
});
|
3243
|
-
const
|
4554
|
+
const zAnnotationArea = z.object({
|
3244
4555
|
selector: z.union([
|
3245
4556
|
zSelector,
|
3246
4557
|
zSelectors
|
3247
4558
|
]),
|
4559
|
+
textPosition: z["enum"]([
|
4560
|
+
'top',
|
4561
|
+
'topRight',
|
4562
|
+
'topLeft',
|
4563
|
+
'bottom',
|
4564
|
+
'bottomLeft',
|
4565
|
+
'bottomRight',
|
4566
|
+
'left',
|
4567
|
+
'right'
|
4568
|
+
]).default('top').optional(),
|
3248
4569
|
text: z.string().or(z.array(z.string())).optional(),
|
3249
4570
|
textColor: z.string().default('#ffffff').optional(),
|
3250
4571
|
textFontSize: z.number().default(12).optional(),
|
@@ -3265,12 +4586,95 @@ const zAnnotationPoint = z.object({
|
|
3265
4586
|
backgroundBorderWidth: z.number().default(1).optional(),
|
3266
4587
|
backgroundBorderRadius: z.number().default(4).optional(),
|
3267
4588
|
backgroundPadding: z.number().optional(),
|
3268
|
-
|
3269
|
-
|
4589
|
+
areaColor: z.string().default('red').optional(),
|
4590
|
+
areaColorOpacity: z.number().default(0.5).optional(),
|
4591
|
+
areaBorderColor: z.number().optional(),
|
4592
|
+
areaBorderWidth: z.number().default(2).optional(),
|
4593
|
+
areaBorderRadius: z.number().default(4).optional(),
|
4594
|
+
outerPadding: z.number().optional()
|
3270
4595
|
});
|
3271
4596
|
const zAnnotation = z.object({
|
3272
|
-
annotationPoint: zAnnotationPoint.or(z.array(zAnnotationPoint)).optional()
|
4597
|
+
annotationPoint: zAnnotationPoint.or(z.array(zAnnotationPoint)).optional(),
|
4598
|
+
annotationVerticalLine: zAnnotationVerticalLine.or(z.array(zAnnotationVerticalLine)).optional(),
|
4599
|
+
annotationHorizontalLine: zAnnotationHorizontalLine.or(z.array(zAnnotationHorizontalLine)).optional(),
|
4600
|
+
annotationArea: zAnnotationArea.or(z.array(zAnnotationArea)).optional()
|
4601
|
+
});
|
4602
|
+
const zBarStyle = z.object({
|
4603
|
+
selector: z.union([
|
4604
|
+
zSelector,
|
4605
|
+
zSelectors
|
4606
|
+
]).optional(),
|
4607
|
+
barColor: z.string().optional(),
|
4608
|
+
barColorOpacity: z.number().optional(),
|
4609
|
+
barBorderColor: z.string().optional(),
|
4610
|
+
barBorderWidth: z.number().optional(),
|
4611
|
+
barBorderStyle: z.union([
|
4612
|
+
z.literal('solid'),
|
4613
|
+
z.literal('dashed'),
|
4614
|
+
z.literal('dotted')
|
4615
|
+
]).optional(),
|
4616
|
+
barRadius: z.union([
|
4617
|
+
z.number(),
|
4618
|
+
z.array(z.number())
|
4619
|
+
]).optional()
|
4620
|
+
});
|
4621
|
+
const zPointStyle = z.object({
|
4622
|
+
selector: z.union([
|
4623
|
+
zSelector,
|
4624
|
+
zSelectors
|
4625
|
+
]).optional(),
|
4626
|
+
pointSize: z.number().optional(),
|
4627
|
+
pointColor: z.string().optional(),
|
4628
|
+
pointColorOpacity: z.number().optional(),
|
4629
|
+
pointBorderColor: z.string().optional(),
|
4630
|
+
pointBorderWidth: z.number().optional(),
|
4631
|
+
pointBorderStyle: z.union([
|
4632
|
+
z["enum"]([
|
4633
|
+
'solid',
|
4634
|
+
'dashed',
|
4635
|
+
'dotted'
|
4636
|
+
])
|
4637
|
+
]).optional()
|
4638
|
+
});
|
4639
|
+
const zLineStyle = z.object({
|
4640
|
+
selector: z.union([
|
4641
|
+
zSelector,
|
4642
|
+
zSelectors
|
4643
|
+
]).optional(),
|
4644
|
+
lineSmooth: z.boolean().default(true).optional(),
|
4645
|
+
lineColor: z.string().optional(),
|
4646
|
+
lineColorOpacity: z.number().optional(),
|
4647
|
+
lineWidth: z.number().optional(),
|
4648
|
+
lineStyle: z.union([
|
4649
|
+
z["enum"]([
|
4650
|
+
'solid',
|
4651
|
+
'dashed',
|
4652
|
+
'dotted'
|
4653
|
+
])
|
4654
|
+
]).optional()
|
4655
|
+
});
|
4656
|
+
const zAreaStyle = z.object({
|
4657
|
+
selector: z.union([
|
4658
|
+
zSelector,
|
4659
|
+
zSelectors
|
4660
|
+
]).optional(),
|
4661
|
+
areaColor: z.string().optional(),
|
4662
|
+
areaColorOpacity: z.number().optional()
|
3273
4663
|
});
|
3274
|
-
|
4664
|
+
const zMarkStyle = z.object({
|
4665
|
+
barStyle: zBarStyle.or(z.array(zBarStyle)).optional(),
|
4666
|
+
pointStyle: zPointStyle.or(z.array(zPointStyle)).optional(),
|
4667
|
+
lineStyle: zLineStyle.or(z.array(zLineStyle)).optional(),
|
4668
|
+
areaStyle: zAreaStyle.or(z.array(zAreaStyle)).optional()
|
4669
|
+
});
|
4670
|
+
const zCustomThemeConfig = z.object({
|
4671
|
+
baseConfig: zBaseConfig.optional(),
|
4672
|
+
config: zConfig.optional(),
|
4673
|
+
annotation: zAnnotation.optional(),
|
4674
|
+
markStyle: zMarkStyle.optional()
|
4675
|
+
});
|
4676
|
+
const zCustomTheme = z.record(z.string(), zCustomThemeConfig).optional();
|
4677
|
+
const zTheme = z.string();
|
4678
|
+
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, createFormatter, createNumFormatter, darkTheme, dataReshapeFor1D1M, dataReshapeFor2D1M, execPipeline, findMeasureById, 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, zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zAreaStyle, zAxis, zBackgroundColor, zBarStyle, zBaseConfig, zChartType, zColor, zConfig, zCrosshairLine, zCrosshairRect, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zLineStyle, zMarkStyle, zMeasure, zMeasureGroup, zMeasures, zNumFormat, zPointStyle, zStackCornerRadius, zTheme, zTooltip, zUnfoldInfo, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
|
3275
4679
|
|
3276
4680
|
//# sourceMappingURL=index.js.map
|