@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.js
CHANGED
@@ -1056,8 +1056,7 @@ const getBasicDimensions = (vseed)=>{
|
|
1056
1056
|
const { dimensions, dataset } = vseed;
|
1057
1057
|
const MeaName = {
|
1058
1058
|
id: MeasureName,
|
1059
|
-
alias: intl.i18n
|
1060
|
-
encoding: 'detail'
|
1059
|
+
alias: intl.i18n`指标名称`
|
1061
1060
|
};
|
1062
1061
|
if (!dataset) throw new Error('dataset is required');
|
1063
1062
|
if (0 === dataset.length) return [];
|
@@ -1142,12 +1141,11 @@ const generateDefaultMeasureEncoding = (measures, encoding)=>{
|
|
1142
1141
|
encoding.y = unique(measures.filter((item)=>'yAxis' === item.encoding || !item.encoding).map((item)=>item.id));
|
1143
1142
|
};
|
1144
1143
|
const generateDefaultDimensionEncoding = (dimensions, encoding)=>{
|
1145
|
-
const onlyMeasureName = 1 === dimensions.length && dimensions.find((item)=>item.id === MeasureName);
|
1146
1144
|
const uniqueDimIds = unique(dimensions.map((d)=>d.id));
|
1147
1145
|
encoding.x = uniqueDimIds.slice(0, 1);
|
1148
|
-
encoding.color = uniqueDimIds.slice(
|
1149
|
-
encoding.detail = uniqueDimIds.slice(onlyMeasureName ? 0 : 1);
|
1146
|
+
encoding.color = uniqueDimIds.slice(1);
|
1150
1147
|
encoding.tooltip = uniqueDimIds;
|
1148
|
+
encoding.detail = [];
|
1151
1149
|
encoding.label = [];
|
1152
1150
|
encoding.row = [];
|
1153
1151
|
encoding.column = [];
|
@@ -1159,14 +1157,13 @@ const generateMeasureEncoding = (measures, encoding)=>{
|
|
1159
1157
|
if (color.length > 0) encoding.color = color;
|
1160
1158
|
};
|
1161
1159
|
const generateDimensionEncoding = (dimensions, encoding)=>{
|
1162
|
-
encoding.x = unique(dimensions.filter((item)=>'xAxis' === item.encoding
|
1160
|
+
encoding.x = unique(dimensions.filter((item)=>'xAxis' === item.encoding).map((item)=>item.id));
|
1163
1161
|
encoding.color = unique(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
1164
|
-
encoding.detail =
|
1162
|
+
encoding.detail = [];
|
1165
1163
|
if (0 === encoding.x.length) encoding.x = [
|
1166
1164
|
dimensions[0].id
|
1167
1165
|
];
|
1168
1166
|
if (0 === encoding.color.length) encoding.color = dimensions.filter((item)=>!encoding.x?.includes(item.id)).map((item)=>item.id);
|
1169
|
-
if (0 === encoding.detail.length) encoding.detail = dimensions.filter((item)=>!encoding.x?.includes(item.id)).map((item)=>item.id);
|
1170
1167
|
};
|
1171
1168
|
const measureDepth = (measures = [])=>{
|
1172
1169
|
if (!measures) return 0;
|
@@ -2058,117 +2055,6 @@ const yLinear = (spec, context)=>{
|
|
2058
2055
|
];
|
2059
2056
|
return result;
|
2060
2057
|
};
|
2061
|
-
const label_label = (spec, context)=>{
|
2062
|
-
const result = {
|
2063
|
-
...spec
|
2064
|
-
};
|
2065
|
-
const { advancedVSeed } = context;
|
2066
|
-
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
2067
|
-
const { chartType } = advancedVSeed;
|
2068
|
-
const baseConfig = advancedVSeed.config[chartType];
|
2069
|
-
if (!baseConfig || !baseConfig.label) return result;
|
2070
|
-
const { measureId, measureValue } = datasetReshapeInfo[0].foldInfo;
|
2071
|
-
const { label } = baseConfig;
|
2072
|
-
const { enable } = label;
|
2073
|
-
result.label = {
|
2074
|
-
visible: enable,
|
2075
|
-
formatMethod: (value, datum)=>{
|
2076
|
-
const result = [];
|
2077
|
-
const formatValue = (value)=>{
|
2078
|
-
const id = datum[measureId];
|
2079
|
-
const measure = findMeasureById(measures, id);
|
2080
|
-
if (!measure) return value;
|
2081
|
-
const { format = {}, autoFormat = true } = measure;
|
2082
|
-
if (!external_remeda_isEmpty(format)) {
|
2083
|
-
const formatter = createFormatter(format);
|
2084
|
-
return formatter(value);
|
2085
|
-
}
|
2086
|
-
if (autoFormat) return autoFormatter(value, locale);
|
2087
|
-
return String(value);
|
2088
|
-
};
|
2089
|
-
result.push(formatValue(datum[measureValue]));
|
2090
|
-
return result.join(' ');
|
2091
|
-
}
|
2092
|
-
};
|
2093
|
-
return result;
|
2094
|
-
};
|
2095
|
-
const tooltip_tooltip = (spec, context)=>{
|
2096
|
-
const result = {
|
2097
|
-
...spec
|
2098
|
-
};
|
2099
|
-
const { advancedVSeed } = context;
|
2100
|
-
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
2101
|
-
const baseConfig = advancedVSeed.config[chartType];
|
2102
|
-
const { tooltip = {
|
2103
|
-
enable: true
|
2104
|
-
} } = baseConfig;
|
2105
|
-
const { enable } = tooltip;
|
2106
|
-
const { measureId, measureValue, measureName } = datasetReshapeInfo[0].foldInfo;
|
2107
|
-
const { encodingColor: colorName } = datasetReshapeInfo[0].unfoldInfo;
|
2108
|
-
result.tooltip = {
|
2109
|
-
visible: enable,
|
2110
|
-
mark: {
|
2111
|
-
title: {
|
2112
|
-
visible: true
|
2113
|
-
},
|
2114
|
-
content: [
|
2115
|
-
...dimensions.map((item)=>({
|
2116
|
-
visible: true,
|
2117
|
-
hasShape: true,
|
2118
|
-
shapeType: 'rectRound',
|
2119
|
-
key: (datum)=>{
|
2120
|
-
if (item.alias || item.id) return item.alias || item.id;
|
2121
|
-
return datum && datum[item.id];
|
2122
|
-
},
|
2123
|
-
value: (datum)=>datum && datum[item.id]
|
2124
|
-
})),
|
2125
|
-
{
|
2126
|
-
visible: true,
|
2127
|
-
hasShape: true,
|
2128
|
-
key: (datum)=>datum && datum[measureName || colorName] || '',
|
2129
|
-
value: (datum)=>{
|
2130
|
-
if (!datum) return '';
|
2131
|
-
const value = datum[measureValue];
|
2132
|
-
const id = datum[measureId];
|
2133
|
-
const measure = findMeasureById(measures, id);
|
2134
|
-
if (!measure) return String(value);
|
2135
|
-
const { format = {}, autoFormat = true } = measure;
|
2136
|
-
if (!external_remeda_isEmpty(format)) {
|
2137
|
-
const formatter = createFormatter(format);
|
2138
|
-
return formatter(value);
|
2139
|
-
}
|
2140
|
-
if (autoFormat) return autoFormatter(value, locale);
|
2141
|
-
return String(value);
|
2142
|
-
}
|
2143
|
-
}
|
2144
|
-
]
|
2145
|
-
},
|
2146
|
-
dimension: {
|
2147
|
-
content: [
|
2148
|
-
{
|
2149
|
-
visible: true,
|
2150
|
-
key: (datum)=>datum && datum[colorName] || '',
|
2151
|
-
value: (datum)=>{
|
2152
|
-
if (!datum) return '';
|
2153
|
-
const value = datum[measureValue];
|
2154
|
-
const id = datum[measureId];
|
2155
|
-
const measure = findMeasureById(measures, id);
|
2156
|
-
if (!measure) return String(value);
|
2157
|
-
const { format = {}, autoFormat = true } = measure;
|
2158
|
-
if (!external_remeda_isEmpty(format)) {
|
2159
|
-
const formatter = createFormatter(format);
|
2160
|
-
return formatter(value);
|
2161
|
-
}
|
2162
|
-
if (autoFormat) return autoFormatter(value, locale);
|
2163
|
-
return String(value);
|
2164
|
-
},
|
2165
|
-
shapeType: 'rectRound'
|
2166
|
-
}
|
2167
|
-
]
|
2168
|
-
}
|
2169
|
-
};
|
2170
|
-
return result;
|
2171
|
-
};
|
2172
2058
|
const verticalCrosshairLine = (spec, context)=>{
|
2173
2059
|
const result = {
|
2174
2060
|
...spec
|
@@ -2677,6 +2563,117 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2677
2563
|
}
|
2678
2564
|
};
|
2679
2565
|
};
|
2566
|
+
const label_label = (spec, context)=>{
|
2567
|
+
const result = {
|
2568
|
+
...spec
|
2569
|
+
};
|
2570
|
+
const { advancedVSeed } = context;
|
2571
|
+
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
2572
|
+
const { chartType } = advancedVSeed;
|
2573
|
+
const baseConfig = advancedVSeed.config[chartType];
|
2574
|
+
if (!baseConfig || !baseConfig.label) return result;
|
2575
|
+
const { measureId, measureValue } = datasetReshapeInfo[0].foldInfo;
|
2576
|
+
const { label } = baseConfig;
|
2577
|
+
const { enable } = label;
|
2578
|
+
result.label = {
|
2579
|
+
visible: enable,
|
2580
|
+
formatMethod: (value, datum)=>{
|
2581
|
+
const result = [];
|
2582
|
+
const formatValue = (value)=>{
|
2583
|
+
const id = datum[measureId];
|
2584
|
+
const measure = findMeasureById(measures, id);
|
2585
|
+
if (!measure) return value;
|
2586
|
+
const { format = {}, autoFormat = true } = measure;
|
2587
|
+
if (!external_remeda_isEmpty(format)) {
|
2588
|
+
const formatter = createFormatter(format);
|
2589
|
+
return formatter(value);
|
2590
|
+
}
|
2591
|
+
if (autoFormat) return autoFormatter(value, locale);
|
2592
|
+
return String(value);
|
2593
|
+
};
|
2594
|
+
result.push(formatValue(datum[measureValue]));
|
2595
|
+
return result.join(' ');
|
2596
|
+
}
|
2597
|
+
};
|
2598
|
+
return result;
|
2599
|
+
};
|
2600
|
+
const tooltip_tooltip = (spec, context)=>{
|
2601
|
+
const result = {
|
2602
|
+
...spec
|
2603
|
+
};
|
2604
|
+
const { advancedVSeed } = context;
|
2605
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
2606
|
+
const baseConfig = advancedVSeed.config[chartType];
|
2607
|
+
const { tooltip = {
|
2608
|
+
enable: true
|
2609
|
+
} } = baseConfig;
|
2610
|
+
const { enable } = tooltip;
|
2611
|
+
const { measureId, measureValue, measureName } = datasetReshapeInfo[0].foldInfo;
|
2612
|
+
const { encodingColor: colorName } = datasetReshapeInfo[0].unfoldInfo;
|
2613
|
+
result.tooltip = {
|
2614
|
+
visible: enable,
|
2615
|
+
mark: {
|
2616
|
+
title: {
|
2617
|
+
visible: true
|
2618
|
+
},
|
2619
|
+
content: [
|
2620
|
+
...dimensions.map((item)=>({
|
2621
|
+
visible: true,
|
2622
|
+
hasShape: true,
|
2623
|
+
shapeType: 'rectRound',
|
2624
|
+
key: (datum)=>{
|
2625
|
+
if (item.alias || item.id) return item.alias || item.id;
|
2626
|
+
return datum && datum[item.id];
|
2627
|
+
},
|
2628
|
+
value: (datum)=>datum && datum[item.id]
|
2629
|
+
})),
|
2630
|
+
{
|
2631
|
+
visible: true,
|
2632
|
+
hasShape: true,
|
2633
|
+
key: (datum)=>datum && datum[measureName || colorName] || '',
|
2634
|
+
value: (datum)=>{
|
2635
|
+
if (!datum) return '';
|
2636
|
+
const value = datum[measureValue];
|
2637
|
+
const id = datum[measureId];
|
2638
|
+
const measure = findMeasureById(measures, id);
|
2639
|
+
if (!measure) return String(value);
|
2640
|
+
const { format = {}, autoFormat = true } = measure;
|
2641
|
+
if (!external_remeda_isEmpty(format)) {
|
2642
|
+
const formatter = createFormatter(format);
|
2643
|
+
return formatter(value);
|
2644
|
+
}
|
2645
|
+
if (autoFormat) return autoFormatter(value, locale);
|
2646
|
+
return String(value);
|
2647
|
+
}
|
2648
|
+
}
|
2649
|
+
]
|
2650
|
+
},
|
2651
|
+
dimension: {
|
2652
|
+
content: [
|
2653
|
+
{
|
2654
|
+
visible: true,
|
2655
|
+
key: (datum)=>datum && datum[colorName] || '',
|
2656
|
+
value: (datum)=>{
|
2657
|
+
if (!datum) return '';
|
2658
|
+
const value = datum[measureValue];
|
2659
|
+
const id = datum[measureId];
|
2660
|
+
const measure = findMeasureById(measures, id);
|
2661
|
+
if (!measure) return String(value);
|
2662
|
+
const { format = {}, autoFormat = true } = measure;
|
2663
|
+
if (!external_remeda_isEmpty(format)) {
|
2664
|
+
const formatter = createFormatter(format);
|
2665
|
+
return formatter(value);
|
2666
|
+
}
|
2667
|
+
if (autoFormat) return autoFormatter(value, locale);
|
2668
|
+
return String(value);
|
2669
|
+
},
|
2670
|
+
shapeType: 'rectRound'
|
2671
|
+
}
|
2672
|
+
]
|
2673
|
+
}
|
2674
|
+
};
|
2675
|
+
return result;
|
2676
|
+
};
|
2680
2677
|
const isSubset = (sub, obj)=>Object.entries(sub).every(([key, value])=>{
|
2681
2678
|
if ('string' == typeof value) return obj[key] === value;
|
2682
2679
|
if ('number' == typeof value) return obj[key] === value;
|
@@ -3435,31 +3432,118 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3435
3432
|
legends
|
3436
3433
|
};
|
3437
3434
|
};
|
3438
|
-
const
|
3439
|
-
|
3440
|
-
|
3441
|
-
if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
|
3442
|
-
return execPipeline(pipeline, context, spec);
|
3435
|
+
const pivotColorLegend = (spec, context)=>{
|
3436
|
+
const result = {
|
3437
|
+
...spec
|
3443
3438
|
};
|
3444
|
-
const
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
|
3456
|
-
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
|
3461
|
-
|
3462
|
-
|
3439
|
+
const { advancedVSeed } = context;
|
3440
|
+
const { chartType } = advancedVSeed;
|
3441
|
+
const baseConfig = advancedVSeed.config[chartType];
|
3442
|
+
if (!baseConfig || !baseConfig.legend) return result;
|
3443
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
3444
|
+
const max = Math.max(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[1]));
|
3445
|
+
const min = Math.min(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[0]));
|
3446
|
+
const { legend, color } = baseConfig;
|
3447
|
+
const { colorScheme, linearColorScheme } = color;
|
3448
|
+
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400 } = legend || {};
|
3449
|
+
const orient = [
|
3450
|
+
'bottom',
|
3451
|
+
'bottomLeft',
|
3452
|
+
'bottomRight',
|
3453
|
+
'bl',
|
3454
|
+
'br'
|
3455
|
+
].includes(position) ? 'bottom' : [
|
3456
|
+
'top',
|
3457
|
+
'topLeft',
|
3458
|
+
'topRight',
|
3459
|
+
'tl',
|
3460
|
+
'tr'
|
3461
|
+
].includes(position) ? 'top' : [
|
3462
|
+
'left',
|
3463
|
+
'leftTop',
|
3464
|
+
'leftBottom',
|
3465
|
+
'lt',
|
3466
|
+
'lb'
|
3467
|
+
].includes(position) ? 'left' : 'right';
|
3468
|
+
const legendPosition = [
|
3469
|
+
'topLeft',
|
3470
|
+
'bottomLeft',
|
3471
|
+
'leftTop',
|
3472
|
+
'rightTop',
|
3473
|
+
'lt',
|
3474
|
+
'rt',
|
3475
|
+
'tl',
|
3476
|
+
'bl'
|
3477
|
+
].includes(position) ? 'start' : [
|
3478
|
+
'topRight',
|
3479
|
+
'bottomRight',
|
3480
|
+
'leftBottom',
|
3481
|
+
'rightBottom',
|
3482
|
+
'lb',
|
3483
|
+
'rb',
|
3484
|
+
'rt',
|
3485
|
+
'br'
|
3486
|
+
].includes(position) ? 'end' : 'middle';
|
3487
|
+
const legends = {
|
3488
|
+
visible: enable,
|
3489
|
+
type: 'color',
|
3490
|
+
orient,
|
3491
|
+
position: legendPosition,
|
3492
|
+
colors: linearColorScheme || colorScheme || [],
|
3493
|
+
value: [
|
3494
|
+
min,
|
3495
|
+
max
|
3496
|
+
],
|
3497
|
+
min: min,
|
3498
|
+
max: max,
|
3499
|
+
maxWidth: '30%',
|
3500
|
+
startText: {
|
3501
|
+
visible: true,
|
3502
|
+
style: {
|
3503
|
+
fill: labelFontColor,
|
3504
|
+
fontSize: labelFontSize,
|
3505
|
+
fontWeight: labelFontWeight
|
3506
|
+
}
|
3507
|
+
},
|
3508
|
+
endText: {
|
3509
|
+
visible: true,
|
3510
|
+
style: {
|
3511
|
+
fill: labelFontColor,
|
3512
|
+
fontSize: labelFontSize,
|
3513
|
+
fontWeight: labelFontWeight
|
3514
|
+
}
|
3515
|
+
}
|
3516
|
+
};
|
3517
|
+
return {
|
3518
|
+
...result,
|
3519
|
+
legends
|
3520
|
+
};
|
3521
|
+
};
|
3522
|
+
const pivotAdapter_pivotAdapter = (pipeline, pivotPipeline)=>(spec, context)=>{
|
3523
|
+
const { vseed } = context;
|
3524
|
+
const usePivotChart = isPivotChart(vseed);
|
3525
|
+
if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
|
3526
|
+
return execPipeline(pipeline, context, spec);
|
3527
|
+
};
|
3528
|
+
const line_line = [
|
3529
|
+
initLine,
|
3530
|
+
colorAdapter(color_color, linearColor),
|
3531
|
+
background_backgroundColor,
|
3532
|
+
datasetXY,
|
3533
|
+
progressive,
|
3534
|
+
xBand,
|
3535
|
+
yLinear,
|
3536
|
+
verticalCrosshairLine,
|
3537
|
+
colorAdapter(discreteLegend, colorLegend),
|
3538
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
3539
|
+
pointStateDimensionHover,
|
3540
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
3541
|
+
label_label,
|
3542
|
+
tooltip_tooltip,
|
3543
|
+
annotationPoint_annotationPoint,
|
3544
|
+
annotationVerticalLine_annotationVerticalLine,
|
3545
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
3546
|
+
annotationArea_annotationArea
|
3463
3547
|
];
|
3464
3548
|
const pivotLine = [
|
3465
3549
|
initPivot,
|
@@ -3468,18 +3552,18 @@ const pivotLine = [
|
|
3468
3552
|
datasetPivot,
|
3469
3553
|
pivotIndicators_pivotIndicators([
|
3470
3554
|
initLine,
|
3471
|
-
color_color,
|
3555
|
+
colorAdapter(color_color, linearColor),
|
3472
3556
|
background_backgroundColor,
|
3473
3557
|
datasetXY,
|
3474
3558
|
progressive,
|
3475
3559
|
xBand,
|
3476
3560
|
yLinear,
|
3477
|
-
label_label,
|
3478
|
-
tooltip_tooltip,
|
3479
3561
|
verticalCrosshairLine,
|
3480
|
-
pointStyle_pointStyle,
|
3562
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
3481
3563
|
pointStateDimensionHover,
|
3482
|
-
lineStyle_lineStyle,
|
3564
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
3565
|
+
label_label,
|
3566
|
+
tooltip_tooltip,
|
3483
3567
|
annotationPoint_annotationPoint,
|
3484
3568
|
annotationVerticalLine_annotationVerticalLine,
|
3485
3569
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -3487,7 +3571,7 @@ const pivotLine = [
|
|
3487
3571
|
]),
|
3488
3572
|
pivotRowDimensions,
|
3489
3573
|
pivotColumnDimensions,
|
3490
|
-
pivotDiscreteLegend
|
3574
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
3491
3575
|
];
|
3492
3576
|
const lineSpecPipeline = [
|
3493
3577
|
pivotAdapter_pivotAdapter(line_line, pivotLine)
|
@@ -3536,7 +3620,7 @@ const column_generateMeasureEncoding = (measures, encoding)=>{
|
|
3536
3620
|
return encoding;
|
3537
3621
|
};
|
3538
3622
|
const column_generateDimensionEncoding = (dimensions, encoding)=>{
|
3539
|
-
encoding.x = unique(dimensions.filter((item)=>'xAxis' === item.encoding
|
3623
|
+
encoding.x = unique(dimensions.filter((item)=>'xAxis' === item.encoding).map((item)=>item.id));
|
3540
3624
|
encoding.color = unique(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
3541
3625
|
encoding.detail = unique(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
3542
3626
|
if (0 === encoding.x.length) encoding.x = [
|
@@ -3852,93 +3936,6 @@ const annotationAreaBand = (spec, context)=>{
|
|
3852
3936
|
markArea: markArea
|
3853
3937
|
};
|
3854
3938
|
};
|
3855
|
-
const pivotColorLegend = (spec, context)=>{
|
3856
|
-
const result = {
|
3857
|
-
...spec
|
3858
|
-
};
|
3859
|
-
const { advancedVSeed } = context;
|
3860
|
-
const { chartType } = advancedVSeed;
|
3861
|
-
const baseConfig = advancedVSeed.config[chartType];
|
3862
|
-
if (!baseConfig || !baseConfig.legend) return result;
|
3863
|
-
const { datasetReshapeInfo } = advancedVSeed;
|
3864
|
-
const max = Math.max(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[1]));
|
3865
|
-
const min = Math.min(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[0]));
|
3866
|
-
const { legend, color } = baseConfig;
|
3867
|
-
const { colorScheme, linearColorScheme } = color;
|
3868
|
-
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400 } = legend || {};
|
3869
|
-
const orient = [
|
3870
|
-
'bottom',
|
3871
|
-
'bottomLeft',
|
3872
|
-
'bottomRight',
|
3873
|
-
'bl',
|
3874
|
-
'br'
|
3875
|
-
].includes(position) ? 'bottom' : [
|
3876
|
-
'top',
|
3877
|
-
'topLeft',
|
3878
|
-
'topRight',
|
3879
|
-
'tl',
|
3880
|
-
'tr'
|
3881
|
-
].includes(position) ? 'top' : [
|
3882
|
-
'left',
|
3883
|
-
'leftTop',
|
3884
|
-
'leftBottom',
|
3885
|
-
'lt',
|
3886
|
-
'lb'
|
3887
|
-
].includes(position) ? 'left' : 'right';
|
3888
|
-
const legendPosition = [
|
3889
|
-
'topLeft',
|
3890
|
-
'bottomLeft',
|
3891
|
-
'leftTop',
|
3892
|
-
'rightTop',
|
3893
|
-
'lt',
|
3894
|
-
'rt',
|
3895
|
-
'tl',
|
3896
|
-
'bl'
|
3897
|
-
].includes(position) ? 'start' : [
|
3898
|
-
'topRight',
|
3899
|
-
'bottomRight',
|
3900
|
-
'leftBottom',
|
3901
|
-
'rightBottom',
|
3902
|
-
'lb',
|
3903
|
-
'rb',
|
3904
|
-
'rt',
|
3905
|
-
'br'
|
3906
|
-
].includes(position) ? 'end' : 'middle';
|
3907
|
-
const legends = {
|
3908
|
-
visible: enable,
|
3909
|
-
type: 'color',
|
3910
|
-
orient,
|
3911
|
-
position: legendPosition,
|
3912
|
-
colors: linearColorScheme || colorScheme || [],
|
3913
|
-
value: [
|
3914
|
-
min,
|
3915
|
-
max
|
3916
|
-
],
|
3917
|
-
min: min,
|
3918
|
-
max: max,
|
3919
|
-
maxWidth: '30%',
|
3920
|
-
startText: {
|
3921
|
-
visible: true,
|
3922
|
-
style: {
|
3923
|
-
fill: labelFontColor,
|
3924
|
-
fontSize: labelFontSize,
|
3925
|
-
fontWeight: labelFontWeight
|
3926
|
-
}
|
3927
|
-
},
|
3928
|
-
endText: {
|
3929
|
-
visible: true,
|
3930
|
-
style: {
|
3931
|
-
fill: labelFontColor,
|
3932
|
-
fontSize: labelFontSize,
|
3933
|
-
fontWeight: labelFontWeight
|
3934
|
-
}
|
3935
|
-
}
|
3936
|
-
};
|
3937
|
-
return {
|
3938
|
-
...result,
|
3939
|
-
legends
|
3940
|
-
};
|
3941
|
-
};
|
3942
3939
|
const column = [
|
3943
3940
|
initColumn,
|
3944
3941
|
stackCornerRadius_stackCornerRadius,
|
@@ -4212,7 +4209,7 @@ const bar_generateMeasureEncoding = (measures, encoding)=>{
|
|
4212
4209
|
return encoding;
|
4213
4210
|
};
|
4214
4211
|
const bar_generateDimensionEncoding = (dimensions, encoding)=>{
|
4215
|
-
encoding.y = unique(dimensions.filter((item)=>'yAxis' === item.encoding
|
4212
|
+
encoding.y = unique(dimensions.filter((item)=>'yAxis' === item.encoding).map((item)=>item.id));
|
4216
4213
|
encoding.color = unique(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
4217
4214
|
encoding.detail = unique(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
4218
4215
|
if (0 === encoding.y.length) encoding.y = [
|
@@ -4759,7 +4756,7 @@ const registerBarPercent = ()=>{
|
|
4759
4756
|
};
|
4760
4757
|
const areaAdvancedPipeline = [
|
4761
4758
|
initAdvancedVSeed_initAdvancedVSeed,
|
4762
|
-
|
4759
|
+
encodingForLine,
|
4763
4760
|
buildMeasures,
|
4764
4761
|
autoDimensions_autoDimensions,
|
4765
4762
|
pivotAdapter([
|
@@ -4917,7 +4914,7 @@ const registerArea = ()=>{
|
|
4917
4914
|
};
|
4918
4915
|
const areaPercentAdvancedPipeline = [
|
4919
4916
|
initAdvancedVSeed_initAdvancedVSeed,
|
4920
|
-
|
4917
|
+
encodingForLine,
|
4921
4918
|
buildMeasures,
|
4922
4919
|
autoDimensions_autoDimensions,
|
4923
4920
|
pivotAdapter([
|
@@ -5404,7 +5401,7 @@ const pivotScatter = [
|
|
5404
5401
|
]),
|
5405
5402
|
pivotRowDimensions,
|
5406
5403
|
pivotColumnDimensions,
|
5407
|
-
pivotDiscreteLegend
|
5404
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
5408
5405
|
];
|
5409
5406
|
const scatterSpecPipeline = [
|
5410
5407
|
pivotAdapter_pivotAdapter(scatter, pivotScatter)
|
@@ -5453,7 +5450,7 @@ const dualAxis_generateMeasureEncoding = (measures, encoding)=>{
|
|
5453
5450
|
return encoding;
|
5454
5451
|
};
|
5455
5452
|
const dualAxis_generateDimensionEncoding = (dimensions, encoding)=>{
|
5456
|
-
encoding.x = unique(dimensions.filter((item)=>'xAxis' === item.encoding
|
5453
|
+
encoding.x = unique(dimensions.filter((item)=>'xAxis' === item.encoding).map((item)=>item.id));
|
5457
5454
|
encoding.color = unique(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
5458
5455
|
encoding.detail = unique(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
5459
5456
|
if (0 === encoding.x.length) encoding.x = [
|
@@ -6607,9 +6604,8 @@ const initPie = (spec, context)=>{
|
|
6607
6604
|
...spec
|
6608
6605
|
};
|
6609
6606
|
const { advancedVSeed } = context;
|
6610
|
-
const { datasetReshapeInfo
|
6607
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6611
6608
|
const { unfoldInfo, foldInfo } = datasetReshapeInfo[0];
|
6612
|
-
const showStroke = dataset.length <= 30;
|
6613
6609
|
result.type = 'pie';
|
6614
6610
|
result.outerRadius = 0.8;
|
6615
6611
|
result.innerRadius = 0;
|
@@ -6621,30 +6617,57 @@ const initPie = (spec, context)=>{
|
|
6621
6617
|
clip: true
|
6622
6618
|
}
|
6623
6619
|
];
|
6624
|
-
result.
|
6625
|
-
|
6626
|
-
|
6627
|
-
|
6628
|
-
|
6629
|
-
}
|
6630
|
-
|
6631
|
-
|
6632
|
-
|
6620
|
+
result.animation = true;
|
6621
|
+
return result;
|
6622
|
+
};
|
6623
|
+
const colorPieStyleFill = (stylePipe)=>(spec, context)=>{
|
6624
|
+
const result = stylePipe(spec, context);
|
6625
|
+
const { advancedVSeed } = context;
|
6626
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6627
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
6628
|
+
if (isLinearColor(advancedVSeed)) {
|
6629
|
+
if (result?.pie?.style) result.pie.style.fill = {
|
6630
|
+
field: unfoldInfo.encodingColor,
|
6631
|
+
scale: 'color'
|
6632
|
+
};
|
6633
|
+
}
|
6634
|
+
return result;
|
6635
|
+
};
|
6636
|
+
const pieStyle = (spec, context)=>{
|
6637
|
+
const { advancedVSeed } = context;
|
6638
|
+
const { dataset } = advancedVSeed;
|
6639
|
+
const showStroke = dataset.length <= 30;
|
6640
|
+
const result = {
|
6641
|
+
...spec,
|
6642
|
+
pie: {
|
6643
|
+
style: {}
|
6644
|
+
}
|
6645
|
+
};
|
6646
|
+
return {
|
6647
|
+
...result,
|
6648
|
+
pie: {
|
6649
|
+
style: {
|
6650
|
+
stroke: '#ffffff',
|
6651
|
+
lineWidth: showStroke ? 1 : 0
|
6652
|
+
},
|
6653
|
+
state: {
|
6654
|
+
hover: {
|
6655
|
+
outerRadius: 1.1 * result.outerRadius
|
6656
|
+
}
|
6633
6657
|
}
|
6634
6658
|
}
|
6635
6659
|
};
|
6636
|
-
result.animation = true;
|
6637
|
-
return result;
|
6638
6660
|
};
|
6639
6661
|
const pie = [
|
6640
6662
|
initPie,
|
6641
|
-
color_color,
|
6663
|
+
colorAdapter(color_color, linearColor),
|
6642
6664
|
background_backgroundColor,
|
6643
6665
|
datasetXY,
|
6644
6666
|
progressive,
|
6667
|
+
colorPieStyleFill(pieStyle),
|
6668
|
+
colorAdapter(discreteLegend, colorLegend),
|
6645
6669
|
label_label,
|
6646
6670
|
tooltip_tooltip,
|
6647
|
-
discreteLegend,
|
6648
6671
|
annotationPoint_annotationPoint,
|
6649
6672
|
annotationVerticalLine_annotationVerticalLine,
|
6650
6673
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -6657,10 +6680,11 @@ const pivotPie = [
|
|
6657
6680
|
datasetPivot,
|
6658
6681
|
pivotIndicators_pivotIndicators([
|
6659
6682
|
initPie,
|
6660
|
-
color_color,
|
6683
|
+
colorAdapter(color_color, linearColor),
|
6661
6684
|
background_backgroundColor,
|
6662
6685
|
datasetXY,
|
6663
6686
|
progressive,
|
6687
|
+
colorPieStyleFill(pieStyle),
|
6664
6688
|
label_label,
|
6665
6689
|
tooltip_tooltip,
|
6666
6690
|
annotationPoint_annotationPoint,
|
@@ -6670,7 +6694,7 @@ const pivotPie = [
|
|
6670
6694
|
]),
|
6671
6695
|
pivotRowDimensions,
|
6672
6696
|
pivotColumnDimensions,
|
6673
|
-
pivotDiscreteLegend
|
6697
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
6674
6698
|
];
|
6675
6699
|
const pieSpecPipeline = [
|
6676
6700
|
pivotAdapter_pivotAdapter(pie, pivotPie)
|
@@ -6698,9 +6722,8 @@ const initDonut = (spec, context)=>{
|
|
6698
6722
|
...spec
|
6699
6723
|
};
|
6700
6724
|
const { advancedVSeed } = context;
|
6701
|
-
const { datasetReshapeInfo
|
6725
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6702
6726
|
const { foldInfo, unfoldInfo } = datasetReshapeInfo[0];
|
6703
|
-
const showStroke = dataset.length <= 30;
|
6704
6727
|
result.type = 'pie';
|
6705
6728
|
result.outerRadius = 0.8;
|
6706
6729
|
result.innerRadius = 0.8 * result.outerRadius;
|
@@ -6712,29 +6735,19 @@ const initDonut = (spec, context)=>{
|
|
6712
6735
|
clip: true
|
6713
6736
|
}
|
6714
6737
|
];
|
6715
|
-
result.pie = {
|
6716
|
-
style: {
|
6717
|
-
stroke: '#ffffff',
|
6718
|
-
lineWidth: showStroke ? 1 : 0
|
6719
|
-
},
|
6720
|
-
state: {
|
6721
|
-
hover: {
|
6722
|
-
outerRadius: 1.1 * result.outerRadius
|
6723
|
-
}
|
6724
|
-
}
|
6725
|
-
};
|
6726
6738
|
result.animation = true;
|
6727
6739
|
return result;
|
6728
6740
|
};
|
6729
6741
|
const donut = [
|
6730
6742
|
initDonut,
|
6731
|
-
color_color,
|
6743
|
+
colorAdapter(color_color, linearColor),
|
6732
6744
|
background_backgroundColor,
|
6733
6745
|
datasetXY,
|
6734
6746
|
progressive,
|
6735
6747
|
label_label,
|
6748
|
+
colorPieStyleFill(pieStyle),
|
6749
|
+
colorAdapter(discreteLegend, colorLegend),
|
6736
6750
|
tooltip_tooltip,
|
6737
|
-
discreteLegend,
|
6738
6751
|
annotationPoint_annotationPoint,
|
6739
6752
|
annotationVerticalLine_annotationVerticalLine,
|
6740
6753
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -6747,11 +6760,12 @@ const pivotDonut = [
|
|
6747
6760
|
datasetPivot,
|
6748
6761
|
pivotIndicators_pivotIndicators([
|
6749
6762
|
initDonut,
|
6750
|
-
color_color,
|
6763
|
+
colorAdapter(color_color, linearColor),
|
6751
6764
|
background_backgroundColor,
|
6752
6765
|
datasetXY,
|
6753
6766
|
progressive,
|
6754
6767
|
label_label,
|
6768
|
+
colorPieStyleFill(pieStyle),
|
6755
6769
|
tooltip_tooltip,
|
6756
6770
|
annotationPoint_annotationPoint,
|
6757
6771
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -6760,7 +6774,7 @@ const pivotDonut = [
|
|
6760
6774
|
]),
|
6761
6775
|
pivotRowDimensions,
|
6762
6776
|
pivotColumnDimensions,
|
6763
|
-
pivotDiscreteLegend
|
6777
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
6764
6778
|
];
|
6765
6779
|
const donutSpecPipeline = [
|
6766
6780
|
pivotAdapter_pivotAdapter(donut, pivotDonut)
|
@@ -6808,7 +6822,7 @@ const rose_generateMeasureEncoding = (measures, encoding)=>{
|
|
6808
6822
|
if (color.length > 0) encoding.color = color;
|
6809
6823
|
};
|
6810
6824
|
const rose_generateDimensionEncoding = (dimensions, encoding)=>{
|
6811
|
-
encoding.angle = unique(dimensions.filter((item)=>'angle' === item.encoding
|
6825
|
+
encoding.angle = unique(dimensions.filter((item)=>'angle' === item.encoding).map((item)=>item.id));
|
6812
6826
|
encoding.color = unique(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
6813
6827
|
encoding.detail = unique(dimensions.filter((item)=>'detail' === item.encoding).map((item)=>item.id));
|
6814
6828
|
if (0 === encoding.angle.length) encoding.angle = [
|
@@ -6848,18 +6862,6 @@ const initRose = (spec, context)=>{
|
|
6848
6862
|
result.innerRadius = 0;
|
6849
6863
|
const hasNegativeValue = dataset.flat().find((d)=>d[foldInfo.measureValue] < 0);
|
6850
6864
|
if (hasNegativeValue) result.innerRadius = 0.05;
|
6851
|
-
result.rose = {
|
6852
|
-
style: {
|
6853
|
-
stroke: '#ffffff',
|
6854
|
-
lineWidth: 1
|
6855
|
-
},
|
6856
|
-
state: {
|
6857
|
-
hover: {
|
6858
|
-
lineWidth: 1,
|
6859
|
-
fillOpacity: 0.6
|
6860
|
-
}
|
6861
|
-
}
|
6862
|
-
};
|
6863
6865
|
result.region = [
|
6864
6866
|
{
|
6865
6867
|
clip: true
|
@@ -6868,7 +6870,7 @@ const initRose = (spec, context)=>{
|
|
6868
6870
|
result.animation = true;
|
6869
6871
|
return result;
|
6870
6872
|
};
|
6871
|
-
const
|
6873
|
+
const angleAxis = (spec, context)=>{
|
6872
6874
|
const result = {
|
6873
6875
|
...spec
|
6874
6876
|
};
|
@@ -6880,26 +6882,37 @@ const radiusAxis = (spec, context)=>{
|
|
6880
6882
|
const showAxis = !(is0D || is1M1D);
|
6881
6883
|
if (!result.axes) result.axes = [];
|
6882
6884
|
result.axes.push({
|
6883
|
-
orient: '
|
6885
|
+
orient: 'angle',
|
6884
6886
|
visible: showAxis,
|
6885
6887
|
zero: true,
|
6886
6888
|
nice: !!showAxis,
|
6889
|
+
paddingInner: showAxis ? [
|
6890
|
+
0.15,
|
6891
|
+
0.1
|
6892
|
+
] : [
|
6893
|
+
0,
|
6894
|
+
0
|
6895
|
+
],
|
6896
|
+
paddingOuter: showAxis ? [
|
6897
|
+
0.075,
|
6898
|
+
0.1
|
6899
|
+
] : [
|
6900
|
+
0,
|
6901
|
+
0
|
6902
|
+
],
|
6887
6903
|
grid: {
|
6888
6904
|
visible: showAxis
|
6889
6905
|
},
|
6890
|
-
|
6891
|
-
visible: showAxis
|
6892
|
-
},
|
6893
|
-
label: {
|
6906
|
+
domainLine: {
|
6894
6907
|
visible: showAxis
|
6895
6908
|
},
|
6896
|
-
|
6909
|
+
tick: {
|
6897
6910
|
visible: showAxis
|
6898
6911
|
}
|
6899
6912
|
});
|
6900
6913
|
return result;
|
6901
6914
|
};
|
6902
|
-
const
|
6915
|
+
const radiusAxis = (spec, context)=>{
|
6903
6916
|
const result = {
|
6904
6917
|
...spec
|
6905
6918
|
};
|
@@ -6911,50 +6924,79 @@ const angleAxis = (spec, context)=>{
|
|
6911
6924
|
const showAxis = !(is0D || is1M1D);
|
6912
6925
|
if (!result.axes) result.axes = [];
|
6913
6926
|
result.axes.push({
|
6914
|
-
orient: '
|
6927
|
+
orient: 'radius',
|
6915
6928
|
visible: showAxis,
|
6916
6929
|
zero: true,
|
6917
6930
|
nice: !!showAxis,
|
6918
|
-
paddingInner: showAxis ? [
|
6919
|
-
0.15,
|
6920
|
-
0.1
|
6921
|
-
] : [
|
6922
|
-
0,
|
6923
|
-
0
|
6924
|
-
],
|
6925
|
-
paddingOuter: showAxis ? [
|
6926
|
-
0.075,
|
6927
|
-
0.1
|
6928
|
-
] : [
|
6929
|
-
0,
|
6930
|
-
0
|
6931
|
-
],
|
6932
6931
|
grid: {
|
6933
6932
|
visible: showAxis
|
6934
6933
|
},
|
6935
|
-
|
6934
|
+
tick: {
|
6936
6935
|
visible: showAxis
|
6937
6936
|
},
|
6938
|
-
|
6937
|
+
label: {
|
6938
|
+
visible: showAxis
|
6939
|
+
},
|
6940
|
+
domainLine: {
|
6939
6941
|
visible: showAxis
|
6940
6942
|
}
|
6941
6943
|
});
|
6942
6944
|
return result;
|
6943
6945
|
};
|
6946
|
+
const colorRoseStyleFill = (stylePipe)=>(spec, context)=>{
|
6947
|
+
const result = stylePipe(spec, context);
|
6948
|
+
const { advancedVSeed } = context;
|
6949
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6950
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
6951
|
+
if (isLinearColor(advancedVSeed)) {
|
6952
|
+
if (result?.rose?.style) result.rose.style.fill = {
|
6953
|
+
field: unfoldInfo.encodingColor,
|
6954
|
+
scale: 'color'
|
6955
|
+
};
|
6956
|
+
}
|
6957
|
+
return result;
|
6958
|
+
};
|
6959
|
+
const roseStyle = (spec, context)=>{
|
6960
|
+
const { advancedVSeed } = context;
|
6961
|
+
const { dataset } = advancedVSeed;
|
6962
|
+
const showStroke = dataset.length <= 30;
|
6963
|
+
const result = {
|
6964
|
+
...spec,
|
6965
|
+
rose: {
|
6966
|
+
style: {}
|
6967
|
+
}
|
6968
|
+
};
|
6969
|
+
return {
|
6970
|
+
...result,
|
6971
|
+
rose: {
|
6972
|
+
style: {
|
6973
|
+
stroke: '#ffffff',
|
6974
|
+
lineWidth: showStroke ? 1 : 0
|
6975
|
+
},
|
6976
|
+
state: {
|
6977
|
+
hover: {
|
6978
|
+
lineWidth: 1,
|
6979
|
+
fillOpacity: 0.6
|
6980
|
+
}
|
6981
|
+
}
|
6982
|
+
}
|
6983
|
+
};
|
6984
|
+
};
|
6944
6985
|
const rose = [
|
6945
6986
|
initRose,
|
6946
6987
|
stackCornerRadius_stackCornerRadius,
|
6947
6988
|
stackInverse,
|
6948
|
-
color_color,
|
6989
|
+
colorAdapter(color_color, linearColor),
|
6949
6990
|
background_backgroundColor,
|
6950
6991
|
datasetXY,
|
6951
6992
|
progressive,
|
6952
|
-
radiusAxis,
|
6953
6993
|
angleAxis,
|
6954
|
-
|
6955
|
-
tooltip_tooltip,
|
6994
|
+
radiusAxis,
|
6956
6995
|
verticalCrosshairRect,
|
6957
|
-
|
6996
|
+
colorRoseStyleFill(roseStyle),
|
6997
|
+
colorAdapter(discreteLegend, colorLegend),
|
6998
|
+
label_label,
|
6999
|
+
tooltip_tooltip
|
6958
7000
|
];
|
6959
7001
|
const pivotRose = [
|
6960
7002
|
initPivot,
|
@@ -6965,19 +7007,20 @@ const pivotRose = [
|
|
6965
7007
|
initRose,
|
6966
7008
|
stackCornerRadius_stackCornerRadius,
|
6967
7009
|
stackInverse,
|
6968
|
-
color_color,
|
7010
|
+
colorAdapter(color_color, linearColor),
|
6969
7011
|
background_backgroundColor,
|
6970
7012
|
datasetXY,
|
6971
7013
|
progressive,
|
6972
7014
|
radiusAxis,
|
6973
7015
|
angleAxis,
|
7016
|
+
verticalCrosshairRect,
|
7017
|
+
colorRoseStyleFill(roseStyle),
|
6974
7018
|
label_label,
|
6975
|
-
tooltip_tooltip
|
6976
|
-
verticalCrosshairRect
|
7019
|
+
tooltip_tooltip
|
6977
7020
|
]),
|
6978
7021
|
pivotRowDimensions,
|
6979
7022
|
pivotColumnDimensions,
|
6980
|
-
pivotDiscreteLegend
|
7023
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
6981
7024
|
];
|
6982
7025
|
const roseSpecPipeline = [
|
6983
7026
|
pivotAdapter_pivotAdapter(rose, pivotRose)
|
@@ -7046,15 +7089,16 @@ const initRoseParallel = (spec, context)=>{
|
|
7046
7089
|
const roseParallel = [
|
7047
7090
|
initRoseParallel,
|
7048
7091
|
stackCornerRadius_stackCornerRadius,
|
7049
|
-
color_color,
|
7092
|
+
colorAdapter(color_color, linearColor),
|
7050
7093
|
background_backgroundColor,
|
7051
7094
|
datasetXY,
|
7052
7095
|
progressive,
|
7053
7096
|
radiusAxis,
|
7054
7097
|
angleAxis,
|
7098
|
+
colorRoseStyleFill(roseStyle),
|
7099
|
+
colorAdapter(discreteLegend, colorLegend),
|
7055
7100
|
label_label,
|
7056
7101
|
tooltip_tooltip,
|
7057
|
-
discreteLegend,
|
7058
7102
|
verticalCrosshairRect,
|
7059
7103
|
annotationPoint_annotationPoint,
|
7060
7104
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -7069,15 +7113,16 @@ const pivotRoseParallel = [
|
|
7069
7113
|
pivotIndicators_pivotIndicators([
|
7070
7114
|
initRoseParallel,
|
7071
7115
|
stackCornerRadius_stackCornerRadius,
|
7072
|
-
color_color,
|
7116
|
+
colorAdapter(color_color, linearColor),
|
7073
7117
|
background_backgroundColor,
|
7074
7118
|
datasetXY,
|
7075
7119
|
progressive,
|
7076
7120
|
radiusAxis,
|
7077
7121
|
angleAxis,
|
7122
|
+
verticalCrosshairRect,
|
7123
|
+
colorRoseStyleFill(roseStyle),
|
7078
7124
|
label_label,
|
7079
7125
|
tooltip_tooltip,
|
7080
|
-
verticalCrosshairRect,
|
7081
7126
|
annotationPoint_annotationPoint,
|
7082
7127
|
annotationVerticalLine_annotationVerticalLine,
|
7083
7128
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7085,7 +7130,7 @@ const pivotRoseParallel = [
|
|
7085
7130
|
]),
|
7086
7131
|
pivotRowDimensions,
|
7087
7132
|
pivotColumnDimensions,
|
7088
|
-
pivotDiscreteLegend
|
7133
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7089
7134
|
];
|
7090
7135
|
const roseParallelSpecPipeline = [
|
7091
7136
|
pivotAdapter_pivotAdapter(roseParallel, pivotRoseParallel)
|
@@ -7116,12 +7161,11 @@ const radar_generateDefaultMeasureEncoding = (measures, encoding)=>{
|
|
7116
7161
|
encoding.radius = unique(measures.filter((item)=>'radius' === item.encoding || !item.encoding).map((item)=>item.id));
|
7117
7162
|
};
|
7118
7163
|
const radar_generateDefaultDimensionEncoding = (dimensions, encoding)=>{
|
7119
|
-
const onlyMeasureName = 1 === dimensions.length && dimensions.find((item)=>item.id === MeasureName);
|
7120
7164
|
const uniqueDimIds = unique(dimensions.map((d)=>d.id));
|
7121
7165
|
encoding.angle = uniqueDimIds.slice(0, 1);
|
7122
|
-
encoding.color = uniqueDimIds.slice(
|
7123
|
-
encoding.detail = uniqueDimIds.slice(onlyMeasureName ? 0 : 1);
|
7166
|
+
encoding.color = uniqueDimIds.slice(1);
|
7124
7167
|
encoding.tooltip = uniqueDimIds;
|
7168
|
+
encoding.detail = [];
|
7125
7169
|
encoding.label = [];
|
7126
7170
|
encoding.row = [];
|
7127
7171
|
encoding.column = [];
|
@@ -7133,14 +7177,13 @@ const radar_generateMeasureEncoding = (measures, encoding)=>{
|
|
7133
7177
|
if (color.length > 0) encoding.color = color;
|
7134
7178
|
};
|
7135
7179
|
const radar_generateDimensionEncoding = (dimensions, encoding)=>{
|
7136
|
-
encoding.angle = unique(dimensions.filter((item)=>'angle' === item.encoding
|
7180
|
+
encoding.angle = unique(dimensions.filter((item)=>'angle' === item.encoding).map((item)=>item.id));
|
7137
7181
|
encoding.color = unique(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
|
7138
|
-
encoding.detail =
|
7182
|
+
encoding.detail = [];
|
7139
7183
|
if (0 === encoding.angle.length) encoding.angle = [
|
7140
7184
|
dimensions[0].id
|
7141
7185
|
];
|
7142
7186
|
if (0 === encoding.color.length) encoding.color = dimensions.filter((item)=>!encoding.angle?.includes(item.id)).map((item)=>item.id);
|
7143
|
-
if (0 === encoding.detail.length) encoding.detail = dimensions.filter((item)=>!encoding.angle?.includes(item.id)).map((item)=>item.id);
|
7144
7187
|
};
|
7145
7188
|
const radarAdvancedPipeline = [
|
7146
7189
|
initAdvancedVSeed_initAdvancedVSeed,
|
@@ -7356,34 +7399,55 @@ const initFunnel = (spec, context)=>{
|
|
7356
7399
|
clip: true
|
7357
7400
|
}
|
7358
7401
|
];
|
7359
|
-
result.funnel = {
|
7360
|
-
style: {
|
7361
|
-
cornerRadius: 4,
|
7362
|
-
fill: {
|
7363
|
-
field: unfoldInfo.encodingColorId,
|
7364
|
-
scale: 'color'
|
7365
|
-
}
|
7366
|
-
},
|
7367
|
-
state: {
|
7368
|
-
hover: {
|
7369
|
-
fillOpacity: 0.6
|
7370
|
-
}
|
7371
|
-
}
|
7372
|
-
};
|
7373
7402
|
result.transformLabel = {
|
7374
7403
|
visible: true
|
7375
7404
|
};
|
7376
7405
|
result.animation = true;
|
7377
7406
|
return result;
|
7378
7407
|
};
|
7408
|
+
const colorFunnelStyleFill = (stylePipe)=>(spec, context)=>{
|
7409
|
+
const result = stylePipe(spec, context);
|
7410
|
+
const { advancedVSeed } = context;
|
7411
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7412
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
7413
|
+
if (isLinearColor(advancedVSeed)) {
|
7414
|
+
if (result?.funnel?.style) result.funnel.style.fill = {
|
7415
|
+
field: unfoldInfo.encodingColor,
|
7416
|
+
scale: 'color'
|
7417
|
+
};
|
7418
|
+
}
|
7419
|
+
return result;
|
7420
|
+
};
|
7421
|
+
const funnelStyle = (spec)=>{
|
7422
|
+
const result = {
|
7423
|
+
...spec,
|
7424
|
+
funnel: {
|
7425
|
+
style: {}
|
7426
|
+
}
|
7427
|
+
};
|
7428
|
+
return {
|
7429
|
+
...result,
|
7430
|
+
funnel: {
|
7431
|
+
style: {
|
7432
|
+
cornerRadius: 4
|
7433
|
+
},
|
7434
|
+
state: {
|
7435
|
+
hover: {
|
7436
|
+
fillOpacity: 0.6
|
7437
|
+
}
|
7438
|
+
}
|
7439
|
+
}
|
7440
|
+
};
|
7441
|
+
};
|
7379
7442
|
const funnel = [
|
7380
7443
|
initFunnel,
|
7381
7444
|
background_backgroundColor,
|
7382
7445
|
datasetXY,
|
7383
|
-
color_color,
|
7446
|
+
colorAdapter(color_color, linearColor),
|
7384
7447
|
label_label,
|
7448
|
+
colorAdapter(discreteLegend, colorLegend),
|
7449
|
+
colorFunnelStyleFill(funnelStyle),
|
7385
7450
|
tooltip_tooltip,
|
7386
|
-
discreteLegend,
|
7387
7451
|
annotationPoint_annotationPoint,
|
7388
7452
|
annotationVerticalLine_annotationVerticalLine,
|
7389
7453
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7398,17 +7462,18 @@ const pivotFunnel = [
|
|
7398
7462
|
initFunnel,
|
7399
7463
|
background_backgroundColor,
|
7400
7464
|
datasetXY,
|
7401
|
-
color_color,
|
7465
|
+
colorAdapter(color_color, linearColor),
|
7402
7466
|
label_label,
|
7403
7467
|
tooltip_tooltip,
|
7404
|
-
|
7468
|
+
colorFunnelStyleFill(funnelStyle),
|
7405
7469
|
annotationPoint_annotationPoint,
|
7406
7470
|
annotationVerticalLine_annotationVerticalLine,
|
7407
7471
|
annotationHorizontalLine_annotationHorizontalLine,
|
7408
7472
|
annotationArea_annotationArea
|
7409
7473
|
]),
|
7410
7474
|
pivotRowDimensions,
|
7411
|
-
pivotColumnDimensions
|
7475
|
+
pivotColumnDimensions,
|
7476
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7412
7477
|
];
|
7413
7478
|
const funnelSpecPipeline = [
|
7414
7479
|
pivotAdapter_pivotAdapter(funnel, pivotFunnel)
|
@@ -7495,6 +7560,37 @@ const labelColorInversion = (spec)=>{
|
|
7495
7560
|
};
|
7496
7561
|
return result;
|
7497
7562
|
};
|
7563
|
+
const colorCellStyleFill = (stylePipe)=>(spec, context)=>{
|
7564
|
+
const result = stylePipe(spec, context);
|
7565
|
+
const { advancedVSeed } = context;
|
7566
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
7567
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
7568
|
+
if (isLinearColor(advancedVSeed)) {
|
7569
|
+
if (result?.cell?.style) result.cell.style.fill = {
|
7570
|
+
field: unfoldInfo.encodingColor,
|
7571
|
+
scale: 'color'
|
7572
|
+
};
|
7573
|
+
}
|
7574
|
+
return result;
|
7575
|
+
};
|
7576
|
+
const cellStyle = (spec)=>{
|
7577
|
+
const result = {
|
7578
|
+
...spec,
|
7579
|
+
cell: {
|
7580
|
+
style: {}
|
7581
|
+
}
|
7582
|
+
};
|
7583
|
+
return {
|
7584
|
+
...result,
|
7585
|
+
cell: {
|
7586
|
+
style: {
|
7587
|
+
shape: 'rect',
|
7588
|
+
stroke: '#ffffff',
|
7589
|
+
lineWidth: 1
|
7590
|
+
}
|
7591
|
+
}
|
7592
|
+
};
|
7593
|
+
};
|
7498
7594
|
const initHeatmap = (spec, context)=>{
|
7499
7595
|
const result = {
|
7500
7596
|
...spec
|
@@ -7509,13 +7605,6 @@ const initHeatmap = (spec, context)=>{
|
|
7509
7605
|
result.seriesField = unfoldInfo.encodingColorId;
|
7510
7606
|
result.valueField = foldInfo.measureValue;
|
7511
7607
|
result.padding = 0;
|
7512
|
-
result.cell = {
|
7513
|
-
style: {
|
7514
|
-
shape: 'rect',
|
7515
|
-
stroke: '#ffffff',
|
7516
|
-
lineWidth: 1
|
7517
|
-
}
|
7518
|
-
};
|
7519
7608
|
result.axes = [
|
7520
7609
|
{
|
7521
7610
|
type: 'band',
|
@@ -7540,14 +7629,12 @@ const heatmap = [
|
|
7540
7629
|
initHeatmap,
|
7541
7630
|
background_backgroundColor,
|
7542
7631
|
datasetXY,
|
7543
|
-
color_color,
|
7632
|
+
colorAdapter(color_color, linearColor),
|
7544
7633
|
label_label,
|
7545
7634
|
labelColorInversion,
|
7546
|
-
discreteLegend,
|
7635
|
+
colorAdapter(discreteLegend, colorLegend),
|
7636
|
+
colorCellStyleFill(cellStyle),
|
7547
7637
|
tooltip_tooltip,
|
7548
|
-
pointStyle_pointStyle,
|
7549
|
-
pointStateDimensionHover,
|
7550
|
-
lineStyle_lineStyle,
|
7551
7638
|
annotationPoint_annotationPoint,
|
7552
7639
|
annotationVerticalLine_annotationVerticalLine,
|
7553
7640
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -7562,21 +7649,20 @@ const pivotHeatmap = [
|
|
7562
7649
|
initHeatmap,
|
7563
7650
|
background_backgroundColor,
|
7564
7651
|
datasetXY,
|
7565
|
-
color_color,
|
7652
|
+
colorAdapter(color_color, linearColor),
|
7566
7653
|
label_label,
|
7567
7654
|
labelColorInversion,
|
7568
7655
|
discreteLegend,
|
7569
7656
|
tooltip_tooltip,
|
7570
|
-
|
7571
|
-
pointStateDimensionHover,
|
7572
|
-
lineStyle_lineStyle,
|
7657
|
+
colorCellStyleFill(cellStyle),
|
7573
7658
|
annotationPoint_annotationPoint,
|
7574
7659
|
annotationVerticalLine_annotationVerticalLine,
|
7575
7660
|
annotationHorizontalLine_annotationHorizontalLine,
|
7576
7661
|
annotationArea_annotationArea
|
7577
7662
|
]),
|
7578
7663
|
pivotRowDimensions,
|
7579
|
-
pivotColumnDimensions
|
7664
|
+
pivotColumnDimensions,
|
7665
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7580
7666
|
];
|
7581
7667
|
const heatmapSpecPipeline = [
|
7582
7668
|
pivotAdapter_pivotAdapter(heatmap, pivotHeatmap)
|