@visactor/vseed 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +456 -370
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +456 -370
- package/dist/index.js.map +1 -1
- package/dist/pipeline/spec/chart/pipes/color/colorCellStyleFill.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/color/colorFunnelStyleFill.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/color/colorPieStyleFill.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/color/colorRoseStyleFill.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/color/index.d.ts +4 -0
- package/dist/pipeline/spec/chart/pipes/markStyle/cellStyle.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/markStyle/funnelStyle.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/markStyle/index.d.ts +5 -1
- package/dist/pipeline/spec/chart/pipes/markStyle/pieStyle.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/markStyle/roseStyle.d.ts +2 -0
- package/dist/umd/index.js +456 -370
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -1291,8 +1291,7 @@ const getBasicDimensions = (vseed)=>{
|
|
1291
1291
|
const { dimensions, dataset } = vseed;
|
1292
1292
|
const MeaName = {
|
1293
1293
|
id: MeasureName,
|
1294
|
-
alias: intl.i18n
|
1295
|
-
encoding: 'detail'
|
1294
|
+
alias: intl.i18n`指标名称`
|
1296
1295
|
};
|
1297
1296
|
if (!dataset) throw new Error('dataset is required');
|
1298
1297
|
if (0 === dataset.length) return [];
|
@@ -1377,12 +1376,11 @@ const generateDefaultMeasureEncoding = (measures, encoding)=>{
|
|
1377
1376
|
encoding.y = (0, external_remeda_namespaceObject.unique)(measures.filter((item)=>'yAxis' === item.encoding || !item.encoding).map((item)=>item.id));
|
1378
1377
|
};
|
1379
1378
|
const generateDefaultDimensionEncoding = (dimensions, encoding)=>{
|
1380
|
-
const onlyMeasureName = 1 === dimensions.length && dimensions.find((item)=>item.id === MeasureName);
|
1381
1379
|
const uniqueDimIds = (0, external_remeda_namespaceObject.unique)(dimensions.map((d)=>d.id));
|
1382
1380
|
encoding.x = uniqueDimIds.slice(0, 1);
|
1383
|
-
encoding.color = uniqueDimIds.slice(
|
1384
|
-
encoding.detail = uniqueDimIds.slice(onlyMeasureName ? 0 : 1);
|
1381
|
+
encoding.color = uniqueDimIds.slice(1);
|
1385
1382
|
encoding.tooltip = uniqueDimIds;
|
1383
|
+
encoding.detail = [];
|
1386
1384
|
encoding.label = [];
|
1387
1385
|
encoding.row = [];
|
1388
1386
|
encoding.column = [];
|
@@ -1394,14 +1392,13 @@ const generateMeasureEncoding = (measures, encoding)=>{
|
|
1394
1392
|
if (color.length > 0) encoding.color = color;
|
1395
1393
|
};
|
1396
1394
|
const generateDimensionEncoding = (dimensions, encoding)=>{
|
1397
|
-
encoding.x = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'xAxis' === item.encoding
|
1395
|
+
encoding.x = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'xAxis' === item.encoding).map((item)=>item.id));
|
1398
1396
|
encoding.color = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
1399
|
-
encoding.detail =
|
1397
|
+
encoding.detail = [];
|
1400
1398
|
if (0 === encoding.x.length) encoding.x = [
|
1401
1399
|
dimensions[0].id
|
1402
1400
|
];
|
1403
1401
|
if (0 === encoding.color.length) encoding.color = dimensions.filter((item)=>!encoding.x?.includes(item.id)).map((item)=>item.id);
|
1404
|
-
if (0 === encoding.detail.length) encoding.detail = dimensions.filter((item)=>!encoding.x?.includes(item.id)).map((item)=>item.id);
|
1405
1402
|
};
|
1406
1403
|
const measureDepth = (measures = [])=>{
|
1407
1404
|
if (!measures) return 0;
|
@@ -2293,117 +2290,6 @@ const yLinear = (spec, context)=>{
|
|
2293
2290
|
];
|
2294
2291
|
return result;
|
2295
2292
|
};
|
2296
|
-
const label_label = (spec, context)=>{
|
2297
|
-
const result = {
|
2298
|
-
...spec
|
2299
|
-
};
|
2300
|
-
const { advancedVSeed } = context;
|
2301
|
-
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
2302
|
-
const { chartType } = advancedVSeed;
|
2303
|
-
const baseConfig = advancedVSeed.config[chartType];
|
2304
|
-
if (!baseConfig || !baseConfig.label) return result;
|
2305
|
-
const { measureId, measureValue } = datasetReshapeInfo[0].foldInfo;
|
2306
|
-
const { label } = baseConfig;
|
2307
|
-
const { enable } = label;
|
2308
|
-
result.label = {
|
2309
|
-
visible: enable,
|
2310
|
-
formatMethod: (value, datum)=>{
|
2311
|
-
const result = [];
|
2312
|
-
const formatValue = (value)=>{
|
2313
|
-
const id = datum[measureId];
|
2314
|
-
const measure = findMeasureById(measures, id);
|
2315
|
-
if (!measure) return value;
|
2316
|
-
const { format = {}, autoFormat = true } = measure;
|
2317
|
-
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
2318
|
-
const formatter = createFormatter(format);
|
2319
|
-
return formatter(value);
|
2320
|
-
}
|
2321
|
-
if (autoFormat) return autoFormatter(value, locale);
|
2322
|
-
return String(value);
|
2323
|
-
};
|
2324
|
-
result.push(formatValue(datum[measureValue]));
|
2325
|
-
return result.join(' ');
|
2326
|
-
}
|
2327
|
-
};
|
2328
|
-
return result;
|
2329
|
-
};
|
2330
|
-
const tooltip_tooltip = (spec, context)=>{
|
2331
|
-
const result = {
|
2332
|
-
...spec
|
2333
|
-
};
|
2334
|
-
const { advancedVSeed } = context;
|
2335
|
-
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
2336
|
-
const baseConfig = advancedVSeed.config[chartType];
|
2337
|
-
const { tooltip = {
|
2338
|
-
enable: true
|
2339
|
-
} } = baseConfig;
|
2340
|
-
const { enable } = tooltip;
|
2341
|
-
const { measureId, measureValue, measureName } = datasetReshapeInfo[0].foldInfo;
|
2342
|
-
const { encodingColor: colorName } = datasetReshapeInfo[0].unfoldInfo;
|
2343
|
-
result.tooltip = {
|
2344
|
-
visible: enable,
|
2345
|
-
mark: {
|
2346
|
-
title: {
|
2347
|
-
visible: true
|
2348
|
-
},
|
2349
|
-
content: [
|
2350
|
-
...dimensions.map((item)=>({
|
2351
|
-
visible: true,
|
2352
|
-
hasShape: true,
|
2353
|
-
shapeType: 'rectRound',
|
2354
|
-
key: (datum)=>{
|
2355
|
-
if (item.alias || item.id) return item.alias || item.id;
|
2356
|
-
return datum && datum[item.id];
|
2357
|
-
},
|
2358
|
-
value: (datum)=>datum && datum[item.id]
|
2359
|
-
})),
|
2360
|
-
{
|
2361
|
-
visible: true,
|
2362
|
-
hasShape: true,
|
2363
|
-
key: (datum)=>datum && datum[measureName || colorName] || '',
|
2364
|
-
value: (datum)=>{
|
2365
|
-
if (!datum) return '';
|
2366
|
-
const value = datum[measureValue];
|
2367
|
-
const id = datum[measureId];
|
2368
|
-
const measure = findMeasureById(measures, id);
|
2369
|
-
if (!measure) return String(value);
|
2370
|
-
const { format = {}, autoFormat = true } = measure;
|
2371
|
-
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
2372
|
-
const formatter = createFormatter(format);
|
2373
|
-
return formatter(value);
|
2374
|
-
}
|
2375
|
-
if (autoFormat) return autoFormatter(value, locale);
|
2376
|
-
return String(value);
|
2377
|
-
}
|
2378
|
-
}
|
2379
|
-
]
|
2380
|
-
},
|
2381
|
-
dimension: {
|
2382
|
-
content: [
|
2383
|
-
{
|
2384
|
-
visible: true,
|
2385
|
-
key: (datum)=>datum && datum[colorName] || '',
|
2386
|
-
value: (datum)=>{
|
2387
|
-
if (!datum) return '';
|
2388
|
-
const value = datum[measureValue];
|
2389
|
-
const id = datum[measureId];
|
2390
|
-
const measure = findMeasureById(measures, id);
|
2391
|
-
if (!measure) return String(value);
|
2392
|
-
const { format = {}, autoFormat = true } = measure;
|
2393
|
-
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
2394
|
-
const formatter = createFormatter(format);
|
2395
|
-
return formatter(value);
|
2396
|
-
}
|
2397
|
-
if (autoFormat) return autoFormatter(value, locale);
|
2398
|
-
return String(value);
|
2399
|
-
},
|
2400
|
-
shapeType: 'rectRound'
|
2401
|
-
}
|
2402
|
-
]
|
2403
|
-
}
|
2404
|
-
};
|
2405
|
-
return result;
|
2406
|
-
};
|
2407
2293
|
const verticalCrosshairLine = (spec, context)=>{
|
2408
2294
|
const result = {
|
2409
2295
|
...spec
|
@@ -2912,6 +2798,117 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2912
2798
|
}
|
2913
2799
|
};
|
2914
2800
|
};
|
2801
|
+
const label_label = (spec, context)=>{
|
2802
|
+
const result = {
|
2803
|
+
...spec
|
2804
|
+
};
|
2805
|
+
const { advancedVSeed } = context;
|
2806
|
+
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
2807
|
+
const { chartType } = advancedVSeed;
|
2808
|
+
const baseConfig = advancedVSeed.config[chartType];
|
2809
|
+
if (!baseConfig || !baseConfig.label) return result;
|
2810
|
+
const { measureId, measureValue } = datasetReshapeInfo[0].foldInfo;
|
2811
|
+
const { label } = baseConfig;
|
2812
|
+
const { enable } = label;
|
2813
|
+
result.label = {
|
2814
|
+
visible: enable,
|
2815
|
+
formatMethod: (value, datum)=>{
|
2816
|
+
const result = [];
|
2817
|
+
const formatValue = (value)=>{
|
2818
|
+
const id = datum[measureId];
|
2819
|
+
const measure = findMeasureById(measures, id);
|
2820
|
+
if (!measure) return value;
|
2821
|
+
const { format = {}, autoFormat = true } = measure;
|
2822
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
2823
|
+
const formatter = createFormatter(format);
|
2824
|
+
return formatter(value);
|
2825
|
+
}
|
2826
|
+
if (autoFormat) return autoFormatter(value, locale);
|
2827
|
+
return String(value);
|
2828
|
+
};
|
2829
|
+
result.push(formatValue(datum[measureValue]));
|
2830
|
+
return result.join(' ');
|
2831
|
+
}
|
2832
|
+
};
|
2833
|
+
return result;
|
2834
|
+
};
|
2835
|
+
const tooltip_tooltip = (spec, context)=>{
|
2836
|
+
const result = {
|
2837
|
+
...spec
|
2838
|
+
};
|
2839
|
+
const { advancedVSeed } = context;
|
2840
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
2841
|
+
const baseConfig = advancedVSeed.config[chartType];
|
2842
|
+
const { tooltip = {
|
2843
|
+
enable: true
|
2844
|
+
} } = baseConfig;
|
2845
|
+
const { enable } = tooltip;
|
2846
|
+
const { measureId, measureValue, measureName } = datasetReshapeInfo[0].foldInfo;
|
2847
|
+
const { encodingColor: colorName } = datasetReshapeInfo[0].unfoldInfo;
|
2848
|
+
result.tooltip = {
|
2849
|
+
visible: enable,
|
2850
|
+
mark: {
|
2851
|
+
title: {
|
2852
|
+
visible: true
|
2853
|
+
},
|
2854
|
+
content: [
|
2855
|
+
...dimensions.map((item)=>({
|
2856
|
+
visible: true,
|
2857
|
+
hasShape: true,
|
2858
|
+
shapeType: 'rectRound',
|
2859
|
+
key: (datum)=>{
|
2860
|
+
if (item.alias || item.id) return item.alias || item.id;
|
2861
|
+
return datum && datum[item.id];
|
2862
|
+
},
|
2863
|
+
value: (datum)=>datum && datum[item.id]
|
2864
|
+
})),
|
2865
|
+
{
|
2866
|
+
visible: true,
|
2867
|
+
hasShape: true,
|
2868
|
+
key: (datum)=>datum && datum[measureName || colorName] || '',
|
2869
|
+
value: (datum)=>{
|
2870
|
+
if (!datum) return '';
|
2871
|
+
const value = datum[measureValue];
|
2872
|
+
const id = datum[measureId];
|
2873
|
+
const measure = findMeasureById(measures, id);
|
2874
|
+
if (!measure) return String(value);
|
2875
|
+
const { format = {}, autoFormat = true } = measure;
|
2876
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
2877
|
+
const formatter = createFormatter(format);
|
2878
|
+
return formatter(value);
|
2879
|
+
}
|
2880
|
+
if (autoFormat) return autoFormatter(value, locale);
|
2881
|
+
return String(value);
|
2882
|
+
}
|
2883
|
+
}
|
2884
|
+
]
|
2885
|
+
},
|
2886
|
+
dimension: {
|
2887
|
+
content: [
|
2888
|
+
{
|
2889
|
+
visible: true,
|
2890
|
+
key: (datum)=>datum && datum[colorName] || '',
|
2891
|
+
value: (datum)=>{
|
2892
|
+
if (!datum) return '';
|
2893
|
+
const value = datum[measureValue];
|
2894
|
+
const id = datum[measureId];
|
2895
|
+
const measure = findMeasureById(measures, id);
|
2896
|
+
if (!measure) return String(value);
|
2897
|
+
const { format = {}, autoFormat = true } = measure;
|
2898
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
2899
|
+
const formatter = createFormatter(format);
|
2900
|
+
return formatter(value);
|
2901
|
+
}
|
2902
|
+
if (autoFormat) return autoFormatter(value, locale);
|
2903
|
+
return String(value);
|
2904
|
+
},
|
2905
|
+
shapeType: 'rectRound'
|
2906
|
+
}
|
2907
|
+
]
|
2908
|
+
}
|
2909
|
+
};
|
2910
|
+
return result;
|
2911
|
+
};
|
2915
2912
|
const isSubset = (sub, obj)=>Object.entries(sub).every(([key, value])=>{
|
2916
2913
|
if ('string' == typeof value) return obj[key] === value;
|
2917
2914
|
if ('number' == typeof value) return obj[key] === value;
|
@@ -3670,31 +3667,118 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3670
3667
|
legends
|
3671
3668
|
};
|
3672
3669
|
};
|
3673
|
-
const
|
3674
|
-
|
3675
|
-
|
3676
|
-
if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
|
3677
|
-
return execPipeline(pipeline, context, spec);
|
3670
|
+
const pivotColorLegend = (spec, context)=>{
|
3671
|
+
const result = {
|
3672
|
+
...spec
|
3678
3673
|
};
|
3679
|
-
const
|
3680
|
-
|
3681
|
-
|
3682
|
-
|
3683
|
-
|
3684
|
-
|
3685
|
-
|
3686
|
-
|
3687
|
-
|
3688
|
-
|
3689
|
-
|
3690
|
-
|
3691
|
-
|
3692
|
-
|
3693
|
-
|
3694
|
-
|
3695
|
-
|
3696
|
-
|
3697
|
-
|
3674
|
+
const { advancedVSeed } = context;
|
3675
|
+
const { chartType } = advancedVSeed;
|
3676
|
+
const baseConfig = advancedVSeed.config[chartType];
|
3677
|
+
if (!baseConfig || !baseConfig.legend) return result;
|
3678
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
3679
|
+
const max = Math.max(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[1]));
|
3680
|
+
const min = Math.min(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[0]));
|
3681
|
+
const { legend, color } = baseConfig;
|
3682
|
+
const { colorScheme, linearColorScheme } = color;
|
3683
|
+
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400 } = legend || {};
|
3684
|
+
const orient = [
|
3685
|
+
'bottom',
|
3686
|
+
'bottomLeft',
|
3687
|
+
'bottomRight',
|
3688
|
+
'bl',
|
3689
|
+
'br'
|
3690
|
+
].includes(position) ? 'bottom' : [
|
3691
|
+
'top',
|
3692
|
+
'topLeft',
|
3693
|
+
'topRight',
|
3694
|
+
'tl',
|
3695
|
+
'tr'
|
3696
|
+
].includes(position) ? 'top' : [
|
3697
|
+
'left',
|
3698
|
+
'leftTop',
|
3699
|
+
'leftBottom',
|
3700
|
+
'lt',
|
3701
|
+
'lb'
|
3702
|
+
].includes(position) ? 'left' : 'right';
|
3703
|
+
const legendPosition = [
|
3704
|
+
'topLeft',
|
3705
|
+
'bottomLeft',
|
3706
|
+
'leftTop',
|
3707
|
+
'rightTop',
|
3708
|
+
'lt',
|
3709
|
+
'rt',
|
3710
|
+
'tl',
|
3711
|
+
'bl'
|
3712
|
+
].includes(position) ? 'start' : [
|
3713
|
+
'topRight',
|
3714
|
+
'bottomRight',
|
3715
|
+
'leftBottom',
|
3716
|
+
'rightBottom',
|
3717
|
+
'lb',
|
3718
|
+
'rb',
|
3719
|
+
'rt',
|
3720
|
+
'br'
|
3721
|
+
].includes(position) ? 'end' : 'middle';
|
3722
|
+
const legends = {
|
3723
|
+
visible: enable,
|
3724
|
+
type: 'color',
|
3725
|
+
orient,
|
3726
|
+
position: legendPosition,
|
3727
|
+
colors: linearColorScheme || colorScheme || [],
|
3728
|
+
value: [
|
3729
|
+
min,
|
3730
|
+
max
|
3731
|
+
],
|
3732
|
+
min: min,
|
3733
|
+
max: max,
|
3734
|
+
maxWidth: '30%',
|
3735
|
+
startText: {
|
3736
|
+
visible: true,
|
3737
|
+
style: {
|
3738
|
+
fill: labelFontColor,
|
3739
|
+
fontSize: labelFontSize,
|
3740
|
+
fontWeight: labelFontWeight
|
3741
|
+
}
|
3742
|
+
},
|
3743
|
+
endText: {
|
3744
|
+
visible: true,
|
3745
|
+
style: {
|
3746
|
+
fill: labelFontColor,
|
3747
|
+
fontSize: labelFontSize,
|
3748
|
+
fontWeight: labelFontWeight
|
3749
|
+
}
|
3750
|
+
}
|
3751
|
+
};
|
3752
|
+
return {
|
3753
|
+
...result,
|
3754
|
+
legends
|
3755
|
+
};
|
3756
|
+
};
|
3757
|
+
const pivotAdapter_pivotAdapter = (pipeline, pivotPipeline)=>(spec, context)=>{
|
3758
|
+
const { vseed } = context;
|
3759
|
+
const usePivotChart = isPivotChart(vseed);
|
3760
|
+
if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
|
3761
|
+
return execPipeline(pipeline, context, spec);
|
3762
|
+
};
|
3763
|
+
const line_line = [
|
3764
|
+
initLine,
|
3765
|
+
colorAdapter(color_color, linearColor),
|
3766
|
+
background_backgroundColor,
|
3767
|
+
datasetXY,
|
3768
|
+
progressive,
|
3769
|
+
xBand,
|
3770
|
+
yLinear,
|
3771
|
+
verticalCrosshairLine,
|
3772
|
+
colorAdapter(discreteLegend, colorLegend),
|
3773
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
3774
|
+
pointStateDimensionHover,
|
3775
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
3776
|
+
label_label,
|
3777
|
+
tooltip_tooltip,
|
3778
|
+
annotationPoint_annotationPoint,
|
3779
|
+
annotationVerticalLine_annotationVerticalLine,
|
3780
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3781
|
+
annotationArea_annotationArea
|
3698
3782
|
];
|
3699
3783
|
const pivotLine = [
|
3700
3784
|
initPivot,
|
@@ -3703,18 +3787,18 @@ const pivotLine = [
|
|
3703
3787
|
datasetPivot,
|
3704
3788
|
pivotIndicators_pivotIndicators([
|
3705
3789
|
initLine,
|
3706
|
-
color_color,
|
3790
|
+
colorAdapter(color_color, linearColor),
|
3707
3791
|
background_backgroundColor,
|
3708
3792
|
datasetXY,
|
3709
3793
|
progressive,
|
3710
3794
|
xBand,
|
3711
3795
|
yLinear,
|
3712
|
-
label_label,
|
3713
|
-
tooltip_tooltip,
|
3714
3796
|
verticalCrosshairLine,
|
3715
|
-
pointStyle_pointStyle,
|
3797
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
3716
3798
|
pointStateDimensionHover,
|
3717
|
-
lineStyle_lineStyle,
|
3799
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
3800
|
+
label_label,
|
3801
|
+
tooltip_tooltip,
|
3718
3802
|
annotationPoint_annotationPoint,
|
3719
3803
|
annotationVerticalLine_annotationVerticalLine,
|
3720
3804
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -3722,7 +3806,7 @@ const pivotLine = [
|
|
3722
3806
|
]),
|
3723
3807
|
pivotRowDimensions,
|
3724
3808
|
pivotColumnDimensions,
|
3725
|
-
pivotDiscreteLegend
|
3809
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
3726
3810
|
];
|
3727
3811
|
const lineSpecPipeline = [
|
3728
3812
|
pivotAdapter_pivotAdapter(line_line, pivotLine)
|
@@ -3771,7 +3855,7 @@ const column_generateMeasureEncoding = (measures, encoding)=>{
|
|
3771
3855
|
return encoding;
|
3772
3856
|
};
|
3773
3857
|
const column_generateDimensionEncoding = (dimensions, encoding)=>{
|
3774
|
-
encoding.x = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'xAxis' === item.encoding
|
3858
|
+
encoding.x = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'xAxis' === item.encoding).map((item)=>item.id));
|
3775
3859
|
encoding.color = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
3776
3860
|
encoding.detail = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
3777
3861
|
if (0 === encoding.x.length) encoding.x = [
|
@@ -4087,93 +4171,6 @@ const annotationAreaBand = (spec, context)=>{
|
|
4087
4171
|
markArea: markArea
|
4088
4172
|
};
|
4089
4173
|
};
|
4090
|
-
const pivotColorLegend = (spec, context)=>{
|
4091
|
-
const result = {
|
4092
|
-
...spec
|
4093
|
-
};
|
4094
|
-
const { advancedVSeed } = context;
|
4095
|
-
const { chartType } = advancedVSeed;
|
4096
|
-
const baseConfig = advancedVSeed.config[chartType];
|
4097
|
-
if (!baseConfig || !baseConfig.legend) return result;
|
4098
|
-
const { datasetReshapeInfo } = advancedVSeed;
|
4099
|
-
const max = Math.max(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[1]));
|
4100
|
-
const min = Math.min(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[0]));
|
4101
|
-
const { legend, color } = baseConfig;
|
4102
|
-
const { colorScheme, linearColorScheme } = color;
|
4103
|
-
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400 } = legend || {};
|
4104
|
-
const orient = [
|
4105
|
-
'bottom',
|
4106
|
-
'bottomLeft',
|
4107
|
-
'bottomRight',
|
4108
|
-
'bl',
|
4109
|
-
'br'
|
4110
|
-
].includes(position) ? 'bottom' : [
|
4111
|
-
'top',
|
4112
|
-
'topLeft',
|
4113
|
-
'topRight',
|
4114
|
-
'tl',
|
4115
|
-
'tr'
|
4116
|
-
].includes(position) ? 'top' : [
|
4117
|
-
'left',
|
4118
|
-
'leftTop',
|
4119
|
-
'leftBottom',
|
4120
|
-
'lt',
|
4121
|
-
'lb'
|
4122
|
-
].includes(position) ? 'left' : 'right';
|
4123
|
-
const legendPosition = [
|
4124
|
-
'topLeft',
|
4125
|
-
'bottomLeft',
|
4126
|
-
'leftTop',
|
4127
|
-
'rightTop',
|
4128
|
-
'lt',
|
4129
|
-
'rt',
|
4130
|
-
'tl',
|
4131
|
-
'bl'
|
4132
|
-
].includes(position) ? 'start' : [
|
4133
|
-
'topRight',
|
4134
|
-
'bottomRight',
|
4135
|
-
'leftBottom',
|
4136
|
-
'rightBottom',
|
4137
|
-
'lb',
|
4138
|
-
'rb',
|
4139
|
-
'rt',
|
4140
|
-
'br'
|
4141
|
-
].includes(position) ? 'end' : 'middle';
|
4142
|
-
const legends = {
|
4143
|
-
visible: enable,
|
4144
|
-
type: 'color',
|
4145
|
-
orient,
|
4146
|
-
position: legendPosition,
|
4147
|
-
colors: linearColorScheme || colorScheme || [],
|
4148
|
-
value: [
|
4149
|
-
min,
|
4150
|
-
max
|
4151
|
-
],
|
4152
|
-
min: min,
|
4153
|
-
max: max,
|
4154
|
-
maxWidth: '30%',
|
4155
|
-
startText: {
|
4156
|
-
visible: true,
|
4157
|
-
style: {
|
4158
|
-
fill: labelFontColor,
|
4159
|
-
fontSize: labelFontSize,
|
4160
|
-
fontWeight: labelFontWeight
|
4161
|
-
}
|
4162
|
-
},
|
4163
|
-
endText: {
|
4164
|
-
visible: true,
|
4165
|
-
style: {
|
4166
|
-
fill: labelFontColor,
|
4167
|
-
fontSize: labelFontSize,
|
4168
|
-
fontWeight: labelFontWeight
|
4169
|
-
}
|
4170
|
-
}
|
4171
|
-
};
|
4172
|
-
return {
|
4173
|
-
...result,
|
4174
|
-
legends
|
4175
|
-
};
|
4176
|
-
};
|
4177
4174
|
const column = [
|
4178
4175
|
initColumn,
|
4179
4176
|
stackCornerRadius_stackCornerRadius,
|
@@ -4447,7 +4444,7 @@ const bar_generateMeasureEncoding = (measures, encoding)=>{
|
|
4447
4444
|
return encoding;
|
4448
4445
|
};
|
4449
4446
|
const bar_generateDimensionEncoding = (dimensions, encoding)=>{
|
4450
|
-
encoding.y = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'yAxis' === item.encoding
|
4447
|
+
encoding.y = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'yAxis' === item.encoding).map((item)=>item.id));
|
4451
4448
|
encoding.color = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
4452
4449
|
encoding.detail = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
4453
4450
|
if (0 === encoding.y.length) encoding.y = [
|
@@ -4994,7 +4991,7 @@ const registerBarPercent = ()=>{
|
|
4994
4991
|
};
|
4995
4992
|
const areaAdvancedPipeline = [
|
4996
4993
|
initAdvancedVSeed_initAdvancedVSeed,
|
4997
|
-
|
4994
|
+
encodingForLine,
|
4998
4995
|
buildMeasures,
|
4999
4996
|
autoDimensions_autoDimensions,
|
5000
4997
|
pivotAdapter([
|
@@ -5152,7 +5149,7 @@ const registerArea = ()=>{
|
|
5152
5149
|
};
|
5153
5150
|
const areaPercentAdvancedPipeline = [
|
5154
5151
|
initAdvancedVSeed_initAdvancedVSeed,
|
5155
|
-
|
5152
|
+
encodingForLine,
|
5156
5153
|
buildMeasures,
|
5157
5154
|
autoDimensions_autoDimensions,
|
5158
5155
|
pivotAdapter([
|
@@ -5639,7 +5636,7 @@ const pivotScatter = [
|
|
5639
5636
|
]),
|
5640
5637
|
pivotRowDimensions,
|
5641
5638
|
pivotColumnDimensions,
|
5642
|
-
pivotDiscreteLegend
|
5639
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
5643
5640
|
];
|
5644
5641
|
const scatterSpecPipeline = [
|
5645
5642
|
pivotAdapter_pivotAdapter(scatter, pivotScatter)
|
@@ -5688,7 +5685,7 @@ const dualAxis_generateMeasureEncoding = (measures, encoding)=>{
|
|
5688
5685
|
return encoding;
|
5689
5686
|
};
|
5690
5687
|
const dualAxis_generateDimensionEncoding = (dimensions, encoding)=>{
|
5691
|
-
encoding.x = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'xAxis' === item.encoding
|
5688
|
+
encoding.x = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'xAxis' === item.encoding).map((item)=>item.id));
|
5692
5689
|
encoding.color = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
5693
5690
|
encoding.detail = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
5694
5691
|
if (0 === encoding.x.length) encoding.x = [
|
@@ -6842,9 +6839,8 @@ const initPie = (spec, context)=>{
|
|
6842
6839
|
...spec
|
6843
6840
|
};
|
6844
6841
|
const { advancedVSeed } = context;
|
6845
|
-
const { datasetReshapeInfo
|
6842
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6846
6843
|
const { unfoldInfo, foldInfo } = datasetReshapeInfo[0];
|
6847
|
-
const showStroke = dataset.length <= 30;
|
6848
6844
|
result.type = 'pie';
|
6849
6845
|
result.outerRadius = 0.8;
|
6850
6846
|
result.innerRadius = 0;
|
@@ -6856,30 +6852,57 @@ const initPie = (spec, context)=>{
|
|
6856
6852
|
clip: true
|
6857
6853
|
}
|
6858
6854
|
];
|
6859
|
-
result.
|
6860
|
-
|
6861
|
-
|
6862
|
-
|
6863
|
-
|
6864
|
-
}
|
6865
|
-
|
6866
|
-
|
6867
|
-
|
6855
|
+
result.animation = true;
|
6856
|
+
return result;
|
6857
|
+
};
|
6858
|
+
const colorPieStyleFill = (stylePipe)=>(spec, context)=>{
|
6859
|
+
const result = stylePipe(spec, context);
|
6860
|
+
const { advancedVSeed } = context;
|
6861
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6862
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
6863
|
+
if (isLinearColor(advancedVSeed)) {
|
6864
|
+
if (result?.pie?.style) result.pie.style.fill = {
|
6865
|
+
field: unfoldInfo.encodingColor,
|
6866
|
+
scale: 'color'
|
6867
|
+
};
|
6868
|
+
}
|
6869
|
+
return result;
|
6870
|
+
};
|
6871
|
+
const pieStyle = (spec, context)=>{
|
6872
|
+
const { advancedVSeed } = context;
|
6873
|
+
const { dataset } = advancedVSeed;
|
6874
|
+
const showStroke = dataset.length <= 30;
|
6875
|
+
const result = {
|
6876
|
+
...spec,
|
6877
|
+
pie: {
|
6878
|
+
style: {}
|
6879
|
+
}
|
6880
|
+
};
|
6881
|
+
return {
|
6882
|
+
...result,
|
6883
|
+
pie: {
|
6884
|
+
style: {
|
6885
|
+
stroke: '#ffffff',
|
6886
|
+
lineWidth: showStroke ? 1 : 0
|
6887
|
+
},
|
6888
|
+
state: {
|
6889
|
+
hover: {
|
6890
|
+
outerRadius: 1.1 * result.outerRadius
|
6891
|
+
}
|
6868
6892
|
}
|
6869
6893
|
}
|
6870
6894
|
};
|
6871
|
-
result.animation = true;
|
6872
|
-
return result;
|
6873
6895
|
};
|
6874
6896
|
const pie = [
|
6875
6897
|
initPie,
|
6876
|
-
color_color,
|
6898
|
+
colorAdapter(color_color, linearColor),
|
6877
6899
|
background_backgroundColor,
|
6878
6900
|
datasetXY,
|
6879
6901
|
progressive,
|
6902
|
+
colorPieStyleFill(pieStyle),
|
6903
|
+
colorAdapter(discreteLegend, colorLegend),
|
6880
6904
|
label_label,
|
6881
6905
|
tooltip_tooltip,
|
6882
|
-
discreteLegend,
|
6883
6906
|
annotationPoint_annotationPoint,
|
6884
6907
|
annotationVerticalLine_annotationVerticalLine,
|
6885
6908
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -6892,10 +6915,11 @@ const pivotPie = [
|
|
6892
6915
|
datasetPivot,
|
6893
6916
|
pivotIndicators_pivotIndicators([
|
6894
6917
|
initPie,
|
6895
|
-
color_color,
|
6918
|
+
colorAdapter(color_color, linearColor),
|
6896
6919
|
background_backgroundColor,
|
6897
6920
|
datasetXY,
|
6898
6921
|
progressive,
|
6922
|
+
colorPieStyleFill(pieStyle),
|
6899
6923
|
label_label,
|
6900
6924
|
tooltip_tooltip,
|
6901
6925
|
annotationPoint_annotationPoint,
|
@@ -6905,7 +6929,7 @@ const pivotPie = [
|
|
6905
6929
|
]),
|
6906
6930
|
pivotRowDimensions,
|
6907
6931
|
pivotColumnDimensions,
|
6908
|
-
pivotDiscreteLegend
|
6932
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
6909
6933
|
];
|
6910
6934
|
const pieSpecPipeline = [
|
6911
6935
|
pivotAdapter_pivotAdapter(pie, pivotPie)
|
@@ -6933,9 +6957,8 @@ const initDonut = (spec, context)=>{
|
|
6933
6957
|
...spec
|
6934
6958
|
};
|
6935
6959
|
const { advancedVSeed } = context;
|
6936
|
-
const { datasetReshapeInfo
|
6960
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6937
6961
|
const { foldInfo, unfoldInfo } = datasetReshapeInfo[0];
|
6938
|
-
const showStroke = dataset.length <= 30;
|
6939
6962
|
result.type = 'pie';
|
6940
6963
|
result.outerRadius = 0.8;
|
6941
6964
|
result.innerRadius = 0.8 * result.outerRadius;
|
@@ -6947,29 +6970,19 @@ const initDonut = (spec, context)=>{
|
|
6947
6970
|
clip: true
|
6948
6971
|
}
|
6949
6972
|
];
|
6950
|
-
result.pie = {
|
6951
|
-
style: {
|
6952
|
-
stroke: '#ffffff',
|
6953
|
-
lineWidth: showStroke ? 1 : 0
|
6954
|
-
},
|
6955
|
-
state: {
|
6956
|
-
hover: {
|
6957
|
-
outerRadius: 1.1 * result.outerRadius
|
6958
|
-
}
|
6959
|
-
}
|
6960
|
-
};
|
6961
6973
|
result.animation = true;
|
6962
6974
|
return result;
|
6963
6975
|
};
|
6964
6976
|
const donut = [
|
6965
6977
|
initDonut,
|
6966
|
-
color_color,
|
6978
|
+
colorAdapter(color_color, linearColor),
|
6967
6979
|
background_backgroundColor,
|
6968
6980
|
datasetXY,
|
6969
6981
|
progressive,
|
6970
6982
|
label_label,
|
6983
|
+
colorPieStyleFill(pieStyle),
|
6984
|
+
colorAdapter(discreteLegend, colorLegend),
|
6971
6985
|
tooltip_tooltip,
|
6972
|
-
discreteLegend,
|
6973
6986
|
annotationPoint_annotationPoint,
|
6974
6987
|
annotationVerticalLine_annotationVerticalLine,
|
6975
6988
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -6982,11 +6995,12 @@ const pivotDonut = [
|
|
6982
6995
|
datasetPivot,
|
6983
6996
|
pivotIndicators_pivotIndicators([
|
6984
6997
|
initDonut,
|
6985
|
-
color_color,
|
6998
|
+
colorAdapter(color_color, linearColor),
|
6986
6999
|
background_backgroundColor,
|
6987
7000
|
datasetXY,
|
6988
7001
|
progressive,
|
6989
7002
|
label_label,
|
7003
|
+
colorPieStyleFill(pieStyle),
|
6990
7004
|
tooltip_tooltip,
|
6991
7005
|
annotationPoint_annotationPoint,
|
6992
7006
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -6995,7 +7009,7 @@ const pivotDonut = [
|
|
6995
7009
|
]),
|
6996
7010
|
pivotRowDimensions,
|
6997
7011
|
pivotColumnDimensions,
|
6998
|
-
pivotDiscreteLegend
|
7012
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
6999
7013
|
];
|
7000
7014
|
const donutSpecPipeline = [
|
7001
7015
|
pivotAdapter_pivotAdapter(donut, pivotDonut)
|
@@ -7043,7 +7057,7 @@ const rose_generateMeasureEncoding = (measures, encoding)=>{
|
|
7043
7057
|
if (color.length > 0) encoding.color = color;
|
7044
7058
|
};
|
7045
7059
|
const rose_generateDimensionEncoding = (dimensions, encoding)=>{
|
7046
|
-
encoding.angle = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'angle' === item.encoding
|
7060
|
+
encoding.angle = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'angle' === item.encoding).map((item)=>item.id));
|
7047
7061
|
encoding.color = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
7048
7062
|
encoding.detail = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
7049
7063
|
if (0 === encoding.angle.length) encoding.angle = [
|
@@ -7083,18 +7097,6 @@ const initRose = (spec, context)=>{
|
|
7083
7097
|
result.innerRadius = 0;
|
7084
7098
|
const hasNegativeValue = dataset.flat().find((d)=>d[foldInfo.measureValue] < 0);
|
7085
7099
|
if (hasNegativeValue) result.innerRadius = 0.05;
|
7086
|
-
result.rose = {
|
7087
|
-
style: {
|
7088
|
-
stroke: '#ffffff',
|
7089
|
-
lineWidth: 1
|
7090
|
-
},
|
7091
|
-
state: {
|
7092
|
-
hover: {
|
7093
|
-
lineWidth: 1,
|
7094
|
-
fillOpacity: 0.6
|
7095
|
-
}
|
7096
|
-
}
|
7097
|
-
};
|
7098
7100
|
result.region = [
|
7099
7101
|
{
|
7100
7102
|
clip: true
|
@@ -7103,7 +7105,7 @@ const initRose = (spec, context)=>{
|
|
7103
7105
|
result.animation = true;
|
7104
7106
|
return result;
|
7105
7107
|
};
|
7106
|
-
const
|
7108
|
+
const angleAxis = (spec, context)=>{
|
7107
7109
|
const result = {
|
7108
7110
|
...spec
|
7109
7111
|
};
|
@@ -7115,26 +7117,37 @@ const radiusAxis = (spec, context)=>{
|
|
7115
7117
|
const showAxis = !(is0D || is1M1D);
|
7116
7118
|
if (!result.axes) result.axes = [];
|
7117
7119
|
result.axes.push({
|
7118
|
-
orient: '
|
7120
|
+
orient: 'angle',
|
7119
7121
|
visible: showAxis,
|
7120
7122
|
zero: true,
|
7121
7123
|
nice: !!showAxis,
|
7124
|
+
paddingInner: showAxis ? [
|
7125
|
+
0.15,
|
7126
|
+
0.1
|
7127
|
+
] : [
|
7128
|
+
0,
|
7129
|
+
0
|
7130
|
+
],
|
7131
|
+
paddingOuter: showAxis ? [
|
7132
|
+
0.075,
|
7133
|
+
0.1
|
7134
|
+
] : [
|
7135
|
+
0,
|
7136
|
+
0
|
7137
|
+
],
|
7122
7138
|
grid: {
|
7123
7139
|
visible: showAxis
|
7124
7140
|
},
|
7125
|
-
|
7126
|
-
visible: showAxis
|
7127
|
-
},
|
7128
|
-
label: {
|
7141
|
+
domainLine: {
|
7129
7142
|
visible: showAxis
|
7130
7143
|
},
|
7131
|
-
|
7144
|
+
tick: {
|
7132
7145
|
visible: showAxis
|
7133
7146
|
}
|
7134
7147
|
});
|
7135
7148
|
return result;
|
7136
7149
|
};
|
7137
|
-
const
|
7150
|
+
const radiusAxis = (spec, context)=>{
|
7138
7151
|
const result = {
|
7139
7152
|
...spec
|
7140
7153
|
};
|
@@ -7146,50 +7159,79 @@ const angleAxis = (spec, context)=>{
|
|
7146
7159
|
const showAxis = !(is0D || is1M1D);
|
7147
7160
|
if (!result.axes) result.axes = [];
|
7148
7161
|
result.axes.push({
|
7149
|
-
orient: '
|
7162
|
+
orient: 'radius',
|
7150
7163
|
visible: showAxis,
|
7151
7164
|
zero: true,
|
7152
7165
|
nice: !!showAxis,
|
7153
|
-
paddingInner: showAxis ? [
|
7154
|
-
0.15,
|
7155
|
-
0.1
|
7156
|
-
] : [
|
7157
|
-
0,
|
7158
|
-
0
|
7159
|
-
],
|
7160
|
-
paddingOuter: showAxis ? [
|
7161
|
-
0.075,
|
7162
|
-
0.1
|
7163
|
-
] : [
|
7164
|
-
0,
|
7165
|
-
0
|
7166
|
-
],
|
7167
7166
|
grid: {
|
7168
7167
|
visible: showAxis
|
7169
7168
|
},
|
7170
|
-
|
7169
|
+
tick: {
|
7171
7170
|
visible: showAxis
|
7172
7171
|
},
|
7173
|
-
|
7172
|
+
label: {
|
7173
|
+
visible: showAxis
|
7174
|
+
},
|
7175
|
+
domainLine: {
|
7174
7176
|
visible: showAxis
|
7175
7177
|
}
|
7176
7178
|
});
|
7177
7179
|
return result;
|
7178
7180
|
};
|
7181
|
+
const colorRoseStyleFill = (stylePipe)=>(spec, context)=>{
|
7182
|
+
const result = stylePipe(spec, context);
|
7183
|
+
const { advancedVSeed } = context;
|
7184
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7185
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
7186
|
+
if (isLinearColor(advancedVSeed)) {
|
7187
|
+
if (result?.rose?.style) result.rose.style.fill = {
|
7188
|
+
field: unfoldInfo.encodingColor,
|
7189
|
+
scale: 'color'
|
7190
|
+
};
|
7191
|
+
}
|
7192
|
+
return result;
|
7193
|
+
};
|
7194
|
+
const roseStyle = (spec, context)=>{
|
7195
|
+
const { advancedVSeed } = context;
|
7196
|
+
const { dataset } = advancedVSeed;
|
7197
|
+
const showStroke = dataset.length <= 30;
|
7198
|
+
const result = {
|
7199
|
+
...spec,
|
7200
|
+
rose: {
|
7201
|
+
style: {}
|
7202
|
+
}
|
7203
|
+
};
|
7204
|
+
return {
|
7205
|
+
...result,
|
7206
|
+
rose: {
|
7207
|
+
style: {
|
7208
|
+
stroke: '#ffffff',
|
7209
|
+
lineWidth: showStroke ? 1 : 0
|
7210
|
+
},
|
7211
|
+
state: {
|
7212
|
+
hover: {
|
7213
|
+
lineWidth: 1,
|
7214
|
+
fillOpacity: 0.6
|
7215
|
+
}
|
7216
|
+
}
|
7217
|
+
}
|
7218
|
+
};
|
7219
|
+
};
|
7179
7220
|
const rose = [
|
7180
7221
|
initRose,
|
7181
7222
|
stackCornerRadius_stackCornerRadius,
|
7182
7223
|
stackInverse,
|
7183
|
-
color_color,
|
7224
|
+
colorAdapter(color_color, linearColor),
|
7184
7225
|
background_backgroundColor,
|
7185
7226
|
datasetXY,
|
7186
7227
|
progressive,
|
7187
|
-
radiusAxis,
|
7188
7228
|
angleAxis,
|
7189
|
-
|
7190
|
-
tooltip_tooltip,
|
7229
|
+
radiusAxis,
|
7191
7230
|
verticalCrosshairRect,
|
7192
|
-
|
7231
|
+
colorRoseStyleFill(roseStyle),
|
7232
|
+
colorAdapter(discreteLegend, colorLegend),
|
7233
|
+
label_label,
|
7234
|
+
tooltip_tooltip
|
7193
7235
|
];
|
7194
7236
|
const pivotRose = [
|
7195
7237
|
initPivot,
|
@@ -7200,19 +7242,20 @@ const pivotRose = [
|
|
7200
7242
|
initRose,
|
7201
7243
|
stackCornerRadius_stackCornerRadius,
|
7202
7244
|
stackInverse,
|
7203
|
-
color_color,
|
7245
|
+
colorAdapter(color_color, linearColor),
|
7204
7246
|
background_backgroundColor,
|
7205
7247
|
datasetXY,
|
7206
7248
|
progressive,
|
7207
7249
|
radiusAxis,
|
7208
7250
|
angleAxis,
|
7251
|
+
verticalCrosshairRect,
|
7252
|
+
colorRoseStyleFill(roseStyle),
|
7209
7253
|
label_label,
|
7210
|
-
tooltip_tooltip
|
7211
|
-
verticalCrosshairRect
|
7254
|
+
tooltip_tooltip
|
7212
7255
|
]),
|
7213
7256
|
pivotRowDimensions,
|
7214
7257
|
pivotColumnDimensions,
|
7215
|
-
pivotDiscreteLegend
|
7258
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7216
7259
|
];
|
7217
7260
|
const roseSpecPipeline = [
|
7218
7261
|
pivotAdapter_pivotAdapter(rose, pivotRose)
|
@@ -7281,15 +7324,16 @@ const initRoseParallel = (spec, context)=>{
|
|
7281
7324
|
const roseParallel = [
|
7282
7325
|
initRoseParallel,
|
7283
7326
|
stackCornerRadius_stackCornerRadius,
|
7284
|
-
color_color,
|
7327
|
+
colorAdapter(color_color, linearColor),
|
7285
7328
|
background_backgroundColor,
|
7286
7329
|
datasetXY,
|
7287
7330
|
progressive,
|
7288
7331
|
radiusAxis,
|
7289
7332
|
angleAxis,
|
7333
|
+
colorRoseStyleFill(roseStyle),
|
7334
|
+
colorAdapter(discreteLegend, colorLegend),
|
7290
7335
|
label_label,
|
7291
7336
|
tooltip_tooltip,
|
7292
|
-
discreteLegend,
|
7293
7337
|
verticalCrosshairRect,
|
7294
7338
|
annotationPoint_annotationPoint,
|
7295
7339
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -7304,15 +7348,16 @@ const pivotRoseParallel = [
|
|
7304
7348
|
pivotIndicators_pivotIndicators([
|
7305
7349
|
initRoseParallel,
|
7306
7350
|
stackCornerRadius_stackCornerRadius,
|
7307
|
-
color_color,
|
7351
|
+
colorAdapter(color_color, linearColor),
|
7308
7352
|
background_backgroundColor,
|
7309
7353
|
datasetXY,
|
7310
7354
|
progressive,
|
7311
7355
|
radiusAxis,
|
7312
7356
|
angleAxis,
|
7357
|
+
verticalCrosshairRect,
|
7358
|
+
colorRoseStyleFill(roseStyle),
|
7313
7359
|
label_label,
|
7314
7360
|
tooltip_tooltip,
|
7315
|
-
verticalCrosshairRect,
|
7316
7361
|
annotationPoint_annotationPoint,
|
7317
7362
|
annotationVerticalLine_annotationVerticalLine,
|
7318
7363
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7320,7 +7365,7 @@ const pivotRoseParallel = [
|
|
7320
7365
|
]),
|
7321
7366
|
pivotRowDimensions,
|
7322
7367
|
pivotColumnDimensions,
|
7323
|
-
pivotDiscreteLegend
|
7368
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7324
7369
|
];
|
7325
7370
|
const roseParallelSpecPipeline = [
|
7326
7371
|
pivotAdapter_pivotAdapter(roseParallel, pivotRoseParallel)
|
@@ -7351,12 +7396,11 @@ const radar_generateDefaultMeasureEncoding = (measures, encoding)=>{
|
|
7351
7396
|
encoding.radius = (0, external_remeda_namespaceObject.unique)(measures.filter((item)=>'radius' === item.encoding || !item.encoding).map((item)=>item.id));
|
7352
7397
|
};
|
7353
7398
|
const radar_generateDefaultDimensionEncoding = (dimensions, encoding)=>{
|
7354
|
-
const onlyMeasureName = 1 === dimensions.length && dimensions.find((item)=>item.id === MeasureName);
|
7355
7399
|
const uniqueDimIds = (0, external_remeda_namespaceObject.unique)(dimensions.map((d)=>d.id));
|
7356
7400
|
encoding.angle = uniqueDimIds.slice(0, 1);
|
7357
|
-
encoding.color = uniqueDimIds.slice(
|
7358
|
-
encoding.detail = uniqueDimIds.slice(onlyMeasureName ? 0 : 1);
|
7401
|
+
encoding.color = uniqueDimIds.slice(1);
|
7359
7402
|
encoding.tooltip = uniqueDimIds;
|
7403
|
+
encoding.detail = [];
|
7360
7404
|
encoding.label = [];
|
7361
7405
|
encoding.row = [];
|
7362
7406
|
encoding.column = [];
|
@@ -7368,14 +7412,13 @@ const radar_generateMeasureEncoding = (measures, encoding)=>{
|
|
7368
7412
|
if (color.length > 0) encoding.color = color;
|
7369
7413
|
};
|
7370
7414
|
const radar_generateDimensionEncoding = (dimensions, encoding)=>{
|
7371
|
-
encoding.angle = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'angle' === item.encoding
|
7415
|
+
encoding.angle = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'angle' === item.encoding).map((item)=>item.id));
|
7372
7416
|
encoding.color = (0, external_remeda_namespaceObject.unique)(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
7373
|
-
encoding.detail =
|
7417
|
+
encoding.detail = [];
|
7374
7418
|
if (0 === encoding.angle.length) encoding.angle = [
|
7375
7419
|
dimensions[0].id
|
7376
7420
|
];
|
7377
7421
|
if (0 === encoding.color.length) encoding.color = dimensions.filter((item)=>!encoding.angle?.includes(item.id)).map((item)=>item.id);
|
7378
|
-
if (0 === encoding.detail.length) encoding.detail = dimensions.filter((item)=>!encoding.angle?.includes(item.id)).map((item)=>item.id);
|
7379
7422
|
};
|
7380
7423
|
const radarAdvancedPipeline = [
|
7381
7424
|
initAdvancedVSeed_initAdvancedVSeed,
|
@@ -7591,34 +7634,55 @@ const initFunnel = (spec, context)=>{
|
|
7591
7634
|
clip: true
|
7592
7635
|
}
|
7593
7636
|
];
|
7594
|
-
result.funnel = {
|
7595
|
-
style: {
|
7596
|
-
cornerRadius: 4,
|
7597
|
-
fill: {
|
7598
|
-
field: unfoldInfo.encodingColorId,
|
7599
|
-
scale: 'color'
|
7600
|
-
}
|
7601
|
-
},
|
7602
|
-
state: {
|
7603
|
-
hover: {
|
7604
|
-
fillOpacity: 0.6
|
7605
|
-
}
|
7606
|
-
}
|
7607
|
-
};
|
7608
7637
|
result.transformLabel = {
|
7609
7638
|
visible: true
|
7610
7639
|
};
|
7611
7640
|
result.animation = true;
|
7612
7641
|
return result;
|
7613
7642
|
};
|
7643
|
+
const colorFunnelStyleFill = (stylePipe)=>(spec, context)=>{
|
7644
|
+
const result = stylePipe(spec, context);
|
7645
|
+
const { advancedVSeed } = context;
|
7646
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7647
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
7648
|
+
if (isLinearColor(advancedVSeed)) {
|
7649
|
+
if (result?.funnel?.style) result.funnel.style.fill = {
|
7650
|
+
field: unfoldInfo.encodingColor,
|
7651
|
+
scale: 'color'
|
7652
|
+
};
|
7653
|
+
}
|
7654
|
+
return result;
|
7655
|
+
};
|
7656
|
+
const funnelStyle = (spec)=>{
|
7657
|
+
const result = {
|
7658
|
+
...spec,
|
7659
|
+
funnel: {
|
7660
|
+
style: {}
|
7661
|
+
}
|
7662
|
+
};
|
7663
|
+
return {
|
7664
|
+
...result,
|
7665
|
+
funnel: {
|
7666
|
+
style: {
|
7667
|
+
cornerRadius: 4
|
7668
|
+
},
|
7669
|
+
state: {
|
7670
|
+
hover: {
|
7671
|
+
fillOpacity: 0.6
|
7672
|
+
}
|
7673
|
+
}
|
7674
|
+
}
|
7675
|
+
};
|
7676
|
+
};
|
7614
7677
|
const funnel = [
|
7615
7678
|
initFunnel,
|
7616
7679
|
background_backgroundColor,
|
7617
7680
|
datasetXY,
|
7618
|
-
color_color,
|
7681
|
+
colorAdapter(color_color, linearColor),
|
7619
7682
|
label_label,
|
7683
|
+
colorAdapter(discreteLegend, colorLegend),
|
7684
|
+
colorFunnelStyleFill(funnelStyle),
|
7620
7685
|
tooltip_tooltip,
|
7621
|
-
discreteLegend,
|
7622
7686
|
annotationPoint_annotationPoint,
|
7623
7687
|
annotationVerticalLine_annotationVerticalLine,
|
7624
7688
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7633,17 +7697,18 @@ const pivotFunnel = [
|
|
7633
7697
|
initFunnel,
|
7634
7698
|
background_backgroundColor,
|
7635
7699
|
datasetXY,
|
7636
|
-
color_color,
|
7700
|
+
colorAdapter(color_color, linearColor),
|
7637
7701
|
label_label,
|
7638
7702
|
tooltip_tooltip,
|
7639
|
-
|
7703
|
+
colorFunnelStyleFill(funnelStyle),
|
7640
7704
|
annotationPoint_annotationPoint,
|
7641
7705
|
annotationVerticalLine_annotationVerticalLine,
|
7642
7706
|
annotationHorizontalLine_annotationHorizontalLine,
|
7643
7707
|
annotationArea_annotationArea
|
7644
7708
|
]),
|
7645
7709
|
pivotRowDimensions,
|
7646
|
-
pivotColumnDimensions
|
7710
|
+
pivotColumnDimensions,
|
7711
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7647
7712
|
];
|
7648
7713
|
const funnelSpecPipeline = [
|
7649
7714
|
pivotAdapter_pivotAdapter(funnel, pivotFunnel)
|
@@ -7730,6 +7795,37 @@ const labelColorInversion = (spec)=>{
|
|
7730
7795
|
};
|
7731
7796
|
return result;
|
7732
7797
|
};
|
7798
|
+
const colorCellStyleFill = (stylePipe)=>(spec, context)=>{
|
7799
|
+
const result = stylePipe(spec, context);
|
7800
|
+
const { advancedVSeed } = context;
|
7801
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7802
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
7803
|
+
if (isLinearColor(advancedVSeed)) {
|
7804
|
+
if (result?.cell?.style) result.cell.style.fill = {
|
7805
|
+
field: unfoldInfo.encodingColor,
|
7806
|
+
scale: 'color'
|
7807
|
+
};
|
7808
|
+
}
|
7809
|
+
return result;
|
7810
|
+
};
|
7811
|
+
const cellStyle = (spec)=>{
|
7812
|
+
const result = {
|
7813
|
+
...spec,
|
7814
|
+
cell: {
|
7815
|
+
style: {}
|
7816
|
+
}
|
7817
|
+
};
|
7818
|
+
return {
|
7819
|
+
...result,
|
7820
|
+
cell: {
|
7821
|
+
style: {
|
7822
|
+
shape: 'rect',
|
7823
|
+
stroke: '#ffffff',
|
7824
|
+
lineWidth: 1
|
7825
|
+
}
|
7826
|
+
}
|
7827
|
+
};
|
7828
|
+
};
|
7733
7829
|
const initHeatmap = (spec, context)=>{
|
7734
7830
|
const result = {
|
7735
7831
|
...spec
|
@@ -7744,13 +7840,6 @@ const initHeatmap = (spec, context)=>{
|
|
7744
7840
|
result.seriesField = unfoldInfo.encodingColorId;
|
7745
7841
|
result.valueField = foldInfo.measureValue;
|
7746
7842
|
result.padding = 0;
|
7747
|
-
result.cell = {
|
7748
|
-
style: {
|
7749
|
-
shape: 'rect',
|
7750
|
-
stroke: '#ffffff',
|
7751
|
-
lineWidth: 1
|
7752
|
-
}
|
7753
|
-
};
|
7754
7843
|
result.axes = [
|
7755
7844
|
{
|
7756
7845
|
type: 'band',
|
@@ -7775,14 +7864,12 @@ const heatmap = [
|
|
7775
7864
|
initHeatmap,
|
7776
7865
|
background_backgroundColor,
|
7777
7866
|
datasetXY,
|
7778
|
-
color_color,
|
7867
|
+
colorAdapter(color_color, linearColor),
|
7779
7868
|
label_label,
|
7780
7869
|
labelColorInversion,
|
7781
|
-
discreteLegend,
|
7870
|
+
colorAdapter(discreteLegend, colorLegend),
|
7871
|
+
colorCellStyleFill(cellStyle),
|
7782
7872
|
tooltip_tooltip,
|
7783
|
-
pointStyle_pointStyle,
|
7784
|
-
pointStateDimensionHover,
|
7785
|
-
lineStyle_lineStyle,
|
7786
7873
|
annotationPoint_annotationPoint,
|
7787
7874
|
annotationVerticalLine_annotationVerticalLine,
|
7788
7875
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7797,21 +7884,20 @@ const pivotHeatmap = [
|
|
7797
7884
|
initHeatmap,
|
7798
7885
|
background_backgroundColor,
|
7799
7886
|
datasetXY,
|
7800
|
-
color_color,
|
7887
|
+
colorAdapter(color_color, linearColor),
|
7801
7888
|
label_label,
|
7802
7889
|
labelColorInversion,
|
7803
7890
|
discreteLegend,
|
7804
7891
|
tooltip_tooltip,
|
7805
|
-
|
7806
|
-
pointStateDimensionHover,
|
7807
|
-
lineStyle_lineStyle,
|
7892
|
+
colorCellStyleFill(cellStyle),
|
7808
7893
|
annotationPoint_annotationPoint,
|
7809
7894
|
annotationVerticalLine_annotationVerticalLine,
|
7810
7895
|
annotationHorizontalLine_annotationHorizontalLine,
|
7811
7896
|
annotationArea_annotationArea
|
7812
7897
|
]),
|
7813
7898
|
pivotRowDimensions,
|
7814
|
-
pivotColumnDimensions
|
7899
|
+
pivotColumnDimensions,
|
7900
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7815
7901
|
];
|
7816
7902
|
const heatmapSpecPipeline = [
|
7817
7903
|
pivotAdapter_pivotAdapter(heatmap, pivotHeatmap)
|