@visactor/vseed 0.1.1 → 0.1.2

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.
Files changed (52) hide show
  1. package/dist/builder/builder/builder.d.ts +116 -0
  2. package/dist/dataReshape/constant.d.ts +0 -8
  3. package/dist/dataReshape/foldMeasures.d.ts +6 -24
  4. package/dist/index.cjs +495 -266
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.js +478 -228
  7. package/dist/index.js.map +1 -1
  8. package/dist/pipeline/advanced/chart/pipes/encoding/index.d.ts +1 -0
  9. package/dist/pipeline/advanced/chart/pipes/encoding/line.d.ts +2 -0
  10. package/dist/pipeline/spec/chart/pipes/color/colorAdapter.d.ts +3 -0
  11. package/dist/pipeline/spec/chart/pipes/color/colorAreaStyleFill.d.ts +2 -0
  12. package/dist/pipeline/spec/chart/pipes/color/colorBarStyleFill.d.ts +2 -0
  13. package/dist/pipeline/spec/chart/pipes/color/colorLineStyleFill.d.ts +2 -0
  14. package/dist/pipeline/spec/chart/pipes/color/colorPointStyleFill.d.ts +2 -0
  15. package/dist/pipeline/spec/chart/pipes/color/index.d.ts +6 -0
  16. package/dist/pipeline/spec/chart/pipes/{tooltip/tooltipDisable.d.ts → color/linearColor.d.ts} +1 -1
  17. package/dist/pipeline/spec/chart/pipes/legend/colorLegend.d.ts +2 -0
  18. package/dist/pipeline/spec/chart/pipes/legend/index.d.ts +2 -0
  19. package/dist/pipeline/spec/chart/pipes/legend/pivotColorLegend.d.ts +2 -0
  20. package/dist/pipeline/spec/chart/pipes/tooltip/index.d.ts +0 -1
  21. package/dist/pipeline/utils/dimensions/find.d.ts +0 -2
  22. package/dist/pipeline/utils/dimensions/index.d.ts +0 -1
  23. package/dist/pipeline/utils/dimensions/typeGuard.d.ts +0 -4
  24. package/dist/types/advancedVSeed.d.ts +40 -0
  25. package/dist/types/chartType/area/zArea.d.ts +1 -0
  26. package/dist/types/chartType/areaPercent/zAreaPercent.d.ts +1 -0
  27. package/dist/types/chartType/bar/zBar.d.ts +1 -0
  28. package/dist/types/chartType/barParallel/zBarParallel.d.ts +1 -0
  29. package/dist/types/chartType/barPercent/zBarPercent.d.ts +1 -0
  30. package/dist/types/chartType/column/zColumn.d.ts +1 -0
  31. package/dist/types/chartType/columnParallel/zColumnParallel.d.ts +1 -0
  32. package/dist/types/chartType/columnPercent/zColumnPercent.d.ts +1 -0
  33. package/dist/types/chartType/donut/zDonut.d.ts +1 -0
  34. package/dist/types/chartType/dualAxis/zDualAxis.d.ts +1 -0
  35. package/dist/types/chartType/funnel/zFunnel.d.ts +2 -0
  36. package/dist/types/chartType/heatmap/zHeatmap.d.ts +2 -0
  37. package/dist/types/chartType/line/zLine.d.ts +1 -0
  38. package/dist/types/chartType/pie/zPie.d.ts +1 -0
  39. package/dist/types/chartType/radar/zRadar.d.ts +1 -0
  40. package/dist/types/chartType/rose/zRose.d.ts +1 -0
  41. package/dist/types/chartType/roseParallel/zRoseParallel.d.ts +1 -0
  42. package/dist/types/chartType/scatter/zScatter.d.ts +1 -0
  43. package/dist/types/properties/config/color/color.d.ts +8 -2
  44. package/dist/types/properties/config/config.d.ts +36 -0
  45. package/dist/types/properties/config/legend/legend.d.ts +9 -5
  46. package/dist/types/properties/datasetReshapeInfo/datasetReshapeInfo.d.ts +2 -0
  47. package/dist/types/properties/datasetReshapeInfo/zDatasetReshapeInfo.d.ts +6 -0
  48. package/dist/types/properties/theme/customTheme.d.ts +36 -0
  49. package/dist/types/zVseed.d.ts +20 -0
  50. package/dist/umd/index.js +495 -252
  51. package/dist/umd/index.js.map +1 -1
  52. package/package.json +1 -1
package/dist/umd/index.js CHANGED
@@ -30,7 +30,6 @@
30
30
  var __webpack_exports__ = {};
31
31
  __webpack_require__.r(__webpack_exports__);
32
32
  __webpack_require__.d(__webpack_exports__, {
33
- zTooltip: ()=>zTooltip,
34
33
  funnelAdvancedPipeline: ()=>funnelAdvancedPipeline,
35
34
  zHeatmapConfig: ()=>zHeatmapConfig,
36
35
  zBar: ()=>zBar,
@@ -80,12 +79,10 @@
80
79
  zRoseParallel: ()=>zRoseParallel,
81
80
  MeasureName: ()=>MeasureName,
82
81
  zDataset: ()=>zDataset,
83
- UnfoldDimensionGroupId: ()=>UnfoldDimensionGroupId,
84
82
  zNumFormat: ()=>zNumFormat,
85
83
  barPercentAdvancedPipeline: ()=>barPercentAdvancedPipeline,
86
84
  findAllDimensions: ()=>findAllDimensions,
87
85
  FoldYMeasureValue: ()=>FoldYMeasureValue,
88
- findDimensionById: ()=>findDimensionById,
89
86
  zPivotTableConfig: ()=>zPivotTableConfig,
90
87
  zArea: ()=>zArea,
91
88
  zColumnParallel: ()=>zColumnParallel,
@@ -111,31 +108,31 @@
111
108
  registerLightTheme: ()=>registerLightTheme,
112
109
  roseAdvancedPipeline: ()=>roseAdvancedPipeline,
113
110
  zBarParallel: ()=>zBarParallel,
114
- registerDarkTheme: ()=>registerDarkTheme,
115
- registerPivotTable: ()=>registerPivotTable,
116
111
  isPartialDatumSelector: ()=>isPartialDatumSelector,
117
- pieSpecPipeline: ()=>pieSpecPipeline,
118
- isDimensionGroup: ()=>isDimensionGroup,
119
- dualAxisSpecPipeline: ()=>dualAxisSpecPipeline,
112
+ registerPivotTable: ()=>registerPivotTable,
120
113
  tableAdvancedPipeline: ()=>tableAdvancedPipeline,
121
- barSpecPipeline: ()=>barSpecPipeline,
114
+ registerDarkTheme: ()=>registerDarkTheme,
115
+ dualAxisSpecPipeline: ()=>dualAxisSpecPipeline,
116
+ pieSpecPipeline: ()=>pieSpecPipeline,
122
117
  zAnnotationVerticalLine: ()=>zAnnotationVerticalLine,
123
- registerRose: ()=>registerRose,
118
+ barSpecPipeline: ()=>barSpecPipeline,
124
119
  zChartType: ()=>zChartType,
120
+ registerRose: ()=>registerRose,
121
+ zMeasureTree: ()=>zMeasureTree,
125
122
  unfoldDimensions: ()=>unfoldDimensions,
126
123
  roseParallelAdvancedPipeline: ()=>roseParallelAdvancedPipeline,
127
124
  registerTable: ()=>registerTable,
128
- Builder: ()=>Builder,
129
125
  isMeasureGroup: ()=>isMeasureGroup,
126
+ autoFormatter: ()=>autoFormatter,
130
127
  YEncoding: ()=>YEncoding,
131
128
  registerAll: ()=>registerAll,
132
129
  registerBar: ()=>registerBar,
133
130
  isVChart: ()=>isVChart,
134
131
  radarSpecPipeline: ()=>radarSpecPipeline,
135
- findFirstDimension: ()=>findFirstDimension,
136
- autoFormatter: ()=>autoFormatter,
137
- zMeasureTree: ()=>zMeasureTree,
132
+ Builder: ()=>Builder,
138
133
  zPieConfig: ()=>zPieConfig,
134
+ zPivotTable: ()=>zPivotTable,
135
+ zRadar: ()=>zRadar,
139
136
  registerLine: ()=>registerLine,
140
137
  registerCustomTheme: ()=>registerCustomTheme,
141
138
  zColor: ()=>zColor,
@@ -155,21 +152,19 @@
155
152
  zAxis: ()=>zAxis,
156
153
  isVTable: ()=>isVTable,
157
154
  zMeasures: ()=>zMeasures,
158
- zPivotTable: ()=>zPivotTable,
155
+ zRadarConfig: ()=>zRadarConfig,
159
156
  zLine: ()=>zLine,
160
157
  columnSpecPipeline: ()=>columnSpecPipeline,
161
- UnfoldDimensionGroup: ()=>UnfoldDimensionGroup,
162
- zDatasetReshapeInfo: ()=>zDatasetReshapeInfo,
163
158
  zFoldInfo: ()=>zFoldInfo,
159
+ zDatasetReshapeInfo: ()=>zDatasetReshapeInfo,
164
160
  zLinearColor: ()=>zLinearColor,
161
+ zStackCornerRadius: ()=>zStackCornerRadius,
165
162
  zAreaStyle: ()=>zAreaStyle,
166
163
  ORIGINAL_DATA: ()=>ORIGINAL_DATA,
167
- zRadarConfig: ()=>zRadarConfig,
164
+ zUnfoldInfo: ()=>zUnfoldInfo,
168
165
  zAnnotationArea: ()=>zAnnotationArea,
169
- zStackCornerRadius: ()=>zStackCornerRadius,
170
166
  DetailEncoding: ()=>DetailEncoding,
171
167
  zRose: ()=>zRose,
172
- zUnfoldInfo: ()=>zUnfoldInfo,
173
168
  columnParallelSpecPipeline: ()=>columnParallelSpecPipeline,
174
169
  i18n: ()=>i18n,
175
170
  zPointStyle: ()=>zPointStyle,
@@ -178,7 +173,6 @@
178
173
  registerColumnParallel: ()=>registerColumnParallel,
179
174
  updateAdvanced: ()=>updateAdvanced,
180
175
  zDimension: ()=>zDimension,
181
- zRadar: ()=>zRadar,
182
176
  zTable: ()=>zTable,
183
177
  isMeasure: ()=>isMeasure,
184
178
  FoldSecondaryMeasureValue: ()=>FoldSecondaryMeasureValue,
@@ -202,9 +196,9 @@
202
196
  registerBarParallel: ()=>registerBarParallel,
203
197
  registerRadar: ()=>registerRadar,
204
198
  zEncodings: ()=>zEncodings,
205
- isDimension: ()=>isDimension,
206
199
  pivotTableSpecPipeline: ()=>pivotTableSpecPipeline,
207
200
  zLocale: ()=>zLocale,
201
+ zMeasure: ()=>zMeasure,
208
202
  FoldXMeasureValue: ()=>FoldXMeasureValue,
209
203
  dualAxisAdvancedPipeline: ()=>dualAxisAdvancedPipeline,
210
204
  registerScatter: ()=>registerScatter,
@@ -216,10 +210,9 @@
216
210
  zAdvancedVSeed: ()=>zAdvancedVSeed,
217
211
  zConfig: ()=>zConfig,
218
212
  zBarStyle: ()=>zBarStyle,
219
- zMeasure: ()=>zMeasure,
220
213
  zRoseParallelConfig: ()=>zRoseParallelConfig,
221
- zAreaPercent: ()=>zAreaPercent,
222
214
  zXLinearAxis: ()=>zXLinearAxis,
215
+ zAreaPercent: ()=>zAreaPercent,
223
216
  columnParallelAdvancedPipeline: ()=>columnParallelAdvancedPipeline,
224
217
  isValueSelector: ()=>isValueSelector,
225
218
  donutAdvancedPipeline: ()=>donutAdvancedPipeline,
@@ -237,8 +230,8 @@
237
230
  lineAdvancedPipeline: ()=>lineAdvancedPipeline,
238
231
  dataReshapeByEncoding: ()=>dataReshapeByEncoding,
239
232
  lineSpecPipeline: ()=>lineSpecPipeline,
240
- isDimensions: ()=>isDimensions,
241
233
  zBarPercentConfig: ()=>zBarPercentConfig,
234
+ zTooltip: ()=>zTooltip,
242
235
  createFormatter: ()=>createFormatter,
243
236
  zDimensionGroup: ()=>zDimensionGroup,
244
237
  isMeasureSelector: ()=>isMeasureSelector,
@@ -1130,32 +1123,6 @@
1130
1123
  }));
1131
1124
  return result;
1132
1125
  };
1133
- const findDimensionById = (dimensions = [], id)=>{
1134
- if (!dimensions) return;
1135
- let result;
1136
- preorderTraverse(dimensions, (node)=>{
1137
- if (!('children' in node)) {
1138
- if (node.id === id) {
1139
- result = node;
1140
- return true;
1141
- }
1142
- }
1143
- return false;
1144
- });
1145
- return result;
1146
- };
1147
- const findFirstDimension = (dimensions = [])=>{
1148
- if (!dimensions) return;
1149
- let result;
1150
- preorderTraverse(dimensions, (node)=>{
1151
- if (!('children' in node)) {
1152
- result = node;
1153
- return true;
1154
- }
1155
- return false;
1156
- });
1157
- return result;
1158
- };
1159
1126
  const findAllDimensions = (dimensions = [])=>{
1160
1127
  if (!dimensions) return [];
1161
1128
  const result = [];
@@ -1611,8 +1578,6 @@
1611
1578
  const DetailEncoding = '__Dim_Detail__';
1612
1579
  const ColorEncoding = '__Dim_Color__';
1613
1580
  const ColorIdEncoding = '__Dim_ColorId__';
1614
- const UnfoldDimensionGroup = '__DimGroup__';
1615
- const UnfoldDimensionGroupId = '__DimGroupID__';
1616
1581
  const autoDimensions_autoDimensions = (advancedVSeed, context)=>{
1617
1582
  const result = {
1618
1583
  ...advancedVSeed
@@ -1652,7 +1617,7 @@
1652
1617
  result.dimensions.push(MeaName);
1653
1618
  return result;
1654
1619
  };
1655
- const encodingForColumn = (advancedVSeed, context)=>{
1620
+ const encodingForLine = (advancedVSeed, context)=>{
1656
1621
  const { vseed } = context;
1657
1622
  const { dimensions } = advancedVSeed;
1658
1623
  if (!dimensions) return advancedVSeed;
@@ -1665,10 +1630,7 @@
1665
1630
  (dimensions[1] || dimensions[0]).id
1666
1631
  ];
1667
1632
  const detail = encoding.detail || [];
1668
- const mergedDetail = chunk_QJLMYOTX_i([
1669
- ...color,
1670
- ...detail
1671
- ]);
1633
+ const mergedDetail = 0 === detail.length ? dimensions.map((d)=>d.id).filter((id)=>!x.includes(id)) : encoding.detail;
1672
1634
  return {
1673
1635
  ...advancedVSeed,
1674
1636
  encoding: {
@@ -1721,11 +1683,21 @@
1721
1683
  for (let r of e)delete o[r];
1722
1684
  return o;
1723
1685
  }
1724
- const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName = FoldMeasureName, measureValue = FoldMeasureValue)=>{
1686
+ const foldMeasures = (dataset, measures, encoding, options)=>{
1687
+ const { measureId = FoldMeasureId, measureName = FoldMeasureName, measureValue = FoldMeasureValue } = options || {};
1688
+ const colorMeasureId = encoding?.color?.length === 1 && measures.some((m)=>m.id === encoding?.color?.[0]) ? encoding?.color?.[0] : void 0;
1725
1689
  const foldInfo = {
1726
1690
  measureId,
1727
1691
  measureName,
1728
1692
  measureValue,
1693
+ colorRange: [
1694
+ 0,
1695
+ 1
1696
+ ],
1697
+ measureRange: [
1698
+ 0,
1699
+ 1
1700
+ ],
1729
1701
  foldMap: {}
1730
1702
  };
1731
1703
  const result = new Array(dataset.length * measures.length);
@@ -1742,6 +1714,19 @@
1742
1714
  datum[measureId] = id;
1743
1715
  datum[measureName] = alias || id;
1744
1716
  datum[measureValue] = dataset[i][id];
1717
+ if (colorMeasureId) {
1718
+ const value = datum[ORIGINAL_DATA][colorMeasureId];
1719
+ datum[ColorEncoding] = value;
1720
+ datum[ColorIdEncoding] = colorMeasureId;
1721
+ foldInfo.colorRange = [
1722
+ Math.min(foldInfo.colorRange[0] || 1 / 0, Number(value)),
1723
+ Math.max(foldInfo.colorRange[1] || -1 / 0, Number(value))
1724
+ ];
1725
+ }
1726
+ foldInfo.measureRange = [
1727
+ Math.min(foldInfo.measureRange[0] || 1 / 0, Number(datum[id])),
1728
+ Math.max(foldInfo.measureRange[1] || -1 / 0, Number(datum[id]))
1729
+ ];
1745
1730
  foldInfo.foldMap[id] = alias;
1746
1731
  result[index++] = datum;
1747
1732
  }
@@ -1777,7 +1762,7 @@
1777
1762
  applyEncoding(YEncoding, yDimensions, datum, separator);
1778
1763
  applyEncoding(ColorEncoding, colorDimensions, datum, separator);
1779
1764
  applyEncoding(DetailEncoding, detailDimensions, datum, separator);
1780
- if (!datum[ColorEncoding]) continue;
1765
+ if (!colorDimensions.length || !datum[ColorEncoding]) continue;
1781
1766
  const measureId = String(datum[foldMeasureId]);
1782
1767
  const colorItem = String(datum[ColorEncoding]);
1783
1768
  const colorId = colorItemAsId ? colorItem : measureId ? [
@@ -1798,29 +1783,13 @@
1798
1783
  const applyEncoding = (encoding, dimensions, datum, separator)=>{
1799
1784
  if (encoding && dimensions.length) datum[encoding] = dimensions.map((dim)=>String(datum[dim.id])).join(separator);
1800
1785
  };
1801
- const emptyReshapeResult = {
1802
- dataset: [],
1803
- foldInfo: {
1804
- foldMap: {},
1805
- measureId: '',
1806
- measureName: '',
1807
- measureValue: ''
1808
- },
1809
- unfoldInfo: {
1810
- encodingAngle: AngleEncoding,
1811
- encodingX: XEncoding,
1812
- encodingY: YEncoding,
1813
- encodingDetail: DetailEncoding,
1814
- encodingColor: ColorEncoding,
1815
- encodingColorId: ColorIdEncoding,
1816
- colorItems: [],
1817
- colorIdMap: {}
1818
- }
1819
- };
1820
1786
  const dataReshapeByEncoding = (dataset, dimensions, measures, encoding, options)=>{
1821
1787
  const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, colorItemAsId = false } = options || {};
1822
- if (0 === dimensions.length && 0 === measures.length) return emptyReshapeResult;
1823
- const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
1788
+ const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, encoding, {
1789
+ measureId: foldMeasureId,
1790
+ measureName: foldMeasureName,
1791
+ measureValue: foldMeasureValue
1792
+ });
1824
1793
  const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dimensions, encoding, {
1825
1794
  foldMeasureId,
1826
1795
  separator: Separator,
@@ -2095,7 +2064,7 @@
2095
2064
  initAdvancedVSeed_initAdvancedVSeed,
2096
2065
  autoMeasures_autoMeasures,
2097
2066
  autoDimensions_autoDimensions,
2098
- encodingForColumn,
2067
+ encodingForLine,
2099
2068
  pivotAdapter([
2100
2069
  reshapeWithEncoding
2101
2070
  ], [
@@ -2108,6 +2077,17 @@
2108
2077
  markStyle_markStyle,
2109
2078
  annotation_annotation
2110
2079
  ];
2080
+ const colorAdapter = (ordinalPipe, linearPipe)=>(spec, context)=>{
2081
+ const { advancedVSeed } = context;
2082
+ if (isLinearColor(advancedVSeed)) return linearPipe(spec, context);
2083
+ return ordinalPipe(spec, context);
2084
+ };
2085
+ const isLinearColor = (advancedVSeed)=>{
2086
+ const { encoding, measures } = advancedVSeed;
2087
+ const measureIdList = findAllMeasures(measures).map((measure)=>measure.id);
2088
+ const { color } = encoding;
2089
+ return color?.length === 1 && measureIdList.includes(color[0]);
2090
+ };
2111
2091
  const initLine = (spec, context)=>{
2112
2092
  const result = {
2113
2093
  ...spec
@@ -2119,7 +2099,7 @@
2119
2099
  result.direction = 'vertical';
2120
2100
  result.xField = unfoldInfo.encodingX;
2121
2101
  result.yField = foldInfo.measureValue;
2122
- result.seriesField = unfoldInfo.encodingColorId;
2102
+ result.seriesField = isLinearColor(advancedVSeed) ? unfoldInfo.encodingDetail : unfoldInfo.encodingColorId;
2123
2103
  result.padding = 0;
2124
2104
  result.region = [
2125
2105
  {
@@ -2180,6 +2160,31 @@
2180
2160
  ...accurateMap
2181
2161
  };
2182
2162
  };
2163
+ const linearColor = (spec, context)=>{
2164
+ const result = {
2165
+ ...spec
2166
+ };
2167
+ const { advancedVSeed } = context;
2168
+ const { datasetReshapeInfo, chartType } = advancedVSeed;
2169
+ const { unfoldInfo, id } = datasetReshapeInfo[0];
2170
+ const baseConfig = advancedVSeed.config[chartType];
2171
+ if (!baseConfig || !baseConfig.color) return result;
2172
+ const { color } = baseConfig;
2173
+ const { colorScheme, linearColorScheme } = color;
2174
+ result.color = {
2175
+ type: 'linear',
2176
+ range: linearColorScheme || colorScheme || [],
2177
+ domain: [
2178
+ {
2179
+ dataId: id,
2180
+ fields: [
2181
+ unfoldInfo.encodingColor
2182
+ ]
2183
+ }
2184
+ ]
2185
+ };
2186
+ return result;
2187
+ };
2183
2188
  const background_backgroundColor = (spec, context)=>{
2184
2189
  const result = {
2185
2190
  ...spec
@@ -2687,6 +2692,95 @@
2687
2692
  };
2688
2693
  return result;
2689
2694
  };
2695
+ const colorLegend = (spec, context)=>{
2696
+ const result = {
2697
+ ...spec
2698
+ };
2699
+ const { advancedVSeed } = context;
2700
+ const { datasetReshapeInfo, chartType } = advancedVSeed;
2701
+ const { unfoldInfo } = datasetReshapeInfo[0];
2702
+ const baseConfig = advancedVSeed.config[chartType];
2703
+ if (!baseConfig || !baseConfig.legend) return result;
2704
+ const { legend } = baseConfig;
2705
+ const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight } = legend || {};
2706
+ const orient = [
2707
+ 'bottom',
2708
+ 'bottomLeft',
2709
+ 'bottomRight',
2710
+ 'bl',
2711
+ 'br'
2712
+ ].includes(position) ? 'bottom' : [
2713
+ 'top',
2714
+ 'topLeft',
2715
+ 'topRight',
2716
+ 'tl',
2717
+ 'tr'
2718
+ ].includes(position) ? 'top' : [
2719
+ 'left',
2720
+ 'leftTop',
2721
+ 'leftBottom',
2722
+ 'lt',
2723
+ 'lb'
2724
+ ].includes(position) ? 'left' : 'right';
2725
+ const legendPosition = [
2726
+ 'topLeft',
2727
+ 'bottomLeft',
2728
+ 'leftTop',
2729
+ 'rightTop',
2730
+ 'lt',
2731
+ 'rt',
2732
+ 'tl',
2733
+ 'bl'
2734
+ ].includes(position) ? 'start' : [
2735
+ 'topRight',
2736
+ 'bottomRight',
2737
+ 'leftBottom',
2738
+ 'rightBottom',
2739
+ 'lb',
2740
+ 'rb',
2741
+ 'rt',
2742
+ 'br'
2743
+ ].includes(position) ? 'end' : 'middle';
2744
+ result.legends = {
2745
+ type: 'color',
2746
+ visible: enable,
2747
+ orient,
2748
+ position: legendPosition,
2749
+ padding: 0,
2750
+ field: unfoldInfo.encodingColor,
2751
+ maxWidth: '30%',
2752
+ startText: {
2753
+ visible: true,
2754
+ style: {
2755
+ fill: labelFontColor,
2756
+ fontSize: labelFontSize,
2757
+ fontWeight: labelFontWeight
2758
+ }
2759
+ },
2760
+ endText: {
2761
+ visible: true,
2762
+ style: {
2763
+ fill: labelFontColor,
2764
+ fontSize: labelFontSize,
2765
+ fontWeight: labelFontWeight
2766
+ }
2767
+ }
2768
+ };
2769
+ return result;
2770
+ };
2771
+ const colorPointStyleFill = (stylePipe)=>(spec, context)=>{
2772
+ const result = stylePipe(spec, context);
2773
+ const { advancedVSeed } = context;
2774
+ const { datasetReshapeInfo } = advancedVSeed;
2775
+ const { unfoldInfo } = datasetReshapeInfo[0];
2776
+ if (isLinearColor(advancedVSeed)) {
2777
+ if (result?.point?.style) result.point.style.fill = {
2778
+ field: unfoldInfo.encodingColor,
2779
+ scale: 'color'
2780
+ };
2781
+ }
2782
+ return result;
2783
+ };
2690
2784
  const selector_selector = (vchartDatum, selector)=>{
2691
2785
  if (!selector) return true;
2692
2786
  const selectorMode = 'And';
@@ -2783,7 +2877,10 @@
2783
2877
  const { markStyle } = advancedVSeed;
2784
2878
  const { pointStyle } = markStyle;
2785
2879
  const result = {
2786
- ...spec
2880
+ ...spec,
2881
+ point: {
2882
+ style: {}
2883
+ }
2787
2884
  };
2788
2885
  if (!pointStyle) return result;
2789
2886
  const pointStyles = Array.isArray(pointStyle) ? pointStyle : [
@@ -2827,6 +2924,7 @@
2827
2924
  return {
2828
2925
  ...result,
2829
2926
  point: {
2927
+ ...result.point,
2830
2928
  state: {
2831
2929
  ...customMap
2832
2930
  }
@@ -2882,6 +2980,19 @@
2882
2980
  };
2883
2981
  return result;
2884
2982
  };
2983
+ const colorLineStyleFill = (stylePipe)=>(spec, context)=>{
2984
+ const result = stylePipe(spec, context);
2985
+ const { advancedVSeed } = context;
2986
+ const { datasetReshapeInfo } = advancedVSeed;
2987
+ const { unfoldInfo } = datasetReshapeInfo[0];
2988
+ if (isLinearColor(advancedVSeed)) {
2989
+ if (result?.line?.style) result.line.style.stroke = {
2990
+ field: unfoldInfo.encodingColor,
2991
+ scale: 'color'
2992
+ };
2993
+ }
2994
+ return result;
2995
+ };
2885
2996
  function chunk_HVPVHFDT_i(...e) {
2886
2997
  return chunk_WIMGWYZL_u(chunk_HVPVHFDT_p, e);
2887
2998
  }
@@ -2903,10 +3014,13 @@
2903
3014
  const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed;
2904
3015
  const { unfoldInfo } = datasetReshapeInfo[0];
2905
3016
  const { lineStyle } = markStyle;
2906
- if (!lineStyle) return spec;
2907
3017
  const result = {
2908
- ...spec
3018
+ ...spec,
3019
+ line: {
3020
+ style: {}
3021
+ }
2909
3022
  };
3023
+ if (!lineStyle) return result;
2910
3024
  const lineStyles = Array.isArray(lineStyle) ? lineStyle : [
2911
3025
  lineStyle
2912
3026
  ];
@@ -2950,6 +3064,7 @@
2950
3064
  return {
2951
3065
  ...result,
2952
3066
  line: {
3067
+ ...result.line,
2953
3068
  state: {
2954
3069
  ...customMap
2955
3070
  }
@@ -3725,7 +3840,7 @@
3725
3840
  };
3726
3841
  const line_line = [
3727
3842
  initLine,
3728
- color_color,
3843
+ colorAdapter(color_color, linearColor),
3729
3844
  background_backgroundColor,
3730
3845
  datasetXY,
3731
3846
  progressive,
@@ -3734,10 +3849,10 @@
3734
3849
  label_label,
3735
3850
  tooltip_tooltip,
3736
3851
  verticalCrosshairLine,
3737
- discreteLegend,
3738
- pointStyle_pointStyle,
3852
+ colorAdapter(discreteLegend, colorLegend),
3853
+ colorPointStyleFill(pointStyle_pointStyle),
3739
3854
  pointStateDimensionHover,
3740
- lineStyle_lineStyle,
3855
+ colorLineStyleFill(lineStyle_lineStyle),
3741
3856
  annotationPoint_annotationPoint,
3742
3857
  annotationVerticalLine_annotationVerticalLine,
3743
3858
  annotationHorizontalLine_annotationHorizontalLine,
@@ -3778,6 +3893,48 @@
3778
3893
  Builder._advancedPipelineMap.line = lineAdvancedPipeline;
3779
3894
  Builder._specPipelineMap.line = lineSpecPipeline;
3780
3895
  };
3896
+ const encodingForColumn = (advancedVSeed, context)=>{
3897
+ const { vseed } = context;
3898
+ const { dimensions } = advancedVSeed;
3899
+ if (!dimensions) return advancedVSeed;
3900
+ const encoding = vseed.encoding;
3901
+ if (encoding) {
3902
+ const x = encoding.x || [
3903
+ dimensions[0].id
3904
+ ];
3905
+ const color = encoding.color || [
3906
+ (dimensions[1] || dimensions[0]).id
3907
+ ];
3908
+ const detail = encoding.detail || [];
3909
+ const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
3910
+ ...color,
3911
+ ...detail
3912
+ ]) : detail;
3913
+ return {
3914
+ ...advancedVSeed,
3915
+ encoding: {
3916
+ ...encoding,
3917
+ x,
3918
+ color,
3919
+ detail: mergedDetail
3920
+ }
3921
+ };
3922
+ }
3923
+ const onlyMeasureName = 1 === dimensions.length && dimensions.find((item)=>item.id === MeasureName);
3924
+ const mergedEncoding = {
3925
+ x: dimensions.slice(0, 1).map((item)=>item.id),
3926
+ color: dimensions.slice(onlyMeasureName ? 0 : 1).map((item)=>item.id),
3927
+ detail: dimensions.slice(onlyMeasureName ? 0 : 1).map((item)=>item.id),
3928
+ tooltip: dimensions.map((item)=>item.id),
3929
+ label: [],
3930
+ row: [],
3931
+ column: []
3932
+ };
3933
+ return {
3934
+ ...advancedVSeed,
3935
+ encoding: mergedEncoding
3936
+ };
3937
+ };
3781
3938
  const columnAdvancedPipeline = [
3782
3939
  initAdvancedVSeed_initAdvancedVSeed,
3783
3940
  autoMeasures_autoMeasures,
@@ -3820,9 +3977,14 @@
3820
3977
  const { advancedVSeed, vseed } = context;
3821
3978
  const { chartType } = vseed;
3822
3979
  const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius;
3980
+ const { datasetReshapeInfo } = advancedVSeed;
3981
+ const { foldInfo } = datasetReshapeInfo[0];
3823
3982
  return {
3824
3983
  ...spec,
3825
- stackCornerRadius
3984
+ stackCornerRadius: (_, datum)=>{
3985
+ if (datum[foldInfo.measureValue] > 0) return stackCornerRadius;
3986
+ return 0;
3987
+ }
3826
3988
  };
3827
3989
  };
3828
3990
  const stackInverse = (spec)=>{
@@ -3872,6 +4034,19 @@
3872
4034
  };
3873
4035
  return result;
3874
4036
  };
4037
+ const colorBarStyleFill = (stylePipe)=>(spec, context)=>{
4038
+ const result = stylePipe(spec, context);
4039
+ const { advancedVSeed } = context;
4040
+ const { datasetReshapeInfo } = advancedVSeed;
4041
+ const { unfoldInfo } = datasetReshapeInfo[0];
4042
+ if (isLinearColor(advancedVSeed)) {
4043
+ if (result?.bar?.style) result.bar.style.fill = {
4044
+ field: unfoldInfo.encodingColor,
4045
+ scale: 'color'
4046
+ };
4047
+ }
4048
+ return result;
4049
+ };
3875
4050
  const barStyle_barStyle = (spec, context)=>{
3876
4051
  const { advancedVSeed } = context;
3877
4052
  const { markStyle, dataset = [] } = advancedVSeed;
@@ -4067,11 +4242,98 @@
4067
4242
  markArea: markArea
4068
4243
  };
4069
4244
  };
4245
+ const pivotColorLegend = (spec, context)=>{
4246
+ const result = {
4247
+ ...spec
4248
+ };
4249
+ const { advancedVSeed } = context;
4250
+ const { chartType } = advancedVSeed;
4251
+ const baseConfig = advancedVSeed.config[chartType];
4252
+ if (!baseConfig || !baseConfig.legend) return result;
4253
+ const { datasetReshapeInfo } = advancedVSeed;
4254
+ const max = Math.max(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[1]));
4255
+ const min = Math.min(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[0]));
4256
+ const { legend, color } = baseConfig;
4257
+ const { colorScheme, linearColorScheme } = color;
4258
+ const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400 } = legend || {};
4259
+ const orient = [
4260
+ 'bottom',
4261
+ 'bottomLeft',
4262
+ 'bottomRight',
4263
+ 'bl',
4264
+ 'br'
4265
+ ].includes(position) ? 'bottom' : [
4266
+ 'top',
4267
+ 'topLeft',
4268
+ 'topRight',
4269
+ 'tl',
4270
+ 'tr'
4271
+ ].includes(position) ? 'top' : [
4272
+ 'left',
4273
+ 'leftTop',
4274
+ 'leftBottom',
4275
+ 'lt',
4276
+ 'lb'
4277
+ ].includes(position) ? 'left' : 'right';
4278
+ const legendPosition = [
4279
+ 'topLeft',
4280
+ 'bottomLeft',
4281
+ 'leftTop',
4282
+ 'rightTop',
4283
+ 'lt',
4284
+ 'rt',
4285
+ 'tl',
4286
+ 'bl'
4287
+ ].includes(position) ? 'start' : [
4288
+ 'topRight',
4289
+ 'bottomRight',
4290
+ 'leftBottom',
4291
+ 'rightBottom',
4292
+ 'lb',
4293
+ 'rb',
4294
+ 'rt',
4295
+ 'br'
4296
+ ].includes(position) ? 'end' : 'middle';
4297
+ const legends = {
4298
+ visible: enable,
4299
+ type: 'color',
4300
+ orient,
4301
+ position: legendPosition,
4302
+ colors: linearColorScheme || colorScheme || [],
4303
+ value: [
4304
+ min,
4305
+ max
4306
+ ],
4307
+ min: min,
4308
+ max: max,
4309
+ maxWidth: '30%',
4310
+ startText: {
4311
+ visible: true,
4312
+ style: {
4313
+ fill: labelFontColor,
4314
+ fontSize: labelFontSize,
4315
+ fontWeight: labelFontWeight
4316
+ }
4317
+ },
4318
+ endText: {
4319
+ visible: true,
4320
+ style: {
4321
+ fill: labelFontColor,
4322
+ fontSize: labelFontSize,
4323
+ fontWeight: labelFontWeight
4324
+ }
4325
+ }
4326
+ };
4327
+ return {
4328
+ ...result,
4329
+ legends
4330
+ };
4331
+ };
4070
4332
  const column = [
4071
4333
  initColumn,
4072
4334
  stackCornerRadius_stackCornerRadius,
4073
4335
  stackInverse,
4074
- color_color,
4336
+ colorAdapter(color_color, linearColor),
4075
4337
  background_backgroundColor,
4076
4338
  datasetXY,
4077
4339
  progressive,
@@ -4080,8 +4342,8 @@
4080
4342
  label_label,
4081
4343
  tooltip_tooltip,
4082
4344
  verticalCrosshairRect,
4083
- discreteLegend,
4084
- barStyle_barStyle,
4345
+ colorAdapter(discreteLegend, colorLegend),
4346
+ colorBarStyleFill(barStyle_barStyle),
4085
4347
  annotationPoint_annotationPoint,
4086
4348
  annotationVerticalLine_annotationVerticalLine,
4087
4349
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4096,7 +4358,7 @@
4096
4358
  initColumn,
4097
4359
  stackCornerRadius_stackCornerRadius,
4098
4360
  stackInverse,
4099
- color_color,
4361
+ colorAdapter(color_color, linearColor),
4100
4362
  background_backgroundColor,
4101
4363
  datasetXY,
4102
4364
  progressive,
@@ -4105,7 +4367,7 @@
4105
4367
  label_label,
4106
4368
  tooltip_tooltip,
4107
4369
  verticalCrosshairRect,
4108
- barStyle_barStyle,
4370
+ colorBarStyleFill(barStyle_barStyle),
4109
4371
  annotationPoint_annotationPoint,
4110
4372
  annotationVerticalLine_annotationVerticalLine,
4111
4373
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4113,7 +4375,7 @@
4113
4375
  ]),
4114
4376
  pivotRowDimensions,
4115
4377
  pivotColumnDimensions,
4116
- pivotDiscreteLegend
4378
+ colorAdapter(pivotDiscreteLegend, pivotColorLegend)
4117
4379
  ];
4118
4380
  const columnSpecPipeline = [
4119
4381
  pivotAdapter_pivotAdapter(column, pivotColumn)
@@ -4169,7 +4431,7 @@
4169
4431
  const columnParallel = [
4170
4432
  initColumnParallel,
4171
4433
  stackCornerRadius_stackCornerRadius,
4172
- color_color,
4434
+ colorAdapter(color_color, linearColor),
4173
4435
  background_backgroundColor,
4174
4436
  datasetXY,
4175
4437
  progressive,
@@ -4177,9 +4439,9 @@
4177
4439
  yLinear,
4178
4440
  label_label,
4179
4441
  tooltip_tooltip,
4180
- discreteLegend,
4442
+ colorAdapter(discreteLegend, colorLegend),
4181
4443
  verticalCrosshairRect,
4182
- barStyle_barStyle,
4444
+ colorBarStyleFill(barStyle_barStyle),
4183
4445
  annotationPoint_annotationPoint,
4184
4446
  annotationVerticalLine_annotationVerticalLine,
4185
4447
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4193,7 +4455,7 @@
4193
4455
  pivotIndicators_pivotIndicators([
4194
4456
  initColumnParallel,
4195
4457
  stackCornerRadius_stackCornerRadius,
4196
- color_color,
4458
+ colorAdapter(color_color, linearColor),
4197
4459
  background_backgroundColor,
4198
4460
  datasetXY,
4199
4461
  progressive,
@@ -4202,7 +4464,7 @@
4202
4464
  label_label,
4203
4465
  tooltip_tooltip,
4204
4466
  verticalCrosshairRect,
4205
- barStyle_barStyle,
4467
+ colorBarStyleFill(barStyle_barStyle),
4206
4468
  annotationPoint_annotationPoint,
4207
4469
  annotationVerticalLine_annotationVerticalLine,
4208
4470
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4210,7 +4472,7 @@
4210
4472
  ]),
4211
4473
  pivotRowDimensions,
4212
4474
  pivotColumnDimensions,
4213
- pivotDiscreteLegend
4475
+ colorAdapter(pivotDiscreteLegend, pivotColorLegend)
4214
4476
  ];
4215
4477
  const columnParallelSpecPipeline = [
4216
4478
  pivotAdapter_pivotAdapter(columnParallel, pivotColumnParallel)
@@ -4247,7 +4509,7 @@
4247
4509
  initColumn,
4248
4510
  stackCornerRadius_stackCornerRadius,
4249
4511
  stackInverse,
4250
- color_color,
4512
+ colorAdapter(color_color, linearColor),
4251
4513
  background_backgroundColor,
4252
4514
  percent,
4253
4515
  datasetXY,
@@ -4256,9 +4518,9 @@
4256
4518
  yLinear,
4257
4519
  label_label,
4258
4520
  tooltip_tooltip,
4521
+ colorAdapter(discreteLegend, colorLegend),
4259
4522
  verticalCrosshairRect,
4260
- discreteLegend,
4261
- barStyle_barStyle,
4523
+ colorBarStyleFill(barStyle_barStyle),
4262
4524
  annotationPoint_annotationPoint,
4263
4525
  annotationVerticalLine_annotationVerticalLine,
4264
4526
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4273,7 +4535,7 @@
4273
4535
  initColumn,
4274
4536
  stackCornerRadius_stackCornerRadius,
4275
4537
  stackInverse,
4276
- color_color,
4538
+ colorAdapter(color_color, linearColor),
4277
4539
  percent,
4278
4540
  background_backgroundColor,
4279
4541
  datasetXY,
@@ -4283,7 +4545,7 @@
4283
4545
  label_label,
4284
4546
  tooltip_tooltip,
4285
4547
  verticalCrosshairRect,
4286
- barStyle_barStyle,
4548
+ colorBarStyleFill(barStyle_barStyle),
4287
4549
  annotationPoint_annotationPoint,
4288
4550
  annotationVerticalLine_annotationVerticalLine,
4289
4551
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4291,7 +4553,7 @@
4291
4553
  ]),
4292
4554
  pivotRowDimensions,
4293
4555
  pivotColumnDimensions,
4294
- pivotDiscreteLegend
4556
+ colorAdapter(pivotDiscreteLegend, pivotColorLegend)
4295
4557
  ];
4296
4558
  const columnPercentSpecPipeline = [
4297
4559
  pivotAdapter_pivotAdapter(columnPercent, pivotColumnPercent)
@@ -4313,10 +4575,10 @@
4313
4575
  (dimensions[1] || dimensions[0]).id
4314
4576
  ];
4315
4577
  const detail = encoding.detail || [];
4316
- const mergedDetail = chunk_QJLMYOTX_i([
4578
+ const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
4317
4579
  ...color,
4318
4580
  ...detail
4319
- ]);
4581
+ ]) : detail;
4320
4582
  return {
4321
4583
  ...advancedVSeed,
4322
4584
  encoding: {
@@ -4660,7 +4922,7 @@
4660
4922
  const bar = [
4661
4923
  initBar,
4662
4924
  stackCornerRadius_stackCornerRadius,
4663
- color_color,
4925
+ colorAdapter(color_color, linearColor),
4664
4926
  background_backgroundColor,
4665
4927
  datasetYX,
4666
4928
  progressive,
@@ -4668,9 +4930,9 @@
4668
4930
  yBand,
4669
4931
  label_label,
4670
4932
  tooltip_tooltip,
4933
+ colorAdapter(discreteLegend, colorLegend),
4671
4934
  horizontalCrosshairRect,
4672
- discreteLegend,
4673
- barStyle_barStyle,
4935
+ colorBarStyleFill(barStyle_barStyle),
4674
4936
  annotationPoint_annotationPoint,
4675
4937
  annotationVerticalLine_annotationVerticalLine,
4676
4938
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4684,7 +4946,7 @@
4684
4946
  pivotIndicators_pivotIndicators([
4685
4947
  initBar,
4686
4948
  stackCornerRadius_stackCornerRadius,
4687
- color_color,
4949
+ colorAdapter(color_color, linearColor),
4688
4950
  background_backgroundColor,
4689
4951
  datasetYX,
4690
4952
  progressive,
@@ -4693,8 +4955,8 @@
4693
4955
  label_label,
4694
4956
  label_label,
4695
4957
  tooltip_tooltip,
4958
+ colorBarStyleFill(barStyle_barStyle),
4696
4959
  horizontalCrosshairRect,
4697
- barStyle_barStyle,
4698
4960
  annotationPoint_annotationPoint,
4699
4961
  annotationVerticalLine_annotationVerticalLine,
4700
4962
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4702,7 +4964,7 @@
4702
4964
  ]),
4703
4965
  pivotRowDimensions,
4704
4966
  pivotColumnDimensions,
4705
- pivotDiscreteLegend
4967
+ colorAdapter(pivotDiscreteLegend, pivotColorLegend)
4706
4968
  ];
4707
4969
  const barSpecPipeline = [
4708
4970
  pivotAdapter_pivotAdapter(bar, pivotBar)
@@ -4758,7 +5020,7 @@
4758
5020
  const barParallel = [
4759
5021
  initBarParallel,
4760
5022
  stackCornerRadius_stackCornerRadius,
4761
- color_color,
5023
+ colorAdapter(color_color, linearColor),
4762
5024
  background_backgroundColor,
4763
5025
  datasetYX,
4764
5026
  progressive,
@@ -4766,9 +5028,9 @@
4766
5028
  yBand,
4767
5029
  label_label,
4768
5030
  tooltip_tooltip,
5031
+ colorAdapter(discreteLegend, colorLegend),
4769
5032
  horizontalCrosshairRect,
4770
- discreteLegend,
4771
- barStyle_barStyle,
5033
+ colorBarStyleFill(barStyle_barStyle),
4772
5034
  annotationPoint_annotationPoint,
4773
5035
  annotationVerticalLine_annotationVerticalLine,
4774
5036
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4782,15 +5044,15 @@
4782
5044
  pivotIndicators_pivotIndicators([
4783
5045
  initBarParallel,
4784
5046
  stackCornerRadius_stackCornerRadius,
4785
- color_color,
5047
+ colorAdapter(color_color, linearColor),
4786
5048
  background_backgroundColor,
4787
5049
  datasetYX,
4788
5050
  xLinear,
4789
5051
  yBand,
4790
5052
  label_label,
4791
5053
  tooltip_tooltip,
5054
+ colorBarStyleFill(barStyle_barStyle),
4792
5055
  horizontalCrosshairRect,
4793
- barStyle_barStyle,
4794
5056
  annotationPoint_annotationPoint,
4795
5057
  annotationVerticalLine_annotationVerticalLine,
4796
5058
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4798,7 +5060,7 @@
4798
5060
  ]),
4799
5061
  pivotRowDimensions,
4800
5062
  pivotColumnDimensions,
4801
- pivotDiscreteLegend
5063
+ colorAdapter(pivotDiscreteLegend, pivotColorLegend)
4802
5064
  ];
4803
5065
  const barParallelSpecPipeline = [
4804
5066
  pivotAdapter_pivotAdapter(barParallel, pivotBarParallel)
@@ -4827,7 +5089,7 @@
4827
5089
  const barPercent = [
4828
5090
  initBar,
4829
5091
  stackCornerRadius_stackCornerRadius,
4830
- color_color,
5092
+ colorAdapter(color_color, linearColor),
4831
5093
  background_backgroundColor,
4832
5094
  percent,
4833
5095
  datasetYX,
@@ -4836,9 +5098,9 @@
4836
5098
  yBand,
4837
5099
  label_label,
4838
5100
  tooltip_tooltip,
5101
+ colorAdapter(discreteLegend, colorLegend),
4839
5102
  horizontalCrosshairRect,
4840
- discreteLegend,
4841
- barStyle_barStyle,
5103
+ colorBarStyleFill(barStyle_barStyle),
4842
5104
  annotationPoint_annotationPoint,
4843
5105
  annotationVerticalLine_annotationVerticalLine,
4844
5106
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4852,7 +5114,7 @@
4852
5114
  pivotIndicators_pivotIndicators([
4853
5115
  initBar,
4854
5116
  stackCornerRadius_stackCornerRadius,
4855
- color_color,
5117
+ colorAdapter(color_color, linearColor),
4856
5118
  background_backgroundColor,
4857
5119
  percent,
4858
5120
  datasetYX,
@@ -4860,8 +5122,8 @@
4860
5122
  xLinear,
4861
5123
  label_label,
4862
5124
  tooltip_tooltip,
5125
+ colorBarStyleFill(barStyle_barStyle),
4863
5126
  horizontalCrosshairRect,
4864
- barStyle_barStyle,
4865
5127
  annotationPoint_annotationPoint,
4866
5128
  annotationVerticalLine_annotationVerticalLine,
4867
5129
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4869,7 +5131,7 @@
4869
5131
  ]),
4870
5132
  pivotRowDimensions,
4871
5133
  pivotColumnDimensions,
4872
- pivotDiscreteLegend
5134
+ colorAdapter(pivotDiscreteLegend, pivotColorLegend)
4873
5135
  ];
4874
5136
  const barPercentSpecPipeline = [
4875
5137
  pivotAdapter_pivotAdapter(barPercent, pivotBarPercent)
@@ -4906,7 +5168,7 @@
4906
5168
  result.direction = 'vertical';
4907
5169
  result.yField = foldInfo.measureValue;
4908
5170
  result.xField = unfoldInfo.encodingX;
4909
- result.seriesField = unfoldInfo.encodingColorId;
5171
+ result.seriesField = isLinearColor(advancedVSeed) ? unfoldInfo.encodingDetail : unfoldInfo.encodingColorId;
4910
5172
  result.padding = 0;
4911
5173
  result.region = [
4912
5174
  {
@@ -4916,20 +5178,32 @@
4916
5178
  result.animation = true;
4917
5179
  return result;
4918
5180
  };
5181
+ const colorAreaStyleFill = (stylePipe)=>(spec, context)=>{
5182
+ const result = stylePipe(spec, context);
5183
+ const { advancedVSeed } = context;
5184
+ const { datasetReshapeInfo } = advancedVSeed;
5185
+ const { unfoldInfo } = datasetReshapeInfo[0];
5186
+ if (isLinearColor(advancedVSeed)) {
5187
+ if (result?.area?.style) result.area.style.fill = {
5188
+ field: unfoldInfo.encodingColor,
5189
+ scale: 'color'
5190
+ };
5191
+ }
5192
+ return result;
5193
+ };
4919
5194
  const areaStyle_areaStyle = (spec, context)=>{
4920
5195
  const { advancedVSeed } = context;
4921
5196
  const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed;
4922
5197
  const { areaStyle } = markStyle;
4923
5198
  const { unfoldInfo } = datasetReshapeInfo[0];
4924
- if (!areaStyle) return {
5199
+ const result = {
4925
5200
  ...spec,
4926
5201
  area: {
4927
- visible: true
5202
+ visible: true,
5203
+ style: {}
4928
5204
  }
4929
5205
  };
4930
- const result = {
4931
- ...spec
4932
- };
5206
+ if (!areaStyle) return result;
4933
5207
  const areaStyles = Array.isArray(areaStyle) ? areaStyle : [
4934
5208
  areaStyle
4935
5209
  ];
@@ -4957,6 +5231,7 @@
4957
5231
  return {
4958
5232
  ...result,
4959
5233
  area: {
5234
+ ...result.area,
4960
5235
  visible: true,
4961
5236
  state: {
4962
5237
  ...customMap
@@ -4967,7 +5242,7 @@
4967
5242
  const area_area = [
4968
5243
  initArea,
4969
5244
  stackInverse,
4970
- color_color,
5245
+ colorAdapter(color_color, linearColor),
4971
5246
  background_backgroundColor,
4972
5247
  datasetXY,
4973
5248
  progressive,
@@ -4975,12 +5250,12 @@
4975
5250
  yLinear,
4976
5251
  label_label,
4977
5252
  tooltip_tooltip,
5253
+ colorAdapter(discreteLegend, colorLegend),
4978
5254
  verticalCrosshairLine,
4979
- discreteLegend,
4980
- pointStyle_pointStyle,
5255
+ colorPointStyleFill(pointStyle_pointStyle),
4981
5256
  pointStateDimensionHover,
4982
- lineStyle_lineStyle,
4983
- areaStyle_areaStyle,
5257
+ colorLineStyleFill(lineStyle_lineStyle),
5258
+ colorAreaStyleFill(areaStyle_areaStyle),
4984
5259
  annotationPoint_annotationPoint,
4985
5260
  annotationVerticalLine_annotationVerticalLine,
4986
5261
  annotationHorizontalLine_annotationHorizontalLine,
@@ -4993,7 +5268,7 @@
4993
5268
  datasetPivot,
4994
5269
  pivotIndicators_pivotIndicators([
4995
5270
  initArea,
4996
- color_color,
5271
+ colorAdapter(color_color, linearColor),
4997
5272
  background_backgroundColor,
4998
5273
  stackInverse,
4999
5274
  datasetXY,
@@ -5003,10 +5278,10 @@
5003
5278
  label_label,
5004
5279
  tooltip_tooltip,
5005
5280
  verticalCrosshairLine,
5006
- pointStyle_pointStyle,
5281
+ colorPointStyleFill(pointStyle_pointStyle),
5007
5282
  pointStateDimensionHover,
5008
- lineStyle_lineStyle,
5009
- areaStyle_areaStyle,
5283
+ colorLineStyleFill(lineStyle_lineStyle),
5284
+ colorAreaStyleFill(areaStyle_areaStyle),
5010
5285
  annotationPoint_annotationPoint,
5011
5286
  annotationVerticalLine_annotationVerticalLine,
5012
5287
  annotationHorizontalLine_annotationHorizontalLine,
@@ -5014,7 +5289,7 @@
5014
5289
  ]),
5015
5290
  pivotRowDimensions,
5016
5291
  pivotColumnDimensions,
5017
- pivotDiscreteLegend
5292
+ colorAdapter(pivotDiscreteLegend, pivotColorLegend)
5018
5293
  ];
5019
5294
  const areaSpecPipeline = [
5020
5295
  pivotAdapter_pivotAdapter(area_area, pivotArea)
@@ -5043,7 +5318,7 @@
5043
5318
  const areaPercent = [
5044
5319
  initArea,
5045
5320
  stackInverse,
5046
- color_color,
5321
+ colorAdapter(color_color, linearColor),
5047
5322
  background_backgroundColor,
5048
5323
  percent,
5049
5324
  datasetXY,
@@ -5052,11 +5327,12 @@
5052
5327
  yLinear,
5053
5328
  label_label,
5054
5329
  tooltip_tooltip,
5330
+ colorAdapter(discreteLegend, colorLegend),
5055
5331
  verticalCrosshairLine,
5056
- discreteLegend,
5057
- pointStyle_pointStyle,
5058
- lineStyle_lineStyle,
5059
- areaStyle_areaStyle,
5332
+ colorPointStyleFill(pointStyle_pointStyle),
5333
+ pointStateDimensionHover,
5334
+ colorLineStyleFill(lineStyle_lineStyle),
5335
+ colorAreaStyleFill(areaStyle_areaStyle),
5060
5336
  annotationPoint_annotationPoint,
5061
5337
  annotationVerticalLine_annotationVerticalLine,
5062
5338
  annotationHorizontalLine_annotationHorizontalLine,
@@ -5070,7 +5346,7 @@
5070
5346
  pivotIndicators_pivotIndicators([
5071
5347
  initArea,
5072
5348
  stackInverse,
5073
- color_color,
5349
+ colorAdapter(color_color, linearColor),
5074
5350
  background_backgroundColor,
5075
5351
  percent,
5076
5352
  datasetXY,
@@ -5080,9 +5356,10 @@
5080
5356
  label_label,
5081
5357
  tooltip_tooltip,
5082
5358
  verticalCrosshairLine,
5083
- pointStyle_pointStyle,
5084
- lineStyle_lineStyle,
5085
- areaStyle_areaStyle,
5359
+ colorPointStyleFill(pointStyle_pointStyle),
5360
+ pointStateDimensionHover,
5361
+ colorLineStyleFill(lineStyle_lineStyle),
5362
+ colorAreaStyleFill(areaStyle_areaStyle),
5086
5363
  annotationPoint_annotationPoint,
5087
5364
  annotationVerticalLine_annotationVerticalLine,
5088
5365
  annotationHorizontalLine_annotationHorizontalLine,
@@ -5090,7 +5367,7 @@
5090
5367
  ]),
5091
5368
  pivotRowDimensions,
5092
5369
  pivotColumnDimensions,
5093
- pivotDiscreteLegend
5370
+ colorAdapter(pivotDiscreteLegend, pivotColorLegend)
5094
5371
  ];
5095
5372
  const areaPercentSpecPipeline = [
5096
5373
  pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
@@ -5198,10 +5475,10 @@
5198
5475
  const color = encoding.color || [
5199
5476
  (dimensions[1] || dimensions[0]).id
5200
5477
  ];
5201
- const mergedDetail = chunk_QJLMYOTX_i([
5478
+ const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
5202
5479
  ...color,
5203
5480
  ...detail
5204
- ]);
5481
+ ]) : detail;
5205
5482
  return {
5206
5483
  ...advancedVSeed,
5207
5484
  encoding: {
@@ -5445,7 +5722,7 @@
5445
5722
  };
5446
5723
  const scatter = [
5447
5724
  initScatter,
5448
- color_color,
5725
+ colorAdapter(color_color, linearColor),
5449
5726
  background_backgroundColor,
5450
5727
  datasetScatter,
5451
5728
  progressive,
@@ -5453,10 +5730,10 @@
5453
5730
  yLinear,
5454
5731
  label_label,
5455
5732
  tooltip_tooltip,
5733
+ colorAdapter(discreteLegend, colorLegend),
5456
5734
  verticalCrosshairLine,
5457
5735
  horizontalCrosshairLine,
5458
- discreteLegend,
5459
- pointStyle_pointStyle,
5736
+ colorPointStyleFill(pointStyle_pointStyle),
5460
5737
  pointStateHover,
5461
5738
  annotationPoint_annotationPoint,
5462
5739
  annotationVerticalLine_annotationVerticalLine,
@@ -5470,7 +5747,7 @@
5470
5747
  datasetPivot,
5471
5748
  pivotIndicators_pivotIndicators([
5472
5749
  initScatter,
5473
- color_color,
5750
+ colorAdapter(color_color, linearColor),
5474
5751
  background_backgroundColor,
5475
5752
  datasetScatter,
5476
5753
  progressive,
@@ -5480,7 +5757,7 @@
5480
5757
  tooltip_tooltip,
5481
5758
  verticalCrosshairLine,
5482
5759
  horizontalCrosshairLine,
5483
- pointStyle_pointStyle,
5760
+ colorPointStyleFill(pointStyle_pointStyle),
5484
5761
  pointStateHover,
5485
5762
  annotationPoint_annotationPoint,
5486
5763
  annotationVerticalLine_annotationVerticalLine,
@@ -5600,10 +5877,10 @@
5600
5877
  (dimensions[1] || dimensions[0]).id
5601
5878
  ];
5602
5879
  const detail = encoding.detail || [];
5603
- const mergedDetail = chunk_QJLMYOTX_i([
5880
+ const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
5604
5881
  ...color,
5605
5882
  ...detail
5606
- ]);
5883
+ ]) : detail;
5607
5884
  return {
5608
5885
  ...advancedVSeed,
5609
5886
  encoding: {
@@ -6795,10 +7072,10 @@
6795
7072
  (dimensions[1] || dimensions[0]).id
6796
7073
  ];
6797
7074
  const detail = encoding.detail || [];
6798
- const mergedDetail = chunk_QJLMYOTX_i([
7075
+ const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
6799
7076
  ...color,
6800
7077
  ...detail
6801
- ]);
7078
+ ]) : detail;
6802
7079
  return {
6803
7080
  ...advancedVSeed,
6804
7081
  encoding: {
@@ -7114,10 +7391,10 @@
7114
7391
  (dimensions[1] || dimensions[0]).id
7115
7392
  ];
7116
7393
  const detail = encoding.detail || [];
7117
- const mergedDetail = chunk_QJLMYOTX_i([
7394
+ const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
7118
7395
  ...color,
7119
7396
  ...detail
7120
- ]);
7397
+ ]) : detail;
7121
7398
  return {
7122
7399
  ...advancedVSeed,
7123
7400
  encoding: {
@@ -7168,7 +7445,7 @@
7168
7445
  result.type = 'radar';
7169
7446
  result.angleField = unfoldInfo.encodingAngle;
7170
7447
  result.radiusField = foldInfo.measureValue;
7171
- result.seriesField = unfoldInfo.encodingColorId;
7448
+ result.seriesField = isLinearColor(advancedVSeed) ? unfoldInfo.encodingDetail : unfoldInfo.encodingColorId;
7172
7449
  result.padding = 0;
7173
7450
  result.region = [
7174
7451
  {
@@ -7233,7 +7510,7 @@
7233
7510
  };
7234
7511
  const radar = [
7235
7512
  initRadar,
7236
- color_color,
7513
+ colorAdapter(color_color, linearColor),
7237
7514
  background_backgroundColor,
7238
7515
  datasetXY,
7239
7516
  progressive,
@@ -7241,12 +7518,12 @@
7241
7518
  radarRadiusAxis,
7242
7519
  label_label,
7243
7520
  tooltip_tooltip,
7521
+ colorAdapter(discreteLegend, colorLegend),
7244
7522
  verticalCrosshairLine,
7245
- discreteLegend,
7246
- pointStyle_pointStyle,
7523
+ colorPointStyleFill(pointStyle_pointStyle),
7247
7524
  pointStateDimensionHover,
7248
- lineStyle_lineStyle,
7249
- areaStyle_areaStyle
7525
+ colorLineStyleFill(lineStyle_lineStyle),
7526
+ colorAreaStyleFill(areaStyle_areaStyle)
7250
7527
  ];
7251
7528
  const pivotRadar = [
7252
7529
  initPivot,
@@ -7255,7 +7532,7 @@
7255
7532
  datasetPivot,
7256
7533
  pivotIndicators_pivotIndicators([
7257
7534
  initRadar,
7258
- color_color,
7535
+ colorAdapter(color_color, linearColor),
7259
7536
  background_backgroundColor,
7260
7537
  datasetXY,
7261
7538
  progressive,
@@ -7264,14 +7541,14 @@
7264
7541
  label_label,
7265
7542
  tooltip_tooltip,
7266
7543
  verticalCrosshairLine,
7267
- pointStyle_pointStyle,
7544
+ colorPointStyleFill(pointStyle_pointStyle),
7268
7545
  pointStateDimensionHover,
7269
- lineStyle_lineStyle,
7270
- areaStyle_areaStyle
7546
+ colorLineStyleFill(lineStyle_lineStyle),
7547
+ colorAreaStyleFill(areaStyle_areaStyle)
7271
7548
  ]),
7272
7549
  pivotRowDimensions,
7273
7550
  pivotColumnDimensions,
7274
- pivotDiscreteLegend
7551
+ colorAdapter(pivotDiscreteLegend, pivotColorLegend)
7275
7552
  ];
7276
7553
  const radarSpecPipeline = [
7277
7554
  pivotAdapter_pivotAdapter(radar, pivotRadar)
@@ -7659,6 +7936,10 @@
7659
7936
  const baseConfig = {
7660
7937
  backgroundColor: 'transparent',
7661
7938
  color: {
7939
+ linearColorScheme: [
7940
+ '#C2CEFF',
7941
+ '#5766EC'
7942
+ ],
7662
7943
  colorScheme: [
7663
7944
  '#8D72F6',
7664
7945
  '#5766EC',
@@ -7723,8 +8004,8 @@
7723
8004
  stackCornerRadius: [
7724
8005
  4,
7725
8006
  4,
7726
- 4,
7727
- 4
8007
+ 0,
8008
+ 0
7728
8009
  ]
7729
8010
  },
7730
8011
  columnParallel: {
@@ -7735,8 +8016,8 @@
7735
8016
  stackCornerRadius: [
7736
8017
  4,
7737
8018
  4,
7738
- 4,
7739
- 4
8019
+ 0,
8020
+ 0
7740
8021
  ]
7741
8022
  },
7742
8023
  columnPercent: {
@@ -7747,8 +8028,8 @@
7747
8028
  stackCornerRadius: [
7748
8029
  4,
7749
8030
  4,
7750
- 4,
7751
- 4
8031
+ 0,
8032
+ 0
7752
8033
  ]
7753
8034
  },
7754
8035
  bar: {
@@ -7757,10 +8038,10 @@
7757
8038
  yAxis: barBandAxis,
7758
8039
  crosshairRect,
7759
8040
  stackCornerRadius: [
8041
+ 0,
7760
8042
  4,
7761
8043
  4,
7762
- 4,
7763
- 4
8044
+ 0
7764
8045
  ]
7765
8046
  },
7766
8047
  barParallel: {
@@ -7769,10 +8050,10 @@
7769
8050
  yAxis: barBandAxis,
7770
8051
  crosshairRect,
7771
8052
  stackCornerRadius: [
8053
+ 0,
7772
8054
  4,
7773
8055
  4,
7774
- 4,
7775
- 4
8056
+ 0
7776
8057
  ]
7777
8058
  },
7778
8059
  barPercent: {
@@ -7781,10 +8062,10 @@
7781
8062
  yAxis: barBandAxis,
7782
8063
  crosshairRect,
7783
8064
  stackCornerRadius: [
8065
+ 0,
7784
8066
  4,
7785
8067
  4,
7786
- 4,
7787
- 4
8068
+ 0
7788
8069
  ]
7789
8070
  },
7790
8071
  area: {
@@ -7849,38 +8130,10 @@
7849
8130
  ...baseConfig
7850
8131
  },
7851
8132
  funnel: {
7852
- ...baseConfig,
7853
- color: {
7854
- colorScheme: [
7855
- '#5766EC',
7856
- '#6372F0',
7857
- '#7080F4',
7858
- '#7C8CFA',
7859
- '#8998FF',
7860
- '#95A3FF',
7861
- '#A0AEFF',
7862
- '#ACB9FF',
7863
- '#B7C4FF',
7864
- '#C2CEFF'
7865
- ].reverse()
7866
- }
8133
+ ...baseConfig
7867
8134
  },
7868
8135
  heatmap: {
7869
- ...baseConfig,
7870
- color: {
7871
- colorScheme: [
7872
- '#5766EC',
7873
- '#6372F0',
7874
- '#7080F4',
7875
- '#7C8CFA',
7876
- '#8998FF',
7877
- '#95A3FF',
7878
- '#A0AEFF',
7879
- '#ACB9FF',
7880
- '#B7C4FF',
7881
- '#C2CEFF'
7882
- ].reverse()
7883
- }
8136
+ ...baseConfig
7884
8137
  }
7885
8138
  }
7886
8139
  };
@@ -7992,6 +8245,10 @@
7992
8245
  const baseConfig = {
7993
8246
  backgroundColor: 'transparent',
7994
8247
  color: {
8248
+ linearColorScheme: [
8249
+ '#A0CEFF',
8250
+ '#2E62F1'
8251
+ ],
7995
8252
  colorScheme: [
7996
8253
  '#2E62F1',
7997
8254
  '#4DC36A',
@@ -8055,8 +8312,8 @@
8055
8312
  stackCornerRadius: [
8056
8313
  4,
8057
8314
  4,
8058
- 4,
8059
- 4
8315
+ 0,
8316
+ 0
8060
8317
  ]
8061
8318
  },
8062
8319
  columnParallel: {
@@ -8067,8 +8324,8 @@
8067
8324
  stackCornerRadius: [
8068
8325
  4,
8069
8326
  4,
8070
- 4,
8071
- 4
8327
+ 0,
8328
+ 0
8072
8329
  ]
8073
8330
  },
8074
8331
  columnPercent: {
@@ -8079,8 +8336,8 @@
8079
8336
  stackCornerRadius: [
8080
8337
  4,
8081
8338
  4,
8082
- 4,
8083
- 4
8339
+ 0,
8340
+ 0
8084
8341
  ]
8085
8342
  },
8086
8343
  bar: {
@@ -8101,10 +8358,10 @@
8101
8358
  yAxis: barBandAxis,
8102
8359
  crosshairRect: crosshairRect,
8103
8360
  stackCornerRadius: [
8361
+ 0,
8104
8362
  4,
8105
8363
  4,
8106
- 4,
8107
- 4
8364
+ 0
8108
8365
  ]
8109
8366
  },
8110
8367
  barPercent: {
@@ -8113,10 +8370,10 @@
8113
8370
  yAxis: barBandAxis,
8114
8371
  crosshairRect: crosshairRect,
8115
8372
  stackCornerRadius: [
8373
+ 0,
8116
8374
  4,
8117
8375
  4,
8118
- 4,
8119
- 4
8376
+ 0
8120
8377
  ]
8121
8378
  },
8122
8379
  area: {
@@ -8181,21 +8438,7 @@
8181
8438
  ...baseConfig
8182
8439
  },
8183
8440
  funnel: {
8184
- ...baseConfig,
8185
- color: {
8186
- colorScheme: [
8187
- '#2E62F1',
8188
- '#3A6EF6',
8189
- '#4780FA',
8190
- '#548CFE',
8191
- '#6198FF',
8192
- '#6FA3FF',
8193
- '#7CACFF',
8194
- '#88B7FF',
8195
- '#94C2FF',
8196
- '#A0CEFF'
8197
- ]
8198
- }
8441
+ ...baseConfig
8199
8442
  },
8200
8443
  heatmap: {
8201
8444
  ...baseConfig
@@ -8246,9 +8489,6 @@
8246
8489
  const updateSpec = (chartType, specPipe)=>{
8247
8490
  Builder._customSpecPipe[chartType] = specPipe;
8248
8491
  };
8249
- const isDimension = (dimension)=>!('children' in dimension);
8250
- const isDimensionGroup = (dimension)=>'children' in dimension;
8251
- const isDimensions = (dimensions)=>dimensions.every(isDimension);
8252
8492
  Object.freeze({
8253
8493
  status: "aborted"
8254
8494
  });
@@ -11649,6 +11889,8 @@
11649
11889
  const zScatterMeasures = schemas_array(zScatterMeasure);
11650
11890
  const zFoldInfo = schemas_object({
11651
11891
  foldMap: record(schemas_string(), schemas_string().or(schemas_undefined())),
11892
+ colorRange: schemas_array(schemas_number()),
11893
+ measureRange: schemas_array(schemas_number()),
11652
11894
  measureId: schemas_string(),
11653
11895
  measureName: schemas_string(),
11654
11896
  measureValue: schemas_string()
@@ -11793,10 +12035,11 @@
11793
12035
  const zBackgroundColor = schemas_string().default('transparent').nullish();
11794
12036
  const zColor = schemas_object({
11795
12037
  colorScheme: schemas_array(schemas_string()).nullish(),
12038
+ linearColorScheme: schemas_array(schemas_string()).nullish(),
11796
12039
  colorMapping: record(schemas_string(), schemas_string()).nullish()
11797
12040
  });
11798
12041
  const zLinearColor = schemas_object({
11799
- colorScheme: schemas_array(schemas_string()).nullish()
12042
+ linearColorScheme: schemas_array(schemas_string()).nullish()
11800
12043
  });
11801
12044
  const zLabel = schemas_object({
11802
12045
  enable: schemas_boolean().default(true).nullish()
@@ -12777,7 +13020,7 @@
12777
13020
  dimensions: zDimensions.nullish(),
12778
13021
  measures: zMeasureTree.nullish(),
12779
13022
  backgroundColor: zBackgroundColor.nullish(),
12780
- color: zLinearColor.nullish(),
13023
+ color: zColor.nullish(),
12781
13024
  label: zLabel.nullish(),
12782
13025
  legend: zColorLegend.nullish(),
12783
13026
  tooltip: zTooltip.nullish(),
@@ -12790,7 +13033,7 @@
12790
13033
  dimensions: zDimensions.nullish(),
12791
13034
  measures: zMeasureTree.nullish(),
12792
13035
  backgroundColor: zBackgroundColor.nullish(),
12793
- color: zLinearColor.nullish(),
13036
+ color: zColor.nullish(),
12794
13037
  label: zLabel.nullish(),
12795
13038
  legend: zColorLegend.nullish(),
12796
13039
  tooltip: zTooltip.nullish(),