@visactor/vseed 0.0.30 → 0.0.31
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 +36 -0
- package/dist/index.cjs +330 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +177 -50
- package/dist/index.js.map +1 -1
- package/dist/pipeline/spec/chart/pipes/tooltip/index.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/tooltip/tooltipAreaRange.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/tooltip/tooltipDisable.d.ts +2 -0
- package/dist/types/advancedVSeed.d.ts +12 -0
- package/dist/types/chartType/area/area.d.ts +16 -4
- package/dist/types/chartType/areaPercent/areaPercent.d.ts +16 -4
- package/dist/types/chartType/areaRange/areaRange.d.ts +16 -4
- package/dist/types/chartType/bar/bar.d.ts +16 -4
- package/dist/types/chartType/barParallel/barParallel.d.ts +16 -4
- package/dist/types/chartType/barPercent/barPercent.d.ts +16 -4
- package/dist/types/chartType/column/column.d.ts +16 -4
- package/dist/types/chartType/columnParallel/columnParallel.d.ts +16 -4
- package/dist/types/chartType/columnPercent/columnPercent.d.ts +16 -4
- package/dist/types/chartType/line/line.d.ts +17 -5
- package/dist/types/chartType/scatter/scatter.d.ts +12 -0
- package/dist/types/properties/analysis/analysis.d.ts +1 -1
- package/dist/types/properties/analysis/index.d.ts +1 -1
- package/dist/types/properties/analysis/{sortAxis.d.ts → sort.d.ts} +2 -2
- package/dist/types/properties/annotation/annotation.d.ts +12 -0
- package/dist/types/properties/annotation/annotationArea.d.ts +14 -17
- package/dist/types/properties/annotation/annotationHorizontalLine.d.ts +2 -19
- package/dist/types/properties/annotation/annotationPoint.d.ts +0 -14
- package/dist/types/properties/annotation/annotationVerticalLine.d.ts +4 -21
- package/dist/types/properties/config/axes/axis.d.ts +1 -1
- package/dist/types/properties/config/legend/legend.d.ts +9 -10
- package/dist/types/properties/measures/measures.d.ts +6 -1
- package/dist/types/vseed.d.ts +133 -1
- package/dist/umd/index.js +257 -7946
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
export { Builder } from './builder';
|
2
2
|
export { registerAll } from './builder/register/all';
|
3
|
+
export { updateAdvanced, updateSpec } from './builder/register/custom';
|
3
4
|
export { registerDarkTheme, registerLightTheme, registerCustomTheme } from './builder/register/theme';
|
4
5
|
export { registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerLine, registerPie, registerDonut, registerRose, registerRoseParallel, registerFunnel, registerScatter, registerTable, registerPivotTable, registerAreaRange, registerHeatmap, registerRadar, } from './builder/register/chartType';
|
5
|
-
export * from './pipeline
|
6
|
+
export * from './pipeline';
|
6
7
|
export * from './types';
|
7
8
|
export * from './dataReshape';
|
8
9
|
export * from './dataSelector';
|
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { clone, groupBy, isArray, isEmpty, isNullish, isNumber, isString, mergeDeep, omit, pick, sort, unique } from "remeda";
|
2
|
-
import
|
2
|
+
import { z } from "zod";
|
3
3
|
const execPipeline = (pipeline, context, initialValue = {})=>{
|
4
4
|
const result = pipeline.reduce((prev, cur)=>cur(prev, context), initialValue);
|
5
5
|
return result;
|
@@ -1242,7 +1242,7 @@ const sortXBandAxis = (advancedVSeed, context)=>{
|
|
1242
1242
|
...advancedVSeed
|
1243
1243
|
};
|
1244
1244
|
const { vseed } = context;
|
1245
|
-
const { sortAxis, dataset } = vseed;
|
1245
|
+
const { sort: sortAxis, dataset } = vseed;
|
1246
1246
|
const { encoding } = advancedVSeed;
|
1247
1247
|
const xField = encoding?.[0]?.x?.[0];
|
1248
1248
|
if (!sortAxis || !xField) return advancedVSeed;
|
@@ -1257,7 +1257,7 @@ const sortYBandAxis = (advancedVSeed, context)=>{
|
|
1257
1257
|
...advancedVSeed
|
1258
1258
|
};
|
1259
1259
|
const { vseed } = context;
|
1260
|
-
const { sortAxis, dataset } = vseed;
|
1260
|
+
const { sort: sortAxis, dataset } = vseed;
|
1261
1261
|
const { encoding } = advancedVSeed;
|
1262
1262
|
const yField = encoding?.[0]?.y?.[0];
|
1263
1263
|
if (!sortAxis || !yField) return advancedVSeed;
|
@@ -1294,10 +1294,10 @@ const sort_sortLegend = (advancedVSeed, context)=>{
|
|
1294
1294
|
result.analysis.orderMapping[groupField] = orderRes;
|
1295
1295
|
return result;
|
1296
1296
|
};
|
1297
|
-
const calcOrder = (
|
1298
|
-
if (
|
1299
|
-
const order =
|
1300
|
-
const orderBy =
|
1297
|
+
const calcOrder = (sortConfig, id, dataset)=>{
|
1298
|
+
if (sortConfig.customOrder) return sortConfig.customOrder;
|
1299
|
+
const order = sortConfig.order || 'asc';
|
1300
|
+
const orderBy = sortConfig.orderBy;
|
1301
1301
|
const res = sort(dataset, (a, b)=>{
|
1302
1302
|
const aValue = a[orderBy || id];
|
1303
1303
|
const bValue = b[orderBy || id];
|
@@ -1576,13 +1576,13 @@ const xBand = (spec, context)=>{
|
|
1576
1576
|
];
|
1577
1577
|
return result;
|
1578
1578
|
}
|
1579
|
-
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
1579
|
+
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength = 80, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
1580
1580
|
const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
|
1581
1581
|
const bandAxis = {
|
1582
1582
|
visible,
|
1583
1583
|
type: 'band',
|
1584
1584
|
orient: 'bottom',
|
1585
|
-
maxHeight: labelAutoLimitLength,
|
1585
|
+
maxHeight: labelAutoLimitLength + 60,
|
1586
1586
|
sampling,
|
1587
1587
|
hover: true,
|
1588
1588
|
label: {
|
@@ -1832,24 +1832,35 @@ const tooltip_tooltip = (spec, context)=>{
|
|
1832
1832
|
...spec
|
1833
1833
|
};
|
1834
1834
|
const { advancedVSeed } = context;
|
1835
|
-
const { measures, datasetReshapeInfo, chartType, locale } = advancedVSeed;
|
1835
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
1836
1836
|
const baseConfig = advancedVSeed.config[chartType];
|
1837
1837
|
const { tooltip = {
|
1838
1838
|
enable: true
|
1839
1839
|
} } = baseConfig;
|
1840
1840
|
const { enable } = tooltip;
|
1841
|
-
const { measureId, measureValue } = datasetReshapeInfo[0].foldInfo;
|
1841
|
+
const { measureId, measureValue, measureName } = datasetReshapeInfo[0].foldInfo;
|
1842
1842
|
const { groupName } = datasetReshapeInfo[0].unfoldInfo;
|
1843
1843
|
result.tooltip = {
|
1844
1844
|
visible: enable,
|
1845
1845
|
mark: {
|
1846
1846
|
title: {
|
1847
|
-
|
1847
|
+
visible: true
|
1848
1848
|
},
|
1849
1849
|
content: [
|
1850
|
+
...dimensions.map((item)=>({
|
1851
|
+
visible: true,
|
1852
|
+
hasShape: true,
|
1853
|
+
shapeType: 'rectRound',
|
1854
|
+
key: (datum)=>{
|
1855
|
+
if (item.alias || item.id) return item.alias || item.id;
|
1856
|
+
return datum && datum[item.id];
|
1857
|
+
},
|
1858
|
+
value: (datum)=>datum && datum[item.id]
|
1859
|
+
})),
|
1850
1860
|
{
|
1851
1861
|
visible: true,
|
1852
|
-
|
1862
|
+
hasShape: true,
|
1863
|
+
key: (datum)=>datum && datum[measureName || groupName] || '',
|
1853
1864
|
value: (datum)=>{
|
1854
1865
|
if (!datum) return '';
|
1855
1866
|
const value = datum[measureValue];
|
@@ -1885,7 +1896,8 @@ const tooltip_tooltip = (spec, context)=>{
|
|
1885
1896
|
}
|
1886
1897
|
if (autoFormat) return autoFormatter(value, locale);
|
1887
1898
|
return String(value);
|
1888
|
-
}
|
1899
|
+
},
|
1900
|
+
shapeType: 'rectRound'
|
1889
1901
|
}
|
1890
1902
|
]
|
1891
1903
|
}
|
@@ -1999,6 +2011,7 @@ const discreteLegend = (spec, context)=>{
|
|
1999
2011
|
}) : void 0,
|
2000
2012
|
item: {
|
2001
2013
|
focus: true,
|
2014
|
+
maxWidth: 260,
|
2002
2015
|
focusIconStyle: {
|
2003
2016
|
size: labelFontSize + 2,
|
2004
2017
|
fill: labelFontColor,
|
@@ -2027,7 +2040,8 @@ const discreteLegend = (spec, context)=>{
|
|
2027
2040
|
}
|
2028
2041
|
}
|
2029
2042
|
}
|
2030
|
-
}
|
2043
|
+
},
|
2044
|
+
padding: 0
|
2031
2045
|
};
|
2032
2046
|
return result;
|
2033
2047
|
};
|
@@ -2134,7 +2148,7 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
2134
2148
|
pointStyle
|
2135
2149
|
];
|
2136
2150
|
const customMap = pointStyles.reduce((result, style, index)=>{
|
2137
|
-
const { pointBorderColor, pointBorderStyle, pointBorderWidth, pointColor, pointColorOpacity, pointSize } = style;
|
2151
|
+
const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize } = style;
|
2138
2152
|
const lineDash = 'dashed' === pointBorderStyle ? [
|
2139
2153
|
5,
|
2140
2154
|
2
|
@@ -2289,7 +2303,7 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
2289
2303
|
annotationPoint
|
2290
2304
|
];
|
2291
2305
|
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
2292
|
-
const { selector: selectorPoint, text = '', textColor = '#
|
2306
|
+
const { selector: selectorPoint, text = '', textColor = '#cccccc', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'middle', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
|
2293
2307
|
const dataset = advancedVSeed.dataset.flat();
|
2294
2308
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
2295
2309
|
return selectedData.map((datum)=>({
|
@@ -2312,12 +2326,14 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
2312
2326
|
offsetY,
|
2313
2327
|
offsetX,
|
2314
2328
|
text: {
|
2315
|
-
visible: true,
|
2316
2329
|
text: text,
|
2317
2330
|
style: {
|
2331
|
+
visible: true,
|
2318
2332
|
textAlign: textAlign,
|
2319
2333
|
textBaseline: textBaseline,
|
2320
2334
|
fill: textColor,
|
2335
|
+
stroke: backgroundColor,
|
2336
|
+
lineWidth: 1,
|
2321
2337
|
fontSize: textFontSize,
|
2322
2338
|
fontWeight: textFontWeight
|
2323
2339
|
},
|
@@ -2328,7 +2344,7 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
2328
2344
|
cornerRadius: backgroundBorderRadius ?? 4,
|
2329
2345
|
fill: backgroundColor,
|
2330
2346
|
stroke: backgroundBorderColor,
|
2331
|
-
|
2347
|
+
lineWidth: backgroundBorderWidth
|
2332
2348
|
}
|
2333
2349
|
}
|
2334
2350
|
}
|
@@ -2357,14 +2373,16 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
|
2357
2373
|
insideEnd: 'insideEndTop'
|
2358
2374
|
};
|
2359
2375
|
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2360
|
-
const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#
|
2376
|
+
const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#cccccc', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
|
2361
2377
|
const dataset = advancedVSeed.dataset.flat();
|
2362
2378
|
const generateOneMarkLine = (x)=>({
|
2363
2379
|
x: x,
|
2364
2380
|
zIndex: ANNOTATION_Z_INDEX,
|
2381
|
+
offsetX,
|
2382
|
+
offsetY,
|
2365
2383
|
line: {
|
2366
|
-
visible: lineVisible,
|
2367
2384
|
style: {
|
2385
|
+
visible: lineVisible,
|
2368
2386
|
stroke: lineColor,
|
2369
2387
|
lineStyle: lineStyle,
|
2370
2388
|
lineWidth: lineWidth,
|
@@ -2384,11 +2402,14 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
|
2384
2402
|
position: positionMap[textPosition],
|
2385
2403
|
style: {
|
2386
2404
|
visible: true,
|
2405
|
+
stroke: backgroundColor,
|
2406
|
+
lineWidth: 1,
|
2387
2407
|
textAlign: textAlign,
|
2388
2408
|
textBaseline: textBaseline,
|
2389
2409
|
fill: textColor,
|
2390
2410
|
fontSize: textFontSize,
|
2391
|
-
fontWeight: textFontWeight
|
2411
|
+
fontWeight: textFontWeight,
|
2412
|
+
dy: textFontSize
|
2392
2413
|
},
|
2393
2414
|
labelBackground: {
|
2394
2415
|
visible: backgroundVisible,
|
@@ -2397,13 +2418,14 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
|
2397
2418
|
cornerRadius: backgroundBorderRadius ?? 4,
|
2398
2419
|
fill: backgroundColor,
|
2399
2420
|
stroke: backgroundBorderColor,
|
2400
|
-
|
2421
|
+
lineWidth: backgroundBorderWidth
|
2401
2422
|
}
|
2402
2423
|
}
|
2403
2424
|
},
|
2404
2425
|
endSymbol: {
|
2405
2426
|
visible: true,
|
2406
2427
|
style: {
|
2428
|
+
dy: 4,
|
2407
2429
|
fill: lineColor
|
2408
2430
|
}
|
2409
2431
|
}
|
@@ -2448,14 +2470,16 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
|
|
2448
2470
|
insideEnd: 'insideEndTop'
|
2449
2471
|
};
|
2450
2472
|
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2451
|
-
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, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1 } = 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, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
|
2452
2474
|
const dataset = advancedVSeed.dataset.flat();
|
2453
2475
|
const generateOneMarkLine = (y)=>({
|
2454
2476
|
y,
|
2477
|
+
offsetX,
|
2478
|
+
offsetY,
|
2455
2479
|
zIndex: ANNOTATION_Z_INDEX,
|
2456
2480
|
line: {
|
2457
|
-
visible: lineVisible,
|
2458
2481
|
style: {
|
2482
|
+
visible: lineVisible,
|
2459
2483
|
stroke: lineColor,
|
2460
2484
|
lineStyle: lineStyle,
|
2461
2485
|
lineWidth: lineWidth,
|
@@ -2475,6 +2499,9 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
|
|
2475
2499
|
position: positionMap[textPosition],
|
2476
2500
|
style: {
|
2477
2501
|
visible: true,
|
2502
|
+
dy: textFontSize,
|
2503
|
+
stroke: backgroundColor,
|
2504
|
+
lineWidth: 1,
|
2478
2505
|
textAlign: textAlign,
|
2479
2506
|
textBaseline: textBaseline,
|
2480
2507
|
fill: textColor,
|
@@ -2488,13 +2515,14 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
|
|
2488
2515
|
cornerRadius: backgroundBorderRadius ?? 4,
|
2489
2516
|
fill: backgroundColor,
|
2490
2517
|
stroke: backgroundBorderColor,
|
2491
|
-
|
2518
|
+
lineWidth: backgroundBorderWidth
|
2492
2519
|
}
|
2493
2520
|
}
|
2494
2521
|
},
|
2495
2522
|
endSymbol: {
|
2496
2523
|
visible: true,
|
2497
2524
|
style: {
|
2525
|
+
dx: -4,
|
2498
2526
|
fill: lineColor
|
2499
2527
|
}
|
2500
2528
|
}
|
@@ -2541,12 +2569,14 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
2541
2569
|
right: 'insideRight'
|
2542
2570
|
};
|
2543
2571
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
2544
|
-
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#191d24', backgroundPadding = 10, backgroundVisible = true, outerPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth } = 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 = 10, backgroundVisible = true, outerPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth, offsetX = 0, offsetY = 0 } = annotationArea;
|
2545
2573
|
const dataset = advancedVSeed.dataset.flat();
|
2546
2574
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
2547
2575
|
return {
|
2548
2576
|
zIndex: ANNOTATION_Z_INDEX,
|
2549
2577
|
regionRelative: true,
|
2578
|
+
offsetX,
|
2579
|
+
offsetY,
|
2550
2580
|
positions: (data, context)=>{
|
2551
2581
|
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
2552
2582
|
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
@@ -2612,6 +2642,8 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
2612
2642
|
textAlign: textAlign,
|
2613
2643
|
textBaseline: textBaseline,
|
2614
2644
|
fill: textColor,
|
2645
|
+
stroke: backgroundColor,
|
2646
|
+
lineWidth: 1,
|
2615
2647
|
fontSize: textFontSize,
|
2616
2648
|
fontWeight: textFontWeight
|
2617
2649
|
},
|
@@ -2622,7 +2654,7 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
2622
2654
|
cornerRadius: backgroundBorderRadius ?? 4,
|
2623
2655
|
fill: backgroundColor,
|
2624
2656
|
stroke: backgroundBorderColor,
|
2625
|
-
|
2657
|
+
lineWidth: backgroundBorderWidth
|
2626
2658
|
}
|
2627
2659
|
}
|
2628
2660
|
},
|
@@ -2632,7 +2664,7 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
2632
2664
|
fill: areaColor,
|
2633
2665
|
fillOpacity: areaColorOpacity,
|
2634
2666
|
stroke: areaBorderColor,
|
2635
|
-
|
2667
|
+
lineWidth: areaBorderWidth,
|
2636
2668
|
cornerRadius: areaBorderRadius
|
2637
2669
|
}
|
2638
2670
|
}
|
@@ -2971,6 +3003,7 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
2971
3003
|
})),
|
2972
3004
|
item: {
|
2973
3005
|
focus: true,
|
3006
|
+
maxWidth: 260,
|
2974
3007
|
focusIconStyle: {
|
2975
3008
|
size: labelFontSize + 2,
|
2976
3009
|
fill: labelFontColor,
|
@@ -3312,7 +3345,7 @@ const barStyle_barStyle = (spec, context)=>{
|
|
3312
3345
|
barStyle
|
3313
3346
|
];
|
3314
3347
|
const customMap = barStyles.reduce((result, style, index)=>{
|
3315
|
-
const { barBorderColor, barBorderStyle, barBorderWidth, barColor, barColorOpacity, barRadius } = style;
|
3348
|
+
const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius } = style;
|
3316
3349
|
const lineDash = 'dashed' === barBorderStyle ? [
|
3317
3350
|
5,
|
3318
3351
|
2
|
@@ -3373,12 +3406,14 @@ const annotationAreaBand = (spec, context)=>{
|
|
3373
3406
|
right: 'insideRight'
|
3374
3407
|
};
|
3375
3408
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
3376
|
-
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;
|
3409
|
+
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, offsetX, offsetY } = annotationArea;
|
3377
3410
|
const dataset = advancedVSeed.dataset.flat();
|
3378
3411
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
3379
3412
|
return {
|
3380
3413
|
zIndex: ANNOTATION_Z_INDEX,
|
3381
3414
|
regionRelative: true,
|
3415
|
+
offsetX,
|
3416
|
+
offsetY,
|
3382
3417
|
positions: (data, context)=>{
|
3383
3418
|
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
3384
3419
|
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
@@ -3447,6 +3482,8 @@ const annotationAreaBand = (spec, context)=>{
|
|
3447
3482
|
style: {
|
3448
3483
|
textAlign: textAlign,
|
3449
3484
|
textBaseline: textBaseline,
|
3485
|
+
stroke: backgroundColor,
|
3486
|
+
lineWidth: 1,
|
3450
3487
|
fill: textColor,
|
3451
3488
|
fontSize: textFontSize,
|
3452
3489
|
fontWeight: textFontWeight
|
@@ -3458,7 +3495,7 @@ const annotationAreaBand = (spec, context)=>{
|
|
3458
3495
|
cornerRadius: backgroundBorderRadius ?? 4,
|
3459
3496
|
fill: backgroundColor,
|
3460
3497
|
stroke: backgroundBorderColor,
|
3461
|
-
|
3498
|
+
lineWidth: backgroundBorderWidth
|
3462
3499
|
}
|
3463
3500
|
}
|
3464
3501
|
},
|
@@ -3468,7 +3505,7 @@ const annotationAreaBand = (spec, context)=>{
|
|
3468
3505
|
fill: areaColor,
|
3469
3506
|
fillOpacity: areaColorOpacity,
|
3470
3507
|
stroke: areaBorderColor,
|
3471
|
-
|
3508
|
+
lineWidth: areaBorderWidth,
|
3472
3509
|
cornerRadius: areaBorderRadius
|
3473
3510
|
}
|
3474
3511
|
}
|
@@ -3929,13 +3966,13 @@ const yBand = (spec, context)=>{
|
|
3929
3966
|
];
|
3930
3967
|
return result;
|
3931
3968
|
}
|
3932
|
-
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
3969
|
+
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength = 80, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
3933
3970
|
const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
|
3934
3971
|
const bandAxis = {
|
3935
3972
|
visible,
|
3936
3973
|
type: 'band',
|
3937
3974
|
orient: 'left',
|
3938
|
-
maxWidth: labelAutoLimitLength,
|
3975
|
+
maxWidth: labelAutoLimitLength + 60,
|
3939
3976
|
sampling,
|
3940
3977
|
hover: true,
|
3941
3978
|
label: {
|
@@ -4813,6 +4850,79 @@ const initAreaRangeLine2 = (spec, context)=>{
|
|
4813
4850
|
};
|
4814
4851
|
return result;
|
4815
4852
|
};
|
4853
|
+
const tooltipDisable = (spec)=>{
|
4854
|
+
const result = {
|
4855
|
+
...spec
|
4856
|
+
};
|
4857
|
+
result.tooltip = {
|
4858
|
+
visible: false
|
4859
|
+
};
|
4860
|
+
return result;
|
4861
|
+
};
|
4862
|
+
const tooltipAreaRange = (spec, context)=>{
|
4863
|
+
const result = {
|
4864
|
+
...spec
|
4865
|
+
};
|
4866
|
+
const { advancedVSeed } = context;
|
4867
|
+
const { measures, datasetReshapeInfo, chartType, locale, encoding } = advancedVSeed;
|
4868
|
+
const baseConfig = advancedVSeed.config[chartType];
|
4869
|
+
const { tooltip = {
|
4870
|
+
enable: true
|
4871
|
+
} } = baseConfig;
|
4872
|
+
const { enable } = tooltip;
|
4873
|
+
const { groupName } = datasetReshapeInfo[0].unfoldInfo;
|
4874
|
+
const y = encoding[0]?.y || [];
|
4875
|
+
result.tooltip = {
|
4876
|
+
visible: enable,
|
4877
|
+
dimension: {
|
4878
|
+
content: [
|
4879
|
+
{
|
4880
|
+
visible: true,
|
4881
|
+
key: (datum)=>datum && datum[groupName] || '',
|
4882
|
+
value: (datum)=>{
|
4883
|
+
if (!datum) return '';
|
4884
|
+
const text = y.map((id)=>{
|
4885
|
+
const value = datum[id];
|
4886
|
+
const measure = findMeasureById(measures, id);
|
4887
|
+
if (!measure) return String(value);
|
4888
|
+
const { format = {}, autoFormat = true } = measure;
|
4889
|
+
if (!isEmpty(format)) {
|
4890
|
+
const formatter = createFormatter(format);
|
4891
|
+
return formatter(value);
|
4892
|
+
}
|
4893
|
+
if (autoFormat) return autoFormatter(value, locale);
|
4894
|
+
return String(value);
|
4895
|
+
});
|
4896
|
+
return text.join(' ~ ');
|
4897
|
+
},
|
4898
|
+
shapeType: 'rectRound'
|
4899
|
+
},
|
4900
|
+
...y.map((id)=>{
|
4901
|
+
const measure = findMeasureById(measures, id);
|
4902
|
+
return {
|
4903
|
+
visible: true,
|
4904
|
+
key: measure?.alias || id,
|
4905
|
+
value: (datum)=>{
|
4906
|
+
if (!datum) return '';
|
4907
|
+
const value = datum[id];
|
4908
|
+
const measure = findMeasureById(measures, id);
|
4909
|
+
if (!measure) return String(value);
|
4910
|
+
const { format = {}, autoFormat = true } = measure;
|
4911
|
+
if (!isEmpty(format)) {
|
4912
|
+
const formatter = createFormatter(format);
|
4913
|
+
return formatter(value);
|
4914
|
+
}
|
4915
|
+
if (autoFormat) return autoFormatter(value, locale);
|
4916
|
+
return String(value);
|
4917
|
+
},
|
4918
|
+
shapeType: 'rectRound'
|
4919
|
+
};
|
4920
|
+
})
|
4921
|
+
]
|
4922
|
+
}
|
4923
|
+
};
|
4924
|
+
return result;
|
4925
|
+
};
|
4816
4926
|
const areaRange = [
|
4817
4927
|
series([
|
4818
4928
|
initAreaRange,
|
@@ -4821,12 +4931,14 @@ const areaRange = [
|
|
4821
4931
|
initAreaRangeLine1,
|
4822
4932
|
lineStyle_lineStyle,
|
4823
4933
|
pointStyle_pointStyle,
|
4824
|
-
pointStateDimensionHover
|
4934
|
+
pointStateDimensionHover,
|
4935
|
+
tooltipDisable
|
4825
4936
|
], [
|
4826
4937
|
initAreaRangeLine2,
|
4827
4938
|
lineStyle_lineStyle,
|
4828
4939
|
pointStyle_pointStyle,
|
4829
|
-
pointStateDimensionHover
|
4940
|
+
pointStateDimensionHover,
|
4941
|
+
tooltipDisable
|
4830
4942
|
]),
|
4831
4943
|
datasetXY,
|
4832
4944
|
progressive,
|
@@ -4834,6 +4946,7 @@ const areaRange = [
|
|
4834
4946
|
xBand,
|
4835
4947
|
yLinear,
|
4836
4948
|
label_label,
|
4949
|
+
tooltipAreaRange,
|
4837
4950
|
verticalCrosshairLine,
|
4838
4951
|
annotationPoint_annotationPoint,
|
4839
4952
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -4853,12 +4966,14 @@ const pivotAreaRange = [
|
|
4853
4966
|
initAreaRangeLine1,
|
4854
4967
|
lineStyle_lineStyle,
|
4855
4968
|
pointStyle_pointStyle,
|
4856
|
-
pointStateDimensionHover
|
4969
|
+
pointStateDimensionHover,
|
4970
|
+
tooltipDisable
|
4857
4971
|
], [
|
4858
4972
|
initAreaRangeLine2,
|
4859
4973
|
lineStyle_lineStyle,
|
4860
4974
|
pointStyle_pointStyle,
|
4861
|
-
pointStateDimensionHover
|
4975
|
+
pointStateDimensionHover,
|
4976
|
+
tooltipDisable
|
4862
4977
|
]),
|
4863
4978
|
background_backgroundColor,
|
4864
4979
|
datasetXY,
|
@@ -4866,6 +4981,7 @@ const pivotAreaRange = [
|
|
4866
4981
|
xBand,
|
4867
4982
|
yLinear,
|
4868
4983
|
label_label,
|
4984
|
+
tooltipAreaRange,
|
4869
4985
|
verticalCrosshairLine,
|
4870
4986
|
annotationPoint_annotationPoint,
|
4871
4987
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -5366,7 +5482,6 @@ const initPie = (spec, context)=>{
|
|
5366
5482
|
},
|
5367
5483
|
state: {
|
5368
5484
|
hover: {
|
5369
|
-
centerOffset: 5,
|
5370
5485
|
outerRadius: 1.1 * result.outerRadius
|
5371
5486
|
}
|
5372
5487
|
}
|
@@ -6400,7 +6515,7 @@ const lightTheme = ()=>{
|
|
6400
6515
|
labelAutoHide: true,
|
6401
6516
|
labelAutoHideGap: 4,
|
6402
6517
|
labelAutoLimit: true,
|
6403
|
-
labelAutoLimitLength:
|
6518
|
+
labelAutoLimitLength: 80,
|
6404
6519
|
labelAutoRotate: false,
|
6405
6520
|
labelAutoRotateAngleRange: [
|
6406
6521
|
0,
|
@@ -6722,7 +6837,7 @@ const darkTheme = ()=>{
|
|
6722
6837
|
labelAutoHide: true,
|
6723
6838
|
labelAutoHideGap: 4,
|
6724
6839
|
labelAutoLimit: true,
|
6725
|
-
labelAutoLimitLength:
|
6840
|
+
labelAutoLimitLength: 80,
|
6726
6841
|
labelAutoRotate: false,
|
6727
6842
|
labelAutoRotateAngleRange: [
|
6728
6843
|
0,
|
@@ -7028,6 +7143,12 @@ const registerAll = ()=>{
|
|
7028
7143
|
registerLightTheme();
|
7029
7144
|
registerDarkTheme();
|
7030
7145
|
};
|
7146
|
+
const updateAdvanced = (chartType, advancedPipe)=>{
|
7147
|
+
Builder._customAdvancedPipe[chartType] = advancedPipe;
|
7148
|
+
};
|
7149
|
+
const updateSpec = (chartType, specPipe)=>{
|
7150
|
+
Builder._customSpecPipe[chartType] = specPipe;
|
7151
|
+
};
|
7031
7152
|
const zChartType = z["enum"]([
|
7032
7153
|
'table',
|
7033
7154
|
'pivotTable',
|
@@ -7718,7 +7839,9 @@ const zAnnotationVerticalLine = z.object({
|
|
7718
7839
|
backgroundBorderColor: z.string().optional(),
|
7719
7840
|
backgroundBorderWidth: z.number().default(1).optional(),
|
7720
7841
|
backgroundBorderRadius: z.number().default(4).optional(),
|
7721
|
-
backgroundPadding: z.number().optional()
|
7842
|
+
backgroundPadding: z.number().optional(),
|
7843
|
+
offsetX: z.number().default(0),
|
7844
|
+
offsetY: z.number().default(0)
|
7722
7845
|
});
|
7723
7846
|
const zAnnotationHorizontalLine = z.object({
|
7724
7847
|
selector: z.union([
|
@@ -7768,7 +7891,9 @@ const zAnnotationHorizontalLine = z.object({
|
|
7768
7891
|
backgroundBorderColor: z.string().optional(),
|
7769
7892
|
backgroundBorderWidth: z.number().default(1).optional(),
|
7770
7893
|
backgroundBorderRadius: z.number().default(4).optional(),
|
7771
|
-
backgroundPadding: z.number().optional()
|
7894
|
+
backgroundPadding: z.number().optional(),
|
7895
|
+
offsetX: z.number().default(0),
|
7896
|
+
offsetY: z.number().default(0)
|
7772
7897
|
});
|
7773
7898
|
const zAnnotationArea = z.object({
|
7774
7899
|
selector: z.union([
|
@@ -7810,7 +7935,9 @@ const zAnnotationArea = z.object({
|
|
7810
7935
|
areaBorderColor: z.number().optional(),
|
7811
7936
|
areaBorderWidth: z.number().default(2).optional(),
|
7812
7937
|
areaBorderRadius: z.number().default(4).optional(),
|
7813
|
-
outerPadding: z.number().optional()
|
7938
|
+
outerPadding: z.number().optional(),
|
7939
|
+
offsetX: z.number().optional(),
|
7940
|
+
offsetY: z.number().optional()
|
7814
7941
|
});
|
7815
7942
|
const zAnnotation = z.object({
|
7816
7943
|
annotationPoint: zAnnotationPoint.or(z.array(zAnnotationPoint)).optional(),
|
@@ -7818,7 +7945,7 @@ const zAnnotation = z.object({
|
|
7818
7945
|
annotationHorizontalLine: zAnnotationHorizontalLine.or(z.array(zAnnotationHorizontalLine)).optional(),
|
7819
7946
|
annotationArea: zAnnotationArea.or(z.array(zAnnotationArea)).optional()
|
7820
7947
|
});
|
7821
|
-
const
|
7948
|
+
const zSort = z.object({
|
7822
7949
|
order: z["enum"]([
|
7823
7950
|
'asc',
|
7824
7951
|
'desc'
|
@@ -7834,8 +7961,8 @@ const zSortLegend = z.object({
|
|
7834
7961
|
orderBy: z.string().optional(),
|
7835
7962
|
customOrder: z.array(z.any()).optional()
|
7836
7963
|
});
|
7837
|
-
const zAnalysis =
|
7838
|
-
orderMapping:
|
7964
|
+
const zAnalysis = z.object({
|
7965
|
+
orderMapping: z.record(z.string(), z.array(z.string())).optional()
|
7839
7966
|
});
|
7840
7967
|
const zLocale = z["enum"]([
|
7841
7968
|
'zh-CN',
|
@@ -7872,7 +7999,7 @@ const zLine = z.object({
|
|
7872
7999
|
xAxis: zXBandAxis.optional(),
|
7873
8000
|
yAxis: zYLinearAxis.optional(),
|
7874
8001
|
crosshairLine: zCrosshairLine.optional(),
|
7875
|
-
|
8002
|
+
sort: zSort.optional(),
|
7876
8003
|
sortLegend: zSortLegend.optional(),
|
7877
8004
|
theme: zTheme.optional(),
|
7878
8005
|
pointStyle: z.array(zPointStyle).or(zPointStyle).optional(),
|
@@ -8230,6 +8357,6 @@ const zAdvancedVSeed = z.object({
|
|
8230
8357
|
annotation: zAnnotation,
|
8231
8358
|
locale: zLocale
|
8232
8359
|
});
|
8233
|
-
export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, UnfoldDimensionGroupId, autoFormatter, autoNumFormatter, createFormatter, createNumFormatter, darkTheme, dataReshapeFor1D, dataReshapeFor1D1M, dataReshapeFor1D2M, dataReshapeFor2D1M, dataReshapeFor2D1M0Name, execPipeline, findAllDimensions, findAllMeasures, findDimensionById, findFirstDimension, findFirstMeasure, findMeasureById, foldMeasures, i18n, intl, isDimensionSelector, isMeasureSelector, isPartialDatumSelector, isPivotChart, isPivotTable, isTable, isVChart, isVTable, isValueSelector, lightTheme, preorderTraverse, registerAll, registerArea, registerAreaPercent, registerAreaRange, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerDonut, registerFunnel, registerHeatmap, registerLightTheme, registerLine, registerPie, registerPivotTable, registerRadar, registerRose, registerRoseParallel, registerScatter, registerTable, selector_selector as selector, unfoldDimensions, zAdvancedVSeed, zAnalysis, zAnnotation, zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zArea, zAreaConfig, zAreaPercent, zAreaPercentConfig, zAreaRange, zAreaRangeConfig, zAreaStyle, zAxis, zBackgroundColor, zBar, zBarConfig, zBarParallel, zBarParallelConfig, zBarPercent, zBarPercentConfig, zBarStyle, zChartType, zColor, zColorLegend, zColumn, zColumnConfig, zColumnParallel, zColumnParallelConfig, zColumnPercent, zColumnPercentConfig, zConfig, zCrosshairLine, zCrosshairRect, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensionGroup, zDimensionTree, zDimensions, zDonut, zDonutConfig, zDualAxisConfig, zEncoding, zFoldInfo, zFunnel, zFunnelConfig, zHeatmap, zHeatmapConfig, zLabel, zLegend, zLine, zLineConfig, zLineStyle, zLinearColor, zLocale, zMarkStyle, zMeasure, zMeasureGroup, zMeasureTree, zMeasures, zNumFormat, zPie, zPieConfig, zPivotTable, zPivotTableConfig, zPointStyle, zRadar, zRadarConfig, zRose, zRoseConfig, zRoseParallel, zRoseParallelConfig, zScatter, zScatterConfig,
|
8360
|
+
export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, UnfoldDimensionGroupId, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaRangeAdvancedPipeline, areaRangeSpecPipeline, areaSpecPipeline, autoFormatter, autoNumFormatter, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, createFormatter, createNumFormatter, darkTheme, dataReshapeFor1D, dataReshapeFor1D1M, dataReshapeFor1D2M, dataReshapeFor2D1M, dataReshapeFor2D1M0Name, donutAdvancedPipeline, donutSpecPipeline, execPipeline, findAllDimensions, findAllMeasures, findDimensionById, findFirstDimension, findFirstMeasure, findMeasureById, foldMeasures, funnelAdvancedPipeline, funnelSpecPipeline, heatmapAdvancedPipeline, heatmapSpecPipeline, i18n, intl, isDimensionSelector, isMeasureSelector, isPartialDatumSelector, isPivotChart, isPivotTable, isTable, isVChart, isVTable, isValueSelector, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, pivotTableAdvancedPipeline, pivotTableSpecPipeline, preorderTraverse, radarAdvancedPipeline, radarSpecPipeline, registerAll, registerArea, registerAreaPercent, registerAreaRange, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerDonut, registerFunnel, registerHeatmap, registerLightTheme, registerLine, registerPie, registerPivotTable, registerRadar, registerRose, registerRoseParallel, registerScatter, registerTable, roseAdvancedPipeline, roseParallelAdvancedPipeline, roseParallelSpecPipeline, roseSpecPipeline, scatterAdvancedPipeline, scatterSpecPipeline, selector_selector as selector, tableAdvancedPipeline, tableSpecPipeline, unfoldDimensions, updateAdvanced, updateSpec, zAdvancedVSeed, zAnalysis, zAnnotation, zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zArea, zAreaConfig, zAreaPercent, zAreaPercentConfig, zAreaRange, zAreaRangeConfig, zAreaStyle, zAxis, zBackgroundColor, zBar, zBarConfig, zBarParallel, zBarParallelConfig, zBarPercent, zBarPercentConfig, zBarStyle, zChartType, zColor, zColorLegend, zColumn, zColumnConfig, zColumnParallel, zColumnParallelConfig, zColumnPercent, zColumnPercentConfig, zConfig, zCrosshairLine, zCrosshairRect, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensionGroup, zDimensionTree, zDimensions, zDonut, zDonutConfig, zDualAxisConfig, zEncoding, zFoldInfo, zFunnel, zFunnelConfig, zHeatmap, zHeatmapConfig, zLabel, zLegend, zLine, zLineConfig, zLineStyle, zLinearColor, zLocale, zMarkStyle, zMeasure, zMeasureGroup, zMeasureTree, zMeasures, zNumFormat, zPie, zPieConfig, zPivotTable, zPivotTableConfig, zPointStyle, zRadar, zRadarConfig, zRose, zRoseConfig, zRoseParallel, zRoseParallelConfig, zScatter, zScatterConfig, zSort, zSortLegend, zStackCornerRadius, zTable, zTableConfig, zTheme, zTooltip, zUnfoldInfo, zVSeed, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
|
8234
8361
|
|
8235
8362
|
//# sourceMappingURL=index.js.map
|