@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/umd/index.js
CHANGED
@@ -1465,8 +1465,7 @@
|
|
1465
1465
|
const { dimensions, dataset } = vseed;
|
1466
1466
|
const MeaName = {
|
1467
1467
|
id: MeasureName,
|
1468
|
-
alias: intl.i18n
|
1469
|
-
encoding: 'detail'
|
1468
|
+
alias: intl.i18n`指标名称`
|
1470
1469
|
};
|
1471
1470
|
if (!dataset) throw new Error('dataset is required');
|
1472
1471
|
if (0 === dataset.length) return [];
|
@@ -1551,12 +1550,11 @@
|
|
1551
1550
|
encoding.y = chunk_QJLMYOTX_i(measures.filter((item)=>'yAxis' === item.encoding || !item.encoding).map((item)=>item.id));
|
1552
1551
|
};
|
1553
1552
|
const generateDefaultDimensionEncoding = (dimensions, encoding)=>{
|
1554
|
-
const onlyMeasureName = 1 === dimensions.length && dimensions.find((item)=>item.id === MeasureName);
|
1555
1553
|
const uniqueDimIds = chunk_QJLMYOTX_i(dimensions.map((d)=>d.id));
|
1556
1554
|
encoding.x = uniqueDimIds.slice(0, 1);
|
1557
|
-
encoding.color = uniqueDimIds.slice(
|
1558
|
-
encoding.detail = uniqueDimIds.slice(onlyMeasureName ? 0 : 1);
|
1555
|
+
encoding.color = uniqueDimIds.slice(1);
|
1559
1556
|
encoding.tooltip = uniqueDimIds;
|
1557
|
+
encoding.detail = [];
|
1560
1558
|
encoding.label = [];
|
1561
1559
|
encoding.row = [];
|
1562
1560
|
encoding.column = [];
|
@@ -1568,14 +1566,13 @@
|
|
1568
1566
|
if (color.length > 0) encoding.color = color;
|
1569
1567
|
};
|
1570
1568
|
const generateDimensionEncoding = (dimensions, encoding)=>{
|
1571
|
-
encoding.x = chunk_QJLMYOTX_i(dimensions.filter((item)=>'xAxis' === item.encoding
|
1569
|
+
encoding.x = chunk_QJLMYOTX_i(dimensions.filter((item)=>'xAxis' === item.encoding).map((item)=>item.id));
|
1572
1570
|
encoding.color = chunk_QJLMYOTX_i(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
1573
|
-
encoding.detail =
|
1571
|
+
encoding.detail = [];
|
1574
1572
|
if (0 === encoding.x.length) encoding.x = [
|
1575
1573
|
dimensions[0].id
|
1576
1574
|
];
|
1577
1575
|
if (0 === encoding.color.length) encoding.color = dimensions.filter((item)=>!encoding.x?.includes(item.id)).map((item)=>item.id);
|
1578
|
-
if (0 === encoding.detail.length) encoding.detail = dimensions.filter((item)=>!encoding.x?.includes(item.id)).map((item)=>item.id);
|
1579
1576
|
};
|
1580
1577
|
const measureDepth = (measures = [])=>{
|
1581
1578
|
if (!measures) return 0;
|
@@ -2511,117 +2508,6 @@
|
|
2511
2508
|
];
|
2512
2509
|
return result;
|
2513
2510
|
};
|
2514
|
-
const label_label = (spec, context)=>{
|
2515
|
-
const result = {
|
2516
|
-
...spec
|
2517
|
-
};
|
2518
|
-
const { advancedVSeed } = context;
|
2519
|
-
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
2520
|
-
const { chartType } = advancedVSeed;
|
2521
|
-
const baseConfig = advancedVSeed.config[chartType];
|
2522
|
-
if (!baseConfig || !baseConfig.label) return result;
|
2523
|
-
const { measureId, measureValue } = datasetReshapeInfo[0].foldInfo;
|
2524
|
-
const { label } = baseConfig;
|
2525
|
-
const { enable } = label;
|
2526
|
-
result.label = {
|
2527
|
-
visible: enable,
|
2528
|
-
formatMethod: (value, datum)=>{
|
2529
|
-
const result = [];
|
2530
|
-
const formatValue = (value)=>{
|
2531
|
-
const id = datum[measureId];
|
2532
|
-
const measure = findMeasureById(measures, id);
|
2533
|
-
if (!measure) return value;
|
2534
|
-
const { format = {}, autoFormat = true } = measure;
|
2535
|
-
if (!chunk_VCYTMP4D_n(format)) {
|
2536
|
-
const formatter = createFormatter(format);
|
2537
|
-
return formatter(value);
|
2538
|
-
}
|
2539
|
-
if (autoFormat) return autoFormatter(value, locale);
|
2540
|
-
return String(value);
|
2541
|
-
};
|
2542
|
-
result.push(formatValue(datum[measureValue]));
|
2543
|
-
return result.join(' ');
|
2544
|
-
}
|
2545
|
-
};
|
2546
|
-
return result;
|
2547
|
-
};
|
2548
|
-
const tooltip_tooltip = (spec, context)=>{
|
2549
|
-
const result = {
|
2550
|
-
...spec
|
2551
|
-
};
|
2552
|
-
const { advancedVSeed } = context;
|
2553
|
-
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
2554
|
-
const baseConfig = advancedVSeed.config[chartType];
|
2555
|
-
const { tooltip = {
|
2556
|
-
enable: true
|
2557
|
-
} } = baseConfig;
|
2558
|
-
const { enable } = tooltip;
|
2559
|
-
const { measureId, measureValue, measureName } = datasetReshapeInfo[0].foldInfo;
|
2560
|
-
const { encodingColor: colorName } = datasetReshapeInfo[0].unfoldInfo;
|
2561
|
-
result.tooltip = {
|
2562
|
-
visible: enable,
|
2563
|
-
mark: {
|
2564
|
-
title: {
|
2565
|
-
visible: true
|
2566
|
-
},
|
2567
|
-
content: [
|
2568
|
-
...dimensions.map((item)=>({
|
2569
|
-
visible: true,
|
2570
|
-
hasShape: true,
|
2571
|
-
shapeType: 'rectRound',
|
2572
|
-
key: (datum)=>{
|
2573
|
-
if (item.alias || item.id) return item.alias || item.id;
|
2574
|
-
return datum && datum[item.id];
|
2575
|
-
},
|
2576
|
-
value: (datum)=>datum && datum[item.id]
|
2577
|
-
})),
|
2578
|
-
{
|
2579
|
-
visible: true,
|
2580
|
-
hasShape: true,
|
2581
|
-
key: (datum)=>datum && datum[measureName || colorName] || '',
|
2582
|
-
value: (datum)=>{
|
2583
|
-
if (!datum) return '';
|
2584
|
-
const value = datum[measureValue];
|
2585
|
-
const id = datum[measureId];
|
2586
|
-
const measure = findMeasureById(measures, id);
|
2587
|
-
if (!measure) return String(value);
|
2588
|
-
const { format = {}, autoFormat = true } = measure;
|
2589
|
-
if (!chunk_VCYTMP4D_n(format)) {
|
2590
|
-
const formatter = createFormatter(format);
|
2591
|
-
return formatter(value);
|
2592
|
-
}
|
2593
|
-
if (autoFormat) return autoFormatter(value, locale);
|
2594
|
-
return String(value);
|
2595
|
-
}
|
2596
|
-
}
|
2597
|
-
]
|
2598
|
-
},
|
2599
|
-
dimension: {
|
2600
|
-
content: [
|
2601
|
-
{
|
2602
|
-
visible: true,
|
2603
|
-
key: (datum)=>datum && datum[colorName] || '',
|
2604
|
-
value: (datum)=>{
|
2605
|
-
if (!datum) return '';
|
2606
|
-
const value = datum[measureValue];
|
2607
|
-
const id = datum[measureId];
|
2608
|
-
const measure = findMeasureById(measures, id);
|
2609
|
-
if (!measure) return String(value);
|
2610
|
-
const { format = {}, autoFormat = true } = measure;
|
2611
|
-
if (!chunk_VCYTMP4D_n(format)) {
|
2612
|
-
const formatter = createFormatter(format);
|
2613
|
-
return formatter(value);
|
2614
|
-
}
|
2615
|
-
if (autoFormat) return autoFormatter(value, locale);
|
2616
|
-
return String(value);
|
2617
|
-
},
|
2618
|
-
shapeType: 'rectRound'
|
2619
|
-
}
|
2620
|
-
]
|
2621
|
-
}
|
2622
|
-
};
|
2623
|
-
return result;
|
2624
|
-
};
|
2625
2511
|
const verticalCrosshairLine = (spec, context)=>{
|
2626
2512
|
const result = {
|
2627
2513
|
...spec
|
@@ -3146,6 +3032,117 @@
|
|
3146
3032
|
}
|
3147
3033
|
};
|
3148
3034
|
};
|
3035
|
+
const label_label = (spec, context)=>{
|
3036
|
+
const result = {
|
3037
|
+
...spec
|
3038
|
+
};
|
3039
|
+
const { advancedVSeed } = context;
|
3040
|
+
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
3041
|
+
const { chartType } = advancedVSeed;
|
3042
|
+
const baseConfig = advancedVSeed.config[chartType];
|
3043
|
+
if (!baseConfig || !baseConfig.label) return result;
|
3044
|
+
const { measureId, measureValue } = datasetReshapeInfo[0].foldInfo;
|
3045
|
+
const { label } = baseConfig;
|
3046
|
+
const { enable } = label;
|
3047
|
+
result.label = {
|
3048
|
+
visible: enable,
|
3049
|
+
formatMethod: (value, datum)=>{
|
3050
|
+
const result = [];
|
3051
|
+
const formatValue = (value)=>{
|
3052
|
+
const id = datum[measureId];
|
3053
|
+
const measure = findMeasureById(measures, id);
|
3054
|
+
if (!measure) return value;
|
3055
|
+
const { format = {}, autoFormat = true } = measure;
|
3056
|
+
if (!chunk_VCYTMP4D_n(format)) {
|
3057
|
+
const formatter = createFormatter(format);
|
3058
|
+
return formatter(value);
|
3059
|
+
}
|
3060
|
+
if (autoFormat) return autoFormatter(value, locale);
|
3061
|
+
return String(value);
|
3062
|
+
};
|
3063
|
+
result.push(formatValue(datum[measureValue]));
|
3064
|
+
return result.join(' ');
|
3065
|
+
}
|
3066
|
+
};
|
3067
|
+
return result;
|
3068
|
+
};
|
3069
|
+
const tooltip_tooltip = (spec, context)=>{
|
3070
|
+
const result = {
|
3071
|
+
...spec
|
3072
|
+
};
|
3073
|
+
const { advancedVSeed } = context;
|
3074
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
3075
|
+
const baseConfig = advancedVSeed.config[chartType];
|
3076
|
+
const { tooltip = {
|
3077
|
+
enable: true
|
3078
|
+
} } = baseConfig;
|
3079
|
+
const { enable } = tooltip;
|
3080
|
+
const { measureId, measureValue, measureName } = datasetReshapeInfo[0].foldInfo;
|
3081
|
+
const { encodingColor: colorName } = datasetReshapeInfo[0].unfoldInfo;
|
3082
|
+
result.tooltip = {
|
3083
|
+
visible: enable,
|
3084
|
+
mark: {
|
3085
|
+
title: {
|
3086
|
+
visible: true
|
3087
|
+
},
|
3088
|
+
content: [
|
3089
|
+
...dimensions.map((item)=>({
|
3090
|
+
visible: true,
|
3091
|
+
hasShape: true,
|
3092
|
+
shapeType: 'rectRound',
|
3093
|
+
key: (datum)=>{
|
3094
|
+
if (item.alias || item.id) return item.alias || item.id;
|
3095
|
+
return datum && datum[item.id];
|
3096
|
+
},
|
3097
|
+
value: (datum)=>datum && datum[item.id]
|
3098
|
+
})),
|
3099
|
+
{
|
3100
|
+
visible: true,
|
3101
|
+
hasShape: true,
|
3102
|
+
key: (datum)=>datum && datum[measureName || colorName] || '',
|
3103
|
+
value: (datum)=>{
|
3104
|
+
if (!datum) return '';
|
3105
|
+
const value = datum[measureValue];
|
3106
|
+
const id = datum[measureId];
|
3107
|
+
const measure = findMeasureById(measures, id);
|
3108
|
+
if (!measure) return String(value);
|
3109
|
+
const { format = {}, autoFormat = true } = measure;
|
3110
|
+
if (!chunk_VCYTMP4D_n(format)) {
|
3111
|
+
const formatter = createFormatter(format);
|
3112
|
+
return formatter(value);
|
3113
|
+
}
|
3114
|
+
if (autoFormat) return autoFormatter(value, locale);
|
3115
|
+
return String(value);
|
3116
|
+
}
|
3117
|
+
}
|
3118
|
+
]
|
3119
|
+
},
|
3120
|
+
dimension: {
|
3121
|
+
content: [
|
3122
|
+
{
|
3123
|
+
visible: true,
|
3124
|
+
key: (datum)=>datum && datum[colorName] || '',
|
3125
|
+
value: (datum)=>{
|
3126
|
+
if (!datum) return '';
|
3127
|
+
const value = datum[measureValue];
|
3128
|
+
const id = datum[measureId];
|
3129
|
+
const measure = findMeasureById(measures, id);
|
3130
|
+
if (!measure) return String(value);
|
3131
|
+
const { format = {}, autoFormat = true } = measure;
|
3132
|
+
if (!chunk_VCYTMP4D_n(format)) {
|
3133
|
+
const formatter = createFormatter(format);
|
3134
|
+
return formatter(value);
|
3135
|
+
}
|
3136
|
+
if (autoFormat) return autoFormatter(value, locale);
|
3137
|
+
return String(value);
|
3138
|
+
},
|
3139
|
+
shapeType: 'rectRound'
|
3140
|
+
}
|
3141
|
+
]
|
3142
|
+
}
|
3143
|
+
};
|
3144
|
+
return result;
|
3145
|
+
};
|
3149
3146
|
const isSubset = (sub, obj)=>Object.entries(sub).every(([key, value])=>{
|
3150
3147
|
if ('string' == typeof value) return obj[key] === value;
|
3151
3148
|
if ('number' == typeof value) return obj[key] === value;
|
@@ -3907,31 +3904,118 @@
|
|
3907
3904
|
legends
|
3908
3905
|
};
|
3909
3906
|
};
|
3910
|
-
const
|
3911
|
-
|
3912
|
-
|
3913
|
-
if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
|
3914
|
-
return execPipeline(pipeline, context, spec);
|
3907
|
+
const pivotColorLegend = (spec, context)=>{
|
3908
|
+
const result = {
|
3909
|
+
...spec
|
3915
3910
|
};
|
3916
|
-
|
3917
|
-
|
3918
|
-
|
3919
|
-
|
3920
|
-
|
3921
|
-
|
3922
|
-
|
3923
|
-
|
3924
|
-
|
3925
|
-
|
3926
|
-
|
3927
|
-
|
3928
|
-
|
3929
|
-
|
3930
|
-
|
3931
|
-
|
3932
|
-
|
3933
|
-
|
3934
|
-
|
3911
|
+
const { advancedVSeed } = context;
|
3912
|
+
const { chartType } = advancedVSeed;
|
3913
|
+
const baseConfig = advancedVSeed.config[chartType];
|
3914
|
+
if (!baseConfig || !baseConfig.legend) return result;
|
3915
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
3916
|
+
const max = Math.max(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[1]));
|
3917
|
+
const min = Math.min(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[0]));
|
3918
|
+
const { legend, color } = baseConfig;
|
3919
|
+
const { colorScheme, linearColorScheme } = color;
|
3920
|
+
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400 } = legend || {};
|
3921
|
+
const orient = [
|
3922
|
+
'bottom',
|
3923
|
+
'bottomLeft',
|
3924
|
+
'bottomRight',
|
3925
|
+
'bl',
|
3926
|
+
'br'
|
3927
|
+
].includes(position) ? 'bottom' : [
|
3928
|
+
'top',
|
3929
|
+
'topLeft',
|
3930
|
+
'topRight',
|
3931
|
+
'tl',
|
3932
|
+
'tr'
|
3933
|
+
].includes(position) ? 'top' : [
|
3934
|
+
'left',
|
3935
|
+
'leftTop',
|
3936
|
+
'leftBottom',
|
3937
|
+
'lt',
|
3938
|
+
'lb'
|
3939
|
+
].includes(position) ? 'left' : 'right';
|
3940
|
+
const legendPosition = [
|
3941
|
+
'topLeft',
|
3942
|
+
'bottomLeft',
|
3943
|
+
'leftTop',
|
3944
|
+
'rightTop',
|
3945
|
+
'lt',
|
3946
|
+
'rt',
|
3947
|
+
'tl',
|
3948
|
+
'bl'
|
3949
|
+
].includes(position) ? 'start' : [
|
3950
|
+
'topRight',
|
3951
|
+
'bottomRight',
|
3952
|
+
'leftBottom',
|
3953
|
+
'rightBottom',
|
3954
|
+
'lb',
|
3955
|
+
'rb',
|
3956
|
+
'rt',
|
3957
|
+
'br'
|
3958
|
+
].includes(position) ? 'end' : 'middle';
|
3959
|
+
const legends = {
|
3960
|
+
visible: enable,
|
3961
|
+
type: 'color',
|
3962
|
+
orient,
|
3963
|
+
position: legendPosition,
|
3964
|
+
colors: linearColorScheme || colorScheme || [],
|
3965
|
+
value: [
|
3966
|
+
min,
|
3967
|
+
max
|
3968
|
+
],
|
3969
|
+
min: min,
|
3970
|
+
max: max,
|
3971
|
+
maxWidth: '30%',
|
3972
|
+
startText: {
|
3973
|
+
visible: true,
|
3974
|
+
style: {
|
3975
|
+
fill: labelFontColor,
|
3976
|
+
fontSize: labelFontSize,
|
3977
|
+
fontWeight: labelFontWeight
|
3978
|
+
}
|
3979
|
+
},
|
3980
|
+
endText: {
|
3981
|
+
visible: true,
|
3982
|
+
style: {
|
3983
|
+
fill: labelFontColor,
|
3984
|
+
fontSize: labelFontSize,
|
3985
|
+
fontWeight: labelFontWeight
|
3986
|
+
}
|
3987
|
+
}
|
3988
|
+
};
|
3989
|
+
return {
|
3990
|
+
...result,
|
3991
|
+
legends
|
3992
|
+
};
|
3993
|
+
};
|
3994
|
+
const pivotAdapter_pivotAdapter = (pipeline, pivotPipeline)=>(spec, context)=>{
|
3995
|
+
const { vseed } = context;
|
3996
|
+
const usePivotChart = isPivotChart(vseed);
|
3997
|
+
if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
|
3998
|
+
return execPipeline(pipeline, context, spec);
|
3999
|
+
};
|
4000
|
+
const line_line = [
|
4001
|
+
initLine,
|
4002
|
+
colorAdapter(color_color, linearColor),
|
4003
|
+
background_backgroundColor,
|
4004
|
+
datasetXY,
|
4005
|
+
progressive,
|
4006
|
+
xBand,
|
4007
|
+
yLinear,
|
4008
|
+
verticalCrosshairLine,
|
4009
|
+
colorAdapter(discreteLegend, colorLegend),
|
4010
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
4011
|
+
pointStateDimensionHover,
|
4012
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
4013
|
+
label_label,
|
4014
|
+
tooltip_tooltip,
|
4015
|
+
annotationPoint_annotationPoint,
|
4016
|
+
annotationVerticalLine_annotationVerticalLine,
|
4017
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
4018
|
+
annotationArea_annotationArea
|
3935
4019
|
];
|
3936
4020
|
const pivotLine = [
|
3937
4021
|
initPivot,
|
@@ -3940,18 +4024,18 @@
|
|
3940
4024
|
datasetPivot,
|
3941
4025
|
pivotIndicators_pivotIndicators([
|
3942
4026
|
initLine,
|
3943
|
-
color_color,
|
4027
|
+
colorAdapter(color_color, linearColor),
|
3944
4028
|
background_backgroundColor,
|
3945
4029
|
datasetXY,
|
3946
4030
|
progressive,
|
3947
4031
|
xBand,
|
3948
4032
|
yLinear,
|
3949
|
-
label_label,
|
3950
|
-
tooltip_tooltip,
|
3951
4033
|
verticalCrosshairLine,
|
3952
|
-
pointStyle_pointStyle,
|
4034
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
3953
4035
|
pointStateDimensionHover,
|
3954
|
-
lineStyle_lineStyle,
|
4036
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
4037
|
+
label_label,
|
4038
|
+
tooltip_tooltip,
|
3955
4039
|
annotationPoint_annotationPoint,
|
3956
4040
|
annotationVerticalLine_annotationVerticalLine,
|
3957
4041
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -3959,7 +4043,7 @@
|
|
3959
4043
|
]),
|
3960
4044
|
pivotRowDimensions,
|
3961
4045
|
pivotColumnDimensions,
|
3962
|
-
pivotDiscreteLegend
|
4046
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
3963
4047
|
];
|
3964
4048
|
const lineSpecPipeline = [
|
3965
4049
|
pivotAdapter_pivotAdapter(line_line, pivotLine)
|
@@ -4008,7 +4092,7 @@
|
|
4008
4092
|
return encoding;
|
4009
4093
|
};
|
4010
4094
|
const column_generateDimensionEncoding = (dimensions, encoding)=>{
|
4011
|
-
encoding.x = chunk_QJLMYOTX_i(dimensions.filter((item)=>'xAxis' === item.encoding
|
4095
|
+
encoding.x = chunk_QJLMYOTX_i(dimensions.filter((item)=>'xAxis' === item.encoding).map((item)=>item.id));
|
4012
4096
|
encoding.color = chunk_QJLMYOTX_i(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
4013
4097
|
encoding.detail = chunk_QJLMYOTX_i(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
4014
4098
|
if (0 === encoding.x.length) encoding.x = [
|
@@ -4324,93 +4408,6 @@
|
|
4324
4408
|
markArea: markArea
|
4325
4409
|
};
|
4326
4410
|
};
|
4327
|
-
const pivotColorLegend = (spec, context)=>{
|
4328
|
-
const result = {
|
4329
|
-
...spec
|
4330
|
-
};
|
4331
|
-
const { advancedVSeed } = context;
|
4332
|
-
const { chartType } = advancedVSeed;
|
4333
|
-
const baseConfig = advancedVSeed.config[chartType];
|
4334
|
-
if (!baseConfig || !baseConfig.legend) return result;
|
4335
|
-
const { datasetReshapeInfo } = advancedVSeed;
|
4336
|
-
const max = Math.max(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[1]));
|
4337
|
-
const min = Math.min(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[0]));
|
4338
|
-
const { legend, color } = baseConfig;
|
4339
|
-
const { colorScheme, linearColorScheme } = color;
|
4340
|
-
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400 } = legend || {};
|
4341
|
-
const orient = [
|
4342
|
-
'bottom',
|
4343
|
-
'bottomLeft',
|
4344
|
-
'bottomRight',
|
4345
|
-
'bl',
|
4346
|
-
'br'
|
4347
|
-
].includes(position) ? 'bottom' : [
|
4348
|
-
'top',
|
4349
|
-
'topLeft',
|
4350
|
-
'topRight',
|
4351
|
-
'tl',
|
4352
|
-
'tr'
|
4353
|
-
].includes(position) ? 'top' : [
|
4354
|
-
'left',
|
4355
|
-
'leftTop',
|
4356
|
-
'leftBottom',
|
4357
|
-
'lt',
|
4358
|
-
'lb'
|
4359
|
-
].includes(position) ? 'left' : 'right';
|
4360
|
-
const legendPosition = [
|
4361
|
-
'topLeft',
|
4362
|
-
'bottomLeft',
|
4363
|
-
'leftTop',
|
4364
|
-
'rightTop',
|
4365
|
-
'lt',
|
4366
|
-
'rt',
|
4367
|
-
'tl',
|
4368
|
-
'bl'
|
4369
|
-
].includes(position) ? 'start' : [
|
4370
|
-
'topRight',
|
4371
|
-
'bottomRight',
|
4372
|
-
'leftBottom',
|
4373
|
-
'rightBottom',
|
4374
|
-
'lb',
|
4375
|
-
'rb',
|
4376
|
-
'rt',
|
4377
|
-
'br'
|
4378
|
-
].includes(position) ? 'end' : 'middle';
|
4379
|
-
const legends = {
|
4380
|
-
visible: enable,
|
4381
|
-
type: 'color',
|
4382
|
-
orient,
|
4383
|
-
position: legendPosition,
|
4384
|
-
colors: linearColorScheme || colorScheme || [],
|
4385
|
-
value: [
|
4386
|
-
min,
|
4387
|
-
max
|
4388
|
-
],
|
4389
|
-
min: min,
|
4390
|
-
max: max,
|
4391
|
-
maxWidth: '30%',
|
4392
|
-
startText: {
|
4393
|
-
visible: true,
|
4394
|
-
style: {
|
4395
|
-
fill: labelFontColor,
|
4396
|
-
fontSize: labelFontSize,
|
4397
|
-
fontWeight: labelFontWeight
|
4398
|
-
}
|
4399
|
-
},
|
4400
|
-
endText: {
|
4401
|
-
visible: true,
|
4402
|
-
style: {
|
4403
|
-
fill: labelFontColor,
|
4404
|
-
fontSize: labelFontSize,
|
4405
|
-
fontWeight: labelFontWeight
|
4406
|
-
}
|
4407
|
-
}
|
4408
|
-
};
|
4409
|
-
return {
|
4410
|
-
...result,
|
4411
|
-
legends
|
4412
|
-
};
|
4413
|
-
};
|
4414
4411
|
const column = [
|
4415
4412
|
initColumn,
|
4416
4413
|
stackCornerRadius_stackCornerRadius,
|
@@ -4684,7 +4681,7 @@
|
|
4684
4681
|
return encoding;
|
4685
4682
|
};
|
4686
4683
|
const bar_generateDimensionEncoding = (dimensions, encoding)=>{
|
4687
|
-
encoding.y = chunk_QJLMYOTX_i(dimensions.filter((item)=>'yAxis' === item.encoding
|
4684
|
+
encoding.y = chunk_QJLMYOTX_i(dimensions.filter((item)=>'yAxis' === item.encoding).map((item)=>item.id));
|
4688
4685
|
encoding.color = chunk_QJLMYOTX_i(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
4689
4686
|
encoding.detail = chunk_QJLMYOTX_i(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
4690
4687
|
if (0 === encoding.y.length) encoding.y = [
|
@@ -5231,7 +5228,7 @@
|
|
5231
5228
|
};
|
5232
5229
|
const areaAdvancedPipeline = [
|
5233
5230
|
initAdvancedVSeed_initAdvancedVSeed,
|
5234
|
-
|
5231
|
+
encodingForLine,
|
5235
5232
|
buildMeasures,
|
5236
5233
|
autoDimensions_autoDimensions,
|
5237
5234
|
pivotAdapter([
|
@@ -5389,7 +5386,7 @@
|
|
5389
5386
|
};
|
5390
5387
|
const areaPercentAdvancedPipeline = [
|
5391
5388
|
initAdvancedVSeed_initAdvancedVSeed,
|
5392
|
-
|
5389
|
+
encodingForLine,
|
5393
5390
|
buildMeasures,
|
5394
5391
|
autoDimensions_autoDimensions,
|
5395
5392
|
pivotAdapter([
|
@@ -5876,7 +5873,7 @@
|
|
5876
5873
|
]),
|
5877
5874
|
pivotRowDimensions,
|
5878
5875
|
pivotColumnDimensions,
|
5879
|
-
pivotDiscreteLegend
|
5876
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
5880
5877
|
];
|
5881
5878
|
const scatterSpecPipeline = [
|
5882
5879
|
pivotAdapter_pivotAdapter(scatter, pivotScatter)
|
@@ -5925,7 +5922,7 @@
|
|
5925
5922
|
return encoding;
|
5926
5923
|
};
|
5927
5924
|
const dualAxis_generateDimensionEncoding = (dimensions, encoding)=>{
|
5928
|
-
encoding.x = chunk_QJLMYOTX_i(dimensions.filter((item)=>'xAxis' === item.encoding
|
5925
|
+
encoding.x = chunk_QJLMYOTX_i(dimensions.filter((item)=>'xAxis' === item.encoding).map((item)=>item.id));
|
5929
5926
|
encoding.color = chunk_QJLMYOTX_i(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
5930
5927
|
encoding.detail = chunk_QJLMYOTX_i(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
5931
5928
|
if (0 === encoding.x.length) encoding.x = [
|
@@ -7079,9 +7076,8 @@
|
|
7079
7076
|
...spec
|
7080
7077
|
};
|
7081
7078
|
const { advancedVSeed } = context;
|
7082
|
-
const { datasetReshapeInfo
|
7079
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7083
7080
|
const { unfoldInfo, foldInfo } = datasetReshapeInfo[0];
|
7084
|
-
const showStroke = dataset.length <= 30;
|
7085
7081
|
result.type = 'pie';
|
7086
7082
|
result.outerRadius = 0.8;
|
7087
7083
|
result.innerRadius = 0;
|
@@ -7093,30 +7089,57 @@
|
|
7093
7089
|
clip: true
|
7094
7090
|
}
|
7095
7091
|
];
|
7096
|
-
result.
|
7097
|
-
|
7098
|
-
|
7099
|
-
|
7100
|
-
|
7101
|
-
}
|
7102
|
-
|
7103
|
-
|
7104
|
-
|
7092
|
+
result.animation = true;
|
7093
|
+
return result;
|
7094
|
+
};
|
7095
|
+
const colorPieStyleFill = (stylePipe)=>(spec, context)=>{
|
7096
|
+
const result = stylePipe(spec, context);
|
7097
|
+
const { advancedVSeed } = context;
|
7098
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7099
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
7100
|
+
if (isLinearColor(advancedVSeed)) {
|
7101
|
+
if (result?.pie?.style) result.pie.style.fill = {
|
7102
|
+
field: unfoldInfo.encodingColor,
|
7103
|
+
scale: 'color'
|
7104
|
+
};
|
7105
|
+
}
|
7106
|
+
return result;
|
7107
|
+
};
|
7108
|
+
const pieStyle = (spec, context)=>{
|
7109
|
+
const { advancedVSeed } = context;
|
7110
|
+
const { dataset } = advancedVSeed;
|
7111
|
+
const showStroke = dataset.length <= 30;
|
7112
|
+
const result = {
|
7113
|
+
...spec,
|
7114
|
+
pie: {
|
7115
|
+
style: {}
|
7116
|
+
}
|
7117
|
+
};
|
7118
|
+
return {
|
7119
|
+
...result,
|
7120
|
+
pie: {
|
7121
|
+
style: {
|
7122
|
+
stroke: '#ffffff',
|
7123
|
+
lineWidth: showStroke ? 1 : 0
|
7124
|
+
},
|
7125
|
+
state: {
|
7126
|
+
hover: {
|
7127
|
+
outerRadius: 1.1 * result.outerRadius
|
7128
|
+
}
|
7105
7129
|
}
|
7106
7130
|
}
|
7107
7131
|
};
|
7108
|
-
result.animation = true;
|
7109
|
-
return result;
|
7110
7132
|
};
|
7111
7133
|
const pie = [
|
7112
7134
|
initPie,
|
7113
|
-
color_color,
|
7135
|
+
colorAdapter(color_color, linearColor),
|
7114
7136
|
background_backgroundColor,
|
7115
7137
|
datasetXY,
|
7116
7138
|
progressive,
|
7139
|
+
colorPieStyleFill(pieStyle),
|
7140
|
+
colorAdapter(discreteLegend, colorLegend),
|
7117
7141
|
label_label,
|
7118
7142
|
tooltip_tooltip,
|
7119
|
-
discreteLegend,
|
7120
7143
|
annotationPoint_annotationPoint,
|
7121
7144
|
annotationVerticalLine_annotationVerticalLine,
|
7122
7145
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7129,10 +7152,11 @@
|
|
7129
7152
|
datasetPivot,
|
7130
7153
|
pivotIndicators_pivotIndicators([
|
7131
7154
|
initPie,
|
7132
|
-
color_color,
|
7155
|
+
colorAdapter(color_color, linearColor),
|
7133
7156
|
background_backgroundColor,
|
7134
7157
|
datasetXY,
|
7135
7158
|
progressive,
|
7159
|
+
colorPieStyleFill(pieStyle),
|
7136
7160
|
label_label,
|
7137
7161
|
tooltip_tooltip,
|
7138
7162
|
annotationPoint_annotationPoint,
|
@@ -7142,7 +7166,7 @@
|
|
7142
7166
|
]),
|
7143
7167
|
pivotRowDimensions,
|
7144
7168
|
pivotColumnDimensions,
|
7145
|
-
pivotDiscreteLegend
|
7169
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7146
7170
|
];
|
7147
7171
|
const pieSpecPipeline = [
|
7148
7172
|
pivotAdapter_pivotAdapter(pie, pivotPie)
|
@@ -7170,9 +7194,8 @@
|
|
7170
7194
|
...spec
|
7171
7195
|
};
|
7172
7196
|
const { advancedVSeed } = context;
|
7173
|
-
const { datasetReshapeInfo
|
7197
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7174
7198
|
const { foldInfo, unfoldInfo } = datasetReshapeInfo[0];
|
7175
|
-
const showStroke = dataset.length <= 30;
|
7176
7199
|
result.type = 'pie';
|
7177
7200
|
result.outerRadius = 0.8;
|
7178
7201
|
result.innerRadius = 0.8 * result.outerRadius;
|
@@ -7184,29 +7207,19 @@
|
|
7184
7207
|
clip: true
|
7185
7208
|
}
|
7186
7209
|
];
|
7187
|
-
result.pie = {
|
7188
|
-
style: {
|
7189
|
-
stroke: '#ffffff',
|
7190
|
-
lineWidth: showStroke ? 1 : 0
|
7191
|
-
},
|
7192
|
-
state: {
|
7193
|
-
hover: {
|
7194
|
-
outerRadius: 1.1 * result.outerRadius
|
7195
|
-
}
|
7196
|
-
}
|
7197
|
-
};
|
7198
7210
|
result.animation = true;
|
7199
7211
|
return result;
|
7200
7212
|
};
|
7201
7213
|
const donut = [
|
7202
7214
|
initDonut,
|
7203
|
-
color_color,
|
7215
|
+
colorAdapter(color_color, linearColor),
|
7204
7216
|
background_backgroundColor,
|
7205
7217
|
datasetXY,
|
7206
7218
|
progressive,
|
7207
7219
|
label_label,
|
7220
|
+
colorPieStyleFill(pieStyle),
|
7221
|
+
colorAdapter(discreteLegend, colorLegend),
|
7208
7222
|
tooltip_tooltip,
|
7209
|
-
discreteLegend,
|
7210
7223
|
annotationPoint_annotationPoint,
|
7211
7224
|
annotationVerticalLine_annotationVerticalLine,
|
7212
7225
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7219,11 +7232,12 @@
|
|
7219
7232
|
datasetPivot,
|
7220
7233
|
pivotIndicators_pivotIndicators([
|
7221
7234
|
initDonut,
|
7222
|
-
color_color,
|
7235
|
+
colorAdapter(color_color, linearColor),
|
7223
7236
|
background_backgroundColor,
|
7224
7237
|
datasetXY,
|
7225
7238
|
progressive,
|
7226
7239
|
label_label,
|
7240
|
+
colorPieStyleFill(pieStyle),
|
7227
7241
|
tooltip_tooltip,
|
7228
7242
|
annotationPoint_annotationPoint,
|
7229
7243
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -7232,7 +7246,7 @@
|
|
7232
7246
|
]),
|
7233
7247
|
pivotRowDimensions,
|
7234
7248
|
pivotColumnDimensions,
|
7235
|
-
pivotDiscreteLegend
|
7249
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7236
7250
|
];
|
7237
7251
|
const donutSpecPipeline = [
|
7238
7252
|
pivotAdapter_pivotAdapter(donut, pivotDonut)
|
@@ -7280,7 +7294,7 @@
|
|
7280
7294
|
if (color.length > 0) encoding.color = color;
|
7281
7295
|
};
|
7282
7296
|
const rose_generateDimensionEncoding = (dimensions, encoding)=>{
|
7283
|
-
encoding.angle = chunk_QJLMYOTX_i(dimensions.filter((item)=>'angle' === item.encoding
|
7297
|
+
encoding.angle = chunk_QJLMYOTX_i(dimensions.filter((item)=>'angle' === item.encoding).map((item)=>item.id));
|
7284
7298
|
encoding.color = chunk_QJLMYOTX_i(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
7285
7299
|
encoding.detail = chunk_QJLMYOTX_i(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
7286
7300
|
if (0 === encoding.angle.length) encoding.angle = [
|
@@ -7320,18 +7334,6 @@
|
|
7320
7334
|
result.innerRadius = 0;
|
7321
7335
|
const hasNegativeValue = dataset.flat().find((d)=>d[foldInfo.measureValue] < 0);
|
7322
7336
|
if (hasNegativeValue) result.innerRadius = 0.05;
|
7323
|
-
result.rose = {
|
7324
|
-
style: {
|
7325
|
-
stroke: '#ffffff',
|
7326
|
-
lineWidth: 1
|
7327
|
-
},
|
7328
|
-
state: {
|
7329
|
-
hover: {
|
7330
|
-
lineWidth: 1,
|
7331
|
-
fillOpacity: 0.6
|
7332
|
-
}
|
7333
|
-
}
|
7334
|
-
};
|
7335
7337
|
result.region = [
|
7336
7338
|
{
|
7337
7339
|
clip: true
|
@@ -7340,7 +7342,7 @@
|
|
7340
7342
|
result.animation = true;
|
7341
7343
|
return result;
|
7342
7344
|
};
|
7343
|
-
const
|
7345
|
+
const angleAxis = (spec, context)=>{
|
7344
7346
|
const result = {
|
7345
7347
|
...spec
|
7346
7348
|
};
|
@@ -7352,26 +7354,37 @@
|
|
7352
7354
|
const showAxis = !(is0D || is1M1D);
|
7353
7355
|
if (!result.axes) result.axes = [];
|
7354
7356
|
result.axes.push({
|
7355
|
-
orient: '
|
7357
|
+
orient: 'angle',
|
7356
7358
|
visible: showAxis,
|
7357
7359
|
zero: true,
|
7358
7360
|
nice: !!showAxis,
|
7361
|
+
paddingInner: showAxis ? [
|
7362
|
+
0.15,
|
7363
|
+
0.1
|
7364
|
+
] : [
|
7365
|
+
0,
|
7366
|
+
0
|
7367
|
+
],
|
7368
|
+
paddingOuter: showAxis ? [
|
7369
|
+
0.075,
|
7370
|
+
0.1
|
7371
|
+
] : [
|
7372
|
+
0,
|
7373
|
+
0
|
7374
|
+
],
|
7359
7375
|
grid: {
|
7360
7376
|
visible: showAxis
|
7361
7377
|
},
|
7362
|
-
|
7363
|
-
visible: showAxis
|
7364
|
-
},
|
7365
|
-
label: {
|
7378
|
+
domainLine: {
|
7366
7379
|
visible: showAxis
|
7367
7380
|
},
|
7368
|
-
|
7381
|
+
tick: {
|
7369
7382
|
visible: showAxis
|
7370
7383
|
}
|
7371
7384
|
});
|
7372
7385
|
return result;
|
7373
7386
|
};
|
7374
|
-
const
|
7387
|
+
const radiusAxis = (spec, context)=>{
|
7375
7388
|
const result = {
|
7376
7389
|
...spec
|
7377
7390
|
};
|
@@ -7383,50 +7396,79 @@
|
|
7383
7396
|
const showAxis = !(is0D || is1M1D);
|
7384
7397
|
if (!result.axes) result.axes = [];
|
7385
7398
|
result.axes.push({
|
7386
|
-
orient: '
|
7399
|
+
orient: 'radius',
|
7387
7400
|
visible: showAxis,
|
7388
7401
|
zero: true,
|
7389
7402
|
nice: !!showAxis,
|
7390
|
-
paddingInner: showAxis ? [
|
7391
|
-
0.15,
|
7392
|
-
0.1
|
7393
|
-
] : [
|
7394
|
-
0,
|
7395
|
-
0
|
7396
|
-
],
|
7397
|
-
paddingOuter: showAxis ? [
|
7398
|
-
0.075,
|
7399
|
-
0.1
|
7400
|
-
] : [
|
7401
|
-
0,
|
7402
|
-
0
|
7403
|
-
],
|
7404
7403
|
grid: {
|
7405
7404
|
visible: showAxis
|
7406
7405
|
},
|
7407
|
-
|
7406
|
+
tick: {
|
7408
7407
|
visible: showAxis
|
7409
7408
|
},
|
7410
|
-
|
7409
|
+
label: {
|
7410
|
+
visible: showAxis
|
7411
|
+
},
|
7412
|
+
domainLine: {
|
7411
7413
|
visible: showAxis
|
7412
7414
|
}
|
7413
7415
|
});
|
7414
7416
|
return result;
|
7415
7417
|
};
|
7418
|
+
const colorRoseStyleFill = (stylePipe)=>(spec, context)=>{
|
7419
|
+
const result = stylePipe(spec, context);
|
7420
|
+
const { advancedVSeed } = context;
|
7421
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7422
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
7423
|
+
if (isLinearColor(advancedVSeed)) {
|
7424
|
+
if (result?.rose?.style) result.rose.style.fill = {
|
7425
|
+
field: unfoldInfo.encodingColor,
|
7426
|
+
scale: 'color'
|
7427
|
+
};
|
7428
|
+
}
|
7429
|
+
return result;
|
7430
|
+
};
|
7431
|
+
const roseStyle = (spec, context)=>{
|
7432
|
+
const { advancedVSeed } = context;
|
7433
|
+
const { dataset } = advancedVSeed;
|
7434
|
+
const showStroke = dataset.length <= 30;
|
7435
|
+
const result = {
|
7436
|
+
...spec,
|
7437
|
+
rose: {
|
7438
|
+
style: {}
|
7439
|
+
}
|
7440
|
+
};
|
7441
|
+
return {
|
7442
|
+
...result,
|
7443
|
+
rose: {
|
7444
|
+
style: {
|
7445
|
+
stroke: '#ffffff',
|
7446
|
+
lineWidth: showStroke ? 1 : 0
|
7447
|
+
},
|
7448
|
+
state: {
|
7449
|
+
hover: {
|
7450
|
+
lineWidth: 1,
|
7451
|
+
fillOpacity: 0.6
|
7452
|
+
}
|
7453
|
+
}
|
7454
|
+
}
|
7455
|
+
};
|
7456
|
+
};
|
7416
7457
|
const rose = [
|
7417
7458
|
initRose,
|
7418
7459
|
stackCornerRadius_stackCornerRadius,
|
7419
7460
|
stackInverse,
|
7420
|
-
color_color,
|
7461
|
+
colorAdapter(color_color, linearColor),
|
7421
7462
|
background_backgroundColor,
|
7422
7463
|
datasetXY,
|
7423
7464
|
progressive,
|
7424
|
-
radiusAxis,
|
7425
7465
|
angleAxis,
|
7426
|
-
|
7427
|
-
tooltip_tooltip,
|
7466
|
+
radiusAxis,
|
7428
7467
|
verticalCrosshairRect,
|
7429
|
-
|
7468
|
+
colorRoseStyleFill(roseStyle),
|
7469
|
+
colorAdapter(discreteLegend, colorLegend),
|
7470
|
+
label_label,
|
7471
|
+
tooltip_tooltip
|
7430
7472
|
];
|
7431
7473
|
const pivotRose = [
|
7432
7474
|
initPivot,
|
@@ -7437,19 +7479,20 @@
|
|
7437
7479
|
initRose,
|
7438
7480
|
stackCornerRadius_stackCornerRadius,
|
7439
7481
|
stackInverse,
|
7440
|
-
color_color,
|
7482
|
+
colorAdapter(color_color, linearColor),
|
7441
7483
|
background_backgroundColor,
|
7442
7484
|
datasetXY,
|
7443
7485
|
progressive,
|
7444
7486
|
radiusAxis,
|
7445
7487
|
angleAxis,
|
7488
|
+
verticalCrosshairRect,
|
7489
|
+
colorRoseStyleFill(roseStyle),
|
7446
7490
|
label_label,
|
7447
|
-
tooltip_tooltip
|
7448
|
-
verticalCrosshairRect
|
7491
|
+
tooltip_tooltip
|
7449
7492
|
]),
|
7450
7493
|
pivotRowDimensions,
|
7451
7494
|
pivotColumnDimensions,
|
7452
|
-
pivotDiscreteLegend
|
7495
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7453
7496
|
];
|
7454
7497
|
const roseSpecPipeline = [
|
7455
7498
|
pivotAdapter_pivotAdapter(rose, pivotRose)
|
@@ -7518,15 +7561,16 @@
|
|
7518
7561
|
const roseParallel = [
|
7519
7562
|
initRoseParallel,
|
7520
7563
|
stackCornerRadius_stackCornerRadius,
|
7521
|
-
color_color,
|
7564
|
+
colorAdapter(color_color, linearColor),
|
7522
7565
|
background_backgroundColor,
|
7523
7566
|
datasetXY,
|
7524
7567
|
progressive,
|
7525
7568
|
radiusAxis,
|
7526
7569
|
angleAxis,
|
7570
|
+
colorRoseStyleFill(roseStyle),
|
7571
|
+
colorAdapter(discreteLegend, colorLegend),
|
7527
7572
|
label_label,
|
7528
7573
|
tooltip_tooltip,
|
7529
|
-
discreteLegend,
|
7530
7574
|
verticalCrosshairRect,
|
7531
7575
|
annotationPoint_annotationPoint,
|
7532
7576
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -7541,15 +7585,16 @@
|
|
7541
7585
|
pivotIndicators_pivotIndicators([
|
7542
7586
|
initRoseParallel,
|
7543
7587
|
stackCornerRadius_stackCornerRadius,
|
7544
|
-
color_color,
|
7588
|
+
colorAdapter(color_color, linearColor),
|
7545
7589
|
background_backgroundColor,
|
7546
7590
|
datasetXY,
|
7547
7591
|
progressive,
|
7548
7592
|
radiusAxis,
|
7549
7593
|
angleAxis,
|
7594
|
+
verticalCrosshairRect,
|
7595
|
+
colorRoseStyleFill(roseStyle),
|
7550
7596
|
label_label,
|
7551
7597
|
tooltip_tooltip,
|
7552
|
-
verticalCrosshairRect,
|
7553
7598
|
annotationPoint_annotationPoint,
|
7554
7599
|
annotationVerticalLine_annotationVerticalLine,
|
7555
7600
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7557,7 +7602,7 @@
|
|
7557
7602
|
]),
|
7558
7603
|
pivotRowDimensions,
|
7559
7604
|
pivotColumnDimensions,
|
7560
|
-
pivotDiscreteLegend
|
7605
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7561
7606
|
];
|
7562
7607
|
const roseParallelSpecPipeline = [
|
7563
7608
|
pivotAdapter_pivotAdapter(roseParallel, pivotRoseParallel)
|
@@ -7588,12 +7633,11 @@
|
|
7588
7633
|
encoding.radius = chunk_QJLMYOTX_i(measures.filter((item)=>'radius' === item.encoding || !item.encoding).map((item)=>item.id));
|
7589
7634
|
};
|
7590
7635
|
const radar_generateDefaultDimensionEncoding = (dimensions, encoding)=>{
|
7591
|
-
const onlyMeasureName = 1 === dimensions.length && dimensions.find((item)=>item.id === MeasureName);
|
7592
7636
|
const uniqueDimIds = chunk_QJLMYOTX_i(dimensions.map((d)=>d.id));
|
7593
7637
|
encoding.angle = uniqueDimIds.slice(0, 1);
|
7594
|
-
encoding.color = uniqueDimIds.slice(
|
7595
|
-
encoding.detail = uniqueDimIds.slice(onlyMeasureName ? 0 : 1);
|
7638
|
+
encoding.color = uniqueDimIds.slice(1);
|
7596
7639
|
encoding.tooltip = uniqueDimIds;
|
7640
|
+
encoding.detail = [];
|
7597
7641
|
encoding.label = [];
|
7598
7642
|
encoding.row = [];
|
7599
7643
|
encoding.column = [];
|
@@ -7605,14 +7649,13 @@
|
|
7605
7649
|
if (color.length > 0) encoding.color = color;
|
7606
7650
|
};
|
7607
7651
|
const radar_generateDimensionEncoding = (dimensions, encoding)=>{
|
7608
|
-
encoding.angle = chunk_QJLMYOTX_i(dimensions.filter((item)=>'angle' === item.encoding
|
7652
|
+
encoding.angle = chunk_QJLMYOTX_i(dimensions.filter((item)=>'angle' === item.encoding).map((item)=>item.id));
|
7609
7653
|
encoding.color = chunk_QJLMYOTX_i(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
7610
|
-
encoding.detail =
|
7654
|
+
encoding.detail = [];
|
7611
7655
|
if (0 === encoding.angle.length) encoding.angle = [
|
7612
7656
|
dimensions[0].id
|
7613
7657
|
];
|
7614
7658
|
if (0 === encoding.color.length) encoding.color = dimensions.filter((item)=>!encoding.angle?.includes(item.id)).map((item)=>item.id);
|
7615
|
-
if (0 === encoding.detail.length) encoding.detail = dimensions.filter((item)=>!encoding.angle?.includes(item.id)).map((item)=>item.id);
|
7616
7659
|
};
|
7617
7660
|
const radarAdvancedPipeline = [
|
7618
7661
|
initAdvancedVSeed_initAdvancedVSeed,
|
@@ -7828,34 +7871,55 @@
|
|
7828
7871
|
clip: true
|
7829
7872
|
}
|
7830
7873
|
];
|
7831
|
-
result.funnel = {
|
7832
|
-
style: {
|
7833
|
-
cornerRadius: 4,
|
7834
|
-
fill: {
|
7835
|
-
field: unfoldInfo.encodingColorId,
|
7836
|
-
scale: 'color'
|
7837
|
-
}
|
7838
|
-
},
|
7839
|
-
state: {
|
7840
|
-
hover: {
|
7841
|
-
fillOpacity: 0.6
|
7842
|
-
}
|
7843
|
-
}
|
7844
|
-
};
|
7845
7874
|
result.transformLabel = {
|
7846
7875
|
visible: true
|
7847
7876
|
};
|
7848
7877
|
result.animation = true;
|
7849
7878
|
return result;
|
7850
7879
|
};
|
7880
|
+
const colorFunnelStyleFill = (stylePipe)=>(spec, context)=>{
|
7881
|
+
const result = stylePipe(spec, context);
|
7882
|
+
const { advancedVSeed } = context;
|
7883
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7884
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
7885
|
+
if (isLinearColor(advancedVSeed)) {
|
7886
|
+
if (result?.funnel?.style) result.funnel.style.fill = {
|
7887
|
+
field: unfoldInfo.encodingColor,
|
7888
|
+
scale: 'color'
|
7889
|
+
};
|
7890
|
+
}
|
7891
|
+
return result;
|
7892
|
+
};
|
7893
|
+
const funnelStyle = (spec)=>{
|
7894
|
+
const result = {
|
7895
|
+
...spec,
|
7896
|
+
funnel: {
|
7897
|
+
style: {}
|
7898
|
+
}
|
7899
|
+
};
|
7900
|
+
return {
|
7901
|
+
...result,
|
7902
|
+
funnel: {
|
7903
|
+
style: {
|
7904
|
+
cornerRadius: 4
|
7905
|
+
},
|
7906
|
+
state: {
|
7907
|
+
hover: {
|
7908
|
+
fillOpacity: 0.6
|
7909
|
+
}
|
7910
|
+
}
|
7911
|
+
}
|
7912
|
+
};
|
7913
|
+
};
|
7851
7914
|
const funnel = [
|
7852
7915
|
initFunnel,
|
7853
7916
|
background_backgroundColor,
|
7854
7917
|
datasetXY,
|
7855
|
-
color_color,
|
7918
|
+
colorAdapter(color_color, linearColor),
|
7856
7919
|
label_label,
|
7920
|
+
colorAdapter(discreteLegend, colorLegend),
|
7921
|
+
colorFunnelStyleFill(funnelStyle),
|
7857
7922
|
tooltip_tooltip,
|
7858
|
-
discreteLegend,
|
7859
7923
|
annotationPoint_annotationPoint,
|
7860
7924
|
annotationVerticalLine_annotationVerticalLine,
|
7861
7925
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7870,17 +7934,18 @@
|
|
7870
7934
|
initFunnel,
|
7871
7935
|
background_backgroundColor,
|
7872
7936
|
datasetXY,
|
7873
|
-
color_color,
|
7937
|
+
colorAdapter(color_color, linearColor),
|
7874
7938
|
label_label,
|
7875
7939
|
tooltip_tooltip,
|
7876
|
-
|
7940
|
+
colorFunnelStyleFill(funnelStyle),
|
7877
7941
|
annotationPoint_annotationPoint,
|
7878
7942
|
annotationVerticalLine_annotationVerticalLine,
|
7879
7943
|
annotationHorizontalLine_annotationHorizontalLine,
|
7880
7944
|
annotationArea_annotationArea
|
7881
7945
|
]),
|
7882
7946
|
pivotRowDimensions,
|
7883
|
-
pivotColumnDimensions
|
7947
|
+
pivotColumnDimensions,
|
7948
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7884
7949
|
];
|
7885
7950
|
const funnelSpecPipeline = [
|
7886
7951
|
pivotAdapter_pivotAdapter(funnel, pivotFunnel)
|
@@ -7967,6 +8032,37 @@
|
|
7967
8032
|
};
|
7968
8033
|
return result;
|
7969
8034
|
};
|
8035
|
+
const colorCellStyleFill = (stylePipe)=>(spec, context)=>{
|
8036
|
+
const result = stylePipe(spec, context);
|
8037
|
+
const { advancedVSeed } = context;
|
8038
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
8039
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
8040
|
+
if (isLinearColor(advancedVSeed)) {
|
8041
|
+
if (result?.cell?.style) result.cell.style.fill = {
|
8042
|
+
field: unfoldInfo.encodingColor,
|
8043
|
+
scale: 'color'
|
8044
|
+
};
|
8045
|
+
}
|
8046
|
+
return result;
|
8047
|
+
};
|
8048
|
+
const cellStyle = (spec)=>{
|
8049
|
+
const result = {
|
8050
|
+
...spec,
|
8051
|
+
cell: {
|
8052
|
+
style: {}
|
8053
|
+
}
|
8054
|
+
};
|
8055
|
+
return {
|
8056
|
+
...result,
|
8057
|
+
cell: {
|
8058
|
+
style: {
|
8059
|
+
shape: 'rect',
|
8060
|
+
stroke: '#ffffff',
|
8061
|
+
lineWidth: 1
|
8062
|
+
}
|
8063
|
+
}
|
8064
|
+
};
|
8065
|
+
};
|
7970
8066
|
const initHeatmap = (spec, context)=>{
|
7971
8067
|
const result = {
|
7972
8068
|
...spec
|
@@ -7981,13 +8077,6 @@
|
|
7981
8077
|
result.seriesField = unfoldInfo.encodingColorId;
|
7982
8078
|
result.valueField = foldInfo.measureValue;
|
7983
8079
|
result.padding = 0;
|
7984
|
-
result.cell = {
|
7985
|
-
style: {
|
7986
|
-
shape: 'rect',
|
7987
|
-
stroke: '#ffffff',
|
7988
|
-
lineWidth: 1
|
7989
|
-
}
|
7990
|
-
};
|
7991
8080
|
result.axes = [
|
7992
8081
|
{
|
7993
8082
|
type: 'band',
|
@@ -8012,14 +8101,12 @@
|
|
8012
8101
|
initHeatmap,
|
8013
8102
|
background_backgroundColor,
|
8014
8103
|
datasetXY,
|
8015
|
-
color_color,
|
8104
|
+
colorAdapter(color_color, linearColor),
|
8016
8105
|
label_label,
|
8017
8106
|
labelColorInversion,
|
8018
|
-
discreteLegend,
|
8107
|
+
colorAdapter(discreteLegend, colorLegend),
|
8108
|
+
colorCellStyleFill(cellStyle),
|
8019
8109
|
tooltip_tooltip,
|
8020
|
-
pointStyle_pointStyle,
|
8021
|
-
pointStateDimensionHover,
|
8022
|
-
lineStyle_lineStyle,
|
8023
8110
|
annotationPoint_annotationPoint,
|
8024
8111
|
annotationVerticalLine_annotationVerticalLine,
|
8025
8112
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -8034,21 +8121,20 @@
|
|
8034
8121
|
initHeatmap,
|
8035
8122
|
background_backgroundColor,
|
8036
8123
|
datasetXY,
|
8037
|
-
color_color,
|
8124
|
+
colorAdapter(color_color, linearColor),
|
8038
8125
|
label_label,
|
8039
8126
|
labelColorInversion,
|
8040
8127
|
discreteLegend,
|
8041
8128
|
tooltip_tooltip,
|
8042
|
-
|
8043
|
-
pointStateDimensionHover,
|
8044
|
-
lineStyle_lineStyle,
|
8129
|
+
colorCellStyleFill(cellStyle),
|
8045
8130
|
annotationPoint_annotationPoint,
|
8046
8131
|
annotationVerticalLine_annotationVerticalLine,
|
8047
8132
|
annotationHorizontalLine_annotationHorizontalLine,
|
8048
8133
|
annotationArea_annotationArea
|
8049
8134
|
]),
|
8050
8135
|
pivotRowDimensions,
|
8051
|
-
pivotColumnDimensions
|
8136
|
+
pivotColumnDimensions,
|
8137
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
8052
8138
|
];
|
8053
8139
|
const heatmapSpecPipeline = [
|
8054
8140
|
pivotAdapter_pivotAdapter(heatmap, pivotHeatmap)
|