@visactor/vseed 0.1.40 → 0.1.42

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 (193) hide show
  1. package/dist/cjs/index.cjs +3 -3
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/builder/builder/builder.d.ts +3211 -349
  4. package/dist/esm/pipeline/advanced/chart/pipeline/column.js +3 -2
  5. package/dist/esm/pipeline/advanced/chart/pipeline/column.js.map +1 -1
  6. package/dist/esm/pipeline/advanced/chart/pipeline/scatter.js +3 -2
  7. package/dist/esm/pipeline/advanced/chart/pipeline/scatter.js.map +1 -1
  8. package/dist/esm/pipeline/advanced/chart/pipes/analysis/common.d.ts +3 -0
  9. package/dist/esm/pipeline/advanced/chart/pipes/analysis/common.js +22 -0
  10. package/dist/esm/pipeline/advanced/chart/pipes/analysis/common.js.map +1 -0
  11. package/dist/esm/pipeline/advanced/chart/pipes/analysis/index.d.ts +1 -0
  12. package/dist/esm/pipeline/advanced/chart/pipes/analysis/index.js +1 -0
  13. package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortLegend.js +1 -19
  14. package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortLegend.js.map +1 -1
  15. package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortXBand.d.ts +1 -2
  16. package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortXBand.js +2 -20
  17. package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortXBand.js.map +1 -1
  18. package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortYBand.js +1 -1
  19. package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortYBand.js.map +1 -1
  20. package/dist/esm/pipeline/advanced/chart/pipes/regressionLine/regressionLine.js +28 -1
  21. package/dist/esm/pipeline/advanced/chart/pipes/regressionLine/regressionLine.js.map +1 -1
  22. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithBoxplotEncoding.js +0 -1
  23. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithBoxplotEncoding.js.map +1 -1
  24. package/dist/esm/pipeline/spec/chart/pipeline/area.js +7 -4
  25. package/dist/esm/pipeline/spec/chart/pipeline/area.js.map +1 -1
  26. package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js +3 -2
  27. package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js.map +1 -1
  28. package/dist/esm/pipeline/spec/chart/pipeline/bar.js +4 -2
  29. package/dist/esm/pipeline/spec/chart/pipeline/bar.js.map +1 -1
  30. package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js +4 -2
  31. package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js.map +1 -1
  32. package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js +4 -2
  33. package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js.map +1 -1
  34. package/dist/esm/pipeline/spec/chart/pipeline/boxplot.js +3 -2
  35. package/dist/esm/pipeline/spec/chart/pipeline/boxplot.js.map +1 -1
  36. package/dist/esm/pipeline/spec/chart/pipeline/column.js +8 -4
  37. package/dist/esm/pipeline/spec/chart/pipeline/column.js.map +1 -1
  38. package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js +4 -2
  39. package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js.map +1 -1
  40. package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js +4 -2
  41. package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js.map +1 -1
  42. package/dist/esm/pipeline/spec/chart/pipeline/donut.js +3 -1
  43. package/dist/esm/pipeline/spec/chart/pipeline/donut.js.map +1 -1
  44. package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.js +3 -2
  45. package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.js.map +1 -1
  46. package/dist/esm/pipeline/spec/chart/pipeline/funnel.js +2 -1
  47. package/dist/esm/pipeline/spec/chart/pipeline/funnel.js.map +1 -1
  48. package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js +3 -2
  49. package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js.map +1 -1
  50. package/dist/esm/pipeline/spec/chart/pipeline/histogram.js +7 -4
  51. package/dist/esm/pipeline/spec/chart/pipeline/histogram.js.map +1 -1
  52. package/dist/esm/pipeline/spec/chart/pipeline/line.js +7 -4
  53. package/dist/esm/pipeline/spec/chart/pipeline/line.js.map +1 -1
  54. package/dist/esm/pipeline/spec/chart/pipeline/pie.js +4 -2
  55. package/dist/esm/pipeline/spec/chart/pipeline/pie.js.map +1 -1
  56. package/dist/esm/pipeline/spec/chart/pipeline/radar.js +3 -1
  57. package/dist/esm/pipeline/spec/chart/pipeline/radar.js.map +1 -1
  58. package/dist/esm/pipeline/spec/chart/pipeline/rose.js +3 -1
  59. package/dist/esm/pipeline/spec/chart/pipeline/rose.js.map +1 -1
  60. package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.js +3 -1
  61. package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.js.map +1 -1
  62. package/dist/esm/pipeline/spec/chart/pipeline/scatter.js +11 -4
  63. package/dist/esm/pipeline/spec/chart/pipeline/scatter.js.map +1 -1
  64. package/dist/esm/pipeline/spec/chart/pipes/annotation/index.d.ts +1 -0
  65. package/dist/esm/pipeline/spec/chart/pipes/annotation/index.js +2 -1
  66. package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.d.ts +2 -0
  67. package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.js +172 -0
  68. package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.js.map +1 -0
  69. package/dist/esm/pipeline/spec/chart/pipes/index.d.ts +1 -0
  70. package/dist/esm/pipeline/spec/chart/pipes/index.js +1 -0
  71. package/dist/esm/pipeline/spec/chart/pipes/init/pivot.js +1 -1
  72. package/dist/esm/pipeline/spec/chart/pipes/init/pivot.js.map +1 -1
  73. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/index.d.ts +2 -0
  74. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/index.js +3 -1
  75. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.d.ts +2 -0
  76. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js +13 -0
  77. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js.map +1 -0
  78. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js +38 -32
  79. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js.map +1 -1
  80. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotTitle.d.ts +2 -0
  81. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotTitle.js +28 -0
  82. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotTitle.js.map +1 -0
  83. package/dist/esm/pipeline/spec/chart/pipes/region/addRegionPadding.d.ts +2 -0
  84. package/dist/esm/pipeline/spec/chart/pipes/region/addRegionPadding.js +10 -0
  85. package/dist/esm/pipeline/spec/chart/pipes/region/addRegionPadding.js.map +1 -0
  86. package/dist/esm/pipeline/spec/chart/pipes/region/index.d.ts +1 -0
  87. package/dist/esm/pipeline/spec/chart/pipes/region/index.js +1 -0
  88. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.d.ts +2 -0
  89. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.js +150 -0
  90. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.js.map +1 -0
  91. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/common.d.ts +4 -0
  92. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/common.js +21 -0
  93. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/common.js.map +1 -0
  94. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.d.ts +2 -0
  95. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js +98 -0
  96. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js.map +1 -0
  97. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/index.d.ts +4 -1
  98. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/index.js +4 -1
  99. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.d.ts +2 -0
  100. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js +98 -0
  101. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js.map +1 -0
  102. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.d.ts +16 -0
  103. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.js +159 -0
  104. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.js.map +1 -0
  105. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.d.ts +2 -2
  106. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js +5 -5
  107. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js.map +1 -1
  108. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js +2 -2
  109. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js.map +1 -1
  110. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.d.ts +1 -1
  111. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js +1 -6
  112. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js.map +1 -1
  113. package/dist/esm/theme/common/color.d.ts +4 -0
  114. package/dist/esm/theme/common/color.js +6 -2
  115. package/dist/esm/theme/common/color.js.map +1 -1
  116. package/dist/esm/theme/common/regressionLine.d.ts +8 -4
  117. package/dist/esm/theme/common/regressionLine.js +60 -8
  118. package/dist/esm/theme/common/regressionLine.js.map +1 -1
  119. package/dist/esm/theme/common/table.d.ts +6 -0
  120. package/dist/esm/theme/common/table.js +4 -1
  121. package/dist/esm/theme/common/table.js.map +1 -1
  122. package/dist/esm/theme/dark/dark.js +8 -6
  123. package/dist/esm/theme/dark/dark.js.map +1 -1
  124. package/dist/esm/theme/light/light.js +8 -6
  125. package/dist/esm/theme/light/light.js.map +1 -1
  126. package/dist/esm/types/advancedVSeed.d.ts +1028 -37
  127. package/dist/esm/types/advancedVSeed.js +2 -2
  128. package/dist/esm/types/advancedVSeed.js.map +1 -1
  129. package/dist/esm/types/chartType/column/column.d.ts +6 -1
  130. package/dist/esm/types/chartType/column/zColumn.d.ts +25 -0
  131. package/dist/esm/types/chartType/column/zColumn.js +2 -1
  132. package/dist/esm/types/chartType/column/zColumn.js.map +1 -1
  133. package/dist/esm/types/chartType/histogram/histogram.d.ts +7 -3
  134. package/dist/esm/types/chartType/histogram/zHistogram.d.ts +19 -4
  135. package/dist/esm/types/chartType/histogram/zHistogram.js +3 -2
  136. package/dist/esm/types/chartType/histogram/zHistogram.js.map +1 -1
  137. package/dist/esm/types/chartType/scatter/scatter.d.ts +21 -1
  138. package/dist/esm/types/chartType/scatter/zScatter.d.ts +94 -0
  139. package/dist/esm/types/chartType/scatter/zScatter.js +5 -1
  140. package/dist/esm/types/chartType/scatter/zScatter.js.map +1 -1
  141. package/dist/esm/types/properties/annotation/annotationHorizontalLine.d.ts +13 -0
  142. package/dist/esm/types/properties/config/area.d.ts +6 -0
  143. package/dist/esm/types/properties/config/bar.d.ts +9 -0
  144. package/dist/esm/types/properties/config/boxplot.d.ts +3 -0
  145. package/dist/esm/types/properties/config/color/color.d.ts +8 -0
  146. package/dist/esm/types/properties/config/color/color.js.map +1 -1
  147. package/dist/esm/types/properties/config/column.d.ts +141 -2
  148. package/dist/esm/types/properties/config/column.js +6 -3
  149. package/dist/esm/types/properties/config/column.js.map +1 -1
  150. package/dist/esm/types/properties/config/config.d.ts +449 -9
  151. package/dist/esm/types/properties/config/dualAxis.d.ts +3 -0
  152. package/dist/esm/types/properties/config/funnel.d.ts +3 -0
  153. package/dist/esm/types/properties/config/heatmap.d.ts +3 -0
  154. package/dist/esm/types/properties/config/histogram.d.ts +132 -9
  155. package/dist/esm/types/properties/config/histogram.js +2 -2
  156. package/dist/esm/types/properties/config/histogram.js.map +1 -1
  157. package/dist/esm/types/properties/config/line.d.ts +3 -0
  158. package/dist/esm/types/properties/config/pie.d.ts +9 -0
  159. package/dist/esm/types/properties/config/pivotGrid/pivotGrid.d.ts +3 -0
  160. package/dist/esm/types/properties/config/pivotGrid/pivotGrid.js +4 -1
  161. package/dist/esm/types/properties/config/pivotGrid/pivotGrid.js.map +1 -1
  162. package/dist/esm/types/properties/config/rose.d.ts +6 -0
  163. package/dist/esm/types/properties/config/scatter.d.ts +133 -0
  164. package/dist/esm/types/properties/config/scatter.js +3 -1
  165. package/dist/esm/types/properties/config/scatter.js.map +1 -1
  166. package/dist/esm/types/properties/regressionLine/{histogramRegressionLine.d.ts → ecdfRegressionLine.d.ts} +2 -7
  167. package/dist/esm/types/properties/regressionLine/index.d.ts +7 -2
  168. package/dist/esm/types/properties/regressionLine/index.js +1 -1
  169. package/dist/esm/types/properties/regressionLine/kdeRegressionLine.d.ts +40 -0
  170. package/dist/esm/types/properties/regressionLine/linearRegressionLine.d.ts +53 -0
  171. package/dist/esm/types/properties/regressionLine/logisticRegressionLine.d.ts +53 -0
  172. package/dist/esm/types/properties/regressionLine/logisticRegressionLine.js +0 -0
  173. package/dist/esm/types/properties/regressionLine/lowessRegressionLine.d.ts +53 -0
  174. package/dist/esm/types/properties/regressionLine/lowessRegressionLine.js +0 -0
  175. package/dist/esm/types/properties/regressionLine/polynomialRegressionLine.d.ts +57 -0
  176. package/dist/esm/types/properties/regressionLine/polynomialRegressionLine.js +0 -0
  177. package/dist/esm/types/properties/regressionLine/zRegressionLine.d.ts +199 -0
  178. package/dist/esm/types/properties/regressionLine/zRegressionLine.js +32 -0
  179. package/dist/esm/types/properties/regressionLine/zRegressionLine.js.map +1 -0
  180. package/dist/esm/types/properties/theme/customTheme.d.ts +898 -18
  181. package/dist/esm/types/zVseed.d.ts +138 -4
  182. package/dist/umd/index.js +1889 -279
  183. package/dist/umd/index.js.map +1 -1
  184. package/package.json +1 -1
  185. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/histogramRegressionLine.d.ts +0 -2
  186. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/histogramRegressionLine.js +0 -126
  187. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/histogramRegressionLine.js.map +0 -1
  188. package/dist/esm/types/properties/regressionLine/zHistogramRegressionLine.d.ts +0 -11
  189. package/dist/esm/types/properties/regressionLine/zHistogramRegressionLine.js +0 -17
  190. package/dist/esm/types/properties/regressionLine/zHistogramRegressionLine.js.map +0 -1
  191. /package/dist/esm/{pipeline/advanced/chart/pipes/analysis/sort.d.ts → types/properties/regressionLine/ecdfRegressionLine.js} +0 -0
  192. /package/dist/esm/{pipeline/advanced/chart/pipes/analysis/sort.js → types/properties/regressionLine/kdeRegressionLine.js} +0 -0
  193. /package/dist/esm/types/properties/regressionLine/{histogramRegressionLine.js → linearRegressionLine.js} +0 -0
package/dist/umd/index.js CHANGED
@@ -85,11 +85,11 @@
85
85
  isRadar: ()=>isRadar,
86
86
  zSortLegend: ()=>zSortLegend,
87
87
  pivotTableAdvancedPipeline: ()=>pivotTableAdvancedPipeline,
88
+ zLogisticRegressionLine: ()=>zLogisticRegressionLine,
88
89
  zAnnotationHorizontalLine: ()=>zAnnotationHorizontalLine,
89
90
  zYLinearAxis: ()=>zYLinearAxis,
90
91
  zMarkStyle: ()=>zMarkStyle,
91
92
  registerFunnel: ()=>registerFunnel,
92
- zHistogramRegressionLine: ()=>zHistogramRegressionLine,
93
93
  columnAdvancedPipeline: ()=>columnAdvancedPipeline,
94
94
  zLabel: ()=>zLabel,
95
95
  registerColumn: ()=>registerColumn,
@@ -138,6 +138,7 @@
138
138
  registerAll: ()=>registerAll,
139
139
  isVChart: ()=>isVChart,
140
140
  registerBar: ()=>registerBar,
141
+ zPolynomialRegressionLine: ()=>zPolynomialRegressionLine,
141
142
  zColor: ()=>zColor,
142
143
  registerDonut: ()=>registerDonut,
143
144
  BinStartMeasureId: ()=>BinStartMeasureId,
@@ -172,6 +173,7 @@
172
173
  areaPercentAdvancedPipeline: ()=>areaPercentAdvancedPipeline,
173
174
  zBackgroundColor: ()=>zBackgroundColor,
174
175
  zAreaPercentConfig: ()=>zAreaPercentConfig,
176
+ zLowessRegressionLine: ()=>zLowessRegressionLine,
175
177
  registerRadar: ()=>registerRadar,
176
178
  zMeasure: ()=>zMeasure,
177
179
  zLocale: ()=>zLocale,
@@ -193,6 +195,7 @@
193
195
  isPivotTable: ()=>isPivotTable,
194
196
  registerPie: ()=>registerPie,
195
197
  zDimensionEncoding: ()=>zDimensionEncoding,
198
+ zEcdfRegressionLine: ()=>zEcdfRegressionLine,
196
199
  zBarParallelConfig: ()=>zBarParallelConfig,
197
200
  lineAdvancedPipeline: ()=>lineAdvancedPipeline,
198
201
  FoldMeasureValue: ()=>FoldMeasureValue,
@@ -216,10 +219,12 @@
216
219
  findFirstMeasure: ()=>findFirstMeasure,
217
220
  scatterAdvancedPipeline: ()=>scatterAdvancedPipeline,
218
221
  zFunnelTransform: ()=>zFunnelTransform,
222
+ zLinearRegressionLine: ()=>zLinearRegressionLine,
219
223
  zRoseConfig: ()=>zRoseConfig,
220
224
  zScatterMeasures: ()=>zScatterMeasures,
221
225
  zAnnotation: ()=>zAnnotation,
222
226
  selector: ()=>selector_selector,
227
+ zKdeRegressionLine: ()=>zKdeRegressionLine,
223
228
  isMeasures: ()=>isMeasures,
224
229
  zYBandAxis: ()=>zYBandAxis,
225
230
  BinPercentageMeasureId: ()=>BinPercentageMeasureId,
@@ -232,6 +237,7 @@
232
237
  registerHistogram: ()=>registerHistogram,
233
238
  zRoseParallel: ()=>zRoseParallel,
234
239
  MeasureName: ()=>MeasureName,
240
+ zRegressionLine: ()=>zRegressionLine,
235
241
  zNumFormat: ()=>zNumFormat,
236
242
  FoldYMeasureValue: ()=>FoldYMeasureValue,
237
243
  zPivotTableConfig: ()=>zPivotTableConfig,
@@ -425,7 +431,7 @@
425
431
  function C(t, ...o) {
426
432
  let n = t, u = o.map((e)=>"lazy" in e ? chunk_3GOCSNFN_y(e) : void 0), p = 0;
427
433
  for(; p < o.length;){
428
- if (void 0 === u[p] || !B(n)) {
434
+ if (void 0 === u[p] || !chunk_3GOCSNFN_B(n)) {
429
435
  let i = o[p];
430
436
  n = i(n), p += 1;
431
437
  continue;
@@ -467,7 +473,7 @@
467
473
  items: []
468
474
  });
469
475
  }
470
- function B(t) {
476
+ function chunk_3GOCSNFN_B(t) {
471
477
  return "string" == typeof t || "object" == typeof t && null !== t && Symbol.iterator in t;
472
478
  }
473
479
  function chunk_LFJW7BOT_y(t, i) {
@@ -2300,22 +2306,6 @@
2300
2306
  ];
2301
2307
  return e.sort(t), e;
2302
2308
  }
2303
- const sortXBandAxis = (advancedVSeed, context)=>{
2304
- const result = {
2305
- ...advancedVSeed
2306
- };
2307
- const { vseed } = context;
2308
- const { sort: sortAxis } = vseed;
2309
- const { datasetReshapeInfo, dataset } = advancedVSeed;
2310
- const { unfoldInfo } = datasetReshapeInfo[0];
2311
- const xField = unfoldInfo.encodingX;
2312
- if (!sortAxis || !xField) return advancedVSeed;
2313
- if (!result.analysis) result.analysis = {};
2314
- if (!result.analysis.orderMapping) result.analysis.orderMapping = {};
2315
- const axisOrderResult = calcOrder(sortAxis, xField, dataset.flat(2));
2316
- result.analysis.orderMapping[xField] = axisOrderResult;
2317
- return result;
2318
- };
2319
2309
  const calcOrder = (sortConfig, id, dataset)=>{
2320
2310
  if (sortConfig.customOrder) return sortConfig.customOrder;
2321
2311
  const order = sortConfig.order || 'asc';
@@ -2334,6 +2324,22 @@
2334
2324
  });
2335
2325
  return chunk_QJLMYOTX_i(res.map((item)=>item[id]));
2336
2326
  };
2327
+ const sortXBandAxis = (advancedVSeed, context)=>{
2328
+ const result = {
2329
+ ...advancedVSeed
2330
+ };
2331
+ const { vseed } = context;
2332
+ const { sort: sortAxis } = vseed;
2333
+ const { datasetReshapeInfo, dataset } = advancedVSeed;
2334
+ const { unfoldInfo } = datasetReshapeInfo[0];
2335
+ const xField = unfoldInfo.encodingX;
2336
+ if (!sortAxis || !xField) return advancedVSeed;
2337
+ if (!result.analysis) result.analysis = {};
2338
+ if (!result.analysis.orderMapping) result.analysis.orderMapping = {};
2339
+ const axisOrderResult = calcOrder(sortAxis, xField, dataset.flat(2));
2340
+ result.analysis.orderMapping[xField] = axisOrderResult;
2341
+ return result;
2342
+ };
2337
2343
  const sortLegend_sortLegend = (advancedVSeed, context)=>{
2338
2344
  const result = {
2339
2345
  ...advancedVSeed
@@ -2356,28 +2362,10 @@
2356
2362
  result.analysis.orderMapping[colorId] = orderRes;
2357
2363
  return result;
2358
2364
  }
2359
- const orderRes = sortLegend_calcOrder(sortLegend, colorId, dataset?.flat(2) || []);
2365
+ const orderRes = calcOrder(sortLegend, colorId, dataset?.flat(2) || []);
2360
2366
  result.analysis.orderMapping[colorId] = orderRes;
2361
2367
  return result;
2362
2368
  };
2363
- const sortLegend_calcOrder = (sortConfig, id, dataset)=>{
2364
- if (sortConfig.customOrder) return sortConfig.customOrder;
2365
- const order = sortConfig.order || 'asc';
2366
- const orderBy = sortConfig.orderBy;
2367
- const res = chunk_NFFV4IQT_m(dataset, (a, b)=>{
2368
- const aValue = a[orderBy || id];
2369
- const bValue = b[orderBy || id];
2370
- if ('asc' === order) {
2371
- if (aValue < bValue) return -1;
2372
- if (aValue > bValue) return 1;
2373
- return 0;
2374
- }
2375
- if (aValue > bValue) return -1;
2376
- if (aValue < bValue) return 1;
2377
- return 0;
2378
- });
2379
- return chunk_QJLMYOTX_i(res.map((item)=>item[id]));
2380
- };
2381
2369
  function chunk_3ZJAREUD_i(...e) {
2382
2370
  return chunk_WIMGWYZL_u(chunk_3ZJAREUD_o, e);
2383
2371
  }
@@ -2395,7 +2383,7 @@
2395
2383
  if (chunk_BZNENX2T_r(obj)) return C(obj, chunk_3ZJAREUD_i((value)=>replaceNullToUndefined(value)));
2396
2384
  return obj;
2397
2385
  };
2398
- const lineConfig = (advancedVSeed, context)=>{
2386
+ const line_lineConfig = (advancedVSeed, context)=>{
2399
2387
  const { vseed } = context;
2400
2388
  const { chartType } = vseed;
2401
2389
  const result = {
@@ -2472,7 +2460,7 @@
2472
2460
  ]),
2473
2461
  sortXBandAxis,
2474
2462
  sortLegend_sortLegend,
2475
- lineConfig,
2463
+ line_lineConfig,
2476
2464
  theme_theme,
2477
2465
  markStyle_markStyle,
2478
2466
  annotation_annotation
@@ -3453,23 +3441,23 @@
3453
3441
  title: {
3454
3442
  visible: true
3455
3443
  },
3456
- content: createDimensionContent(measures, foldInfo, unfoldInfo)
3444
+ content: createDimensionContent(dimensions, measures, foldInfo, unfoldInfo)
3457
3445
  }
3458
3446
  };
3459
3447
  return result;
3460
3448
  };
3461
- const createDimensionContent = (measures, foldInfo, unfoldInfo)=>{
3462
- const { measureId, measureValue } = foldInfo;
3449
+ const createDimensionContent = (dimensions, measures, foldInfo, unfoldInfo)=>{
3450
+ const { measureId, measureValue, foldMap } = foldInfo;
3463
3451
  const { encodingColor } = unfoldInfo;
3464
3452
  return [
3465
3453
  {
3466
3454
  visible: true,
3467
3455
  shapeType: 'rectRound',
3468
3456
  hasShape: true,
3469
- key: (v)=>{
3457
+ key: dimensions.some((d)=>'color' === d.encoding) ? (v)=>{
3470
3458
  const datum = v;
3471
3459
  return datum && datum[encodingColor] || '';
3472
- },
3460
+ } : Object.values(foldMap)[0],
3473
3461
  value: (v)=>{
3474
3462
  const datum = v;
3475
3463
  if (!datum) return '';
@@ -3970,6 +3958,550 @@
3970
3958
  markArea: markArea
3971
3959
  };
3972
3960
  };
3961
+ const isType_isType = (value, type)=>Object.prototype.toString.call(value) === `[object ${type}]`;
3962
+ const isType = isType_isType;
3963
+ const isArray_isArray = (value)=>Array.isArray ? Array.isArray(value) : isType(value, "Array");
3964
+ const common_isArray = isArray_isArray;
3965
+ const isValid = (value)=>null != value;
3966
+ const common_isValid = isValid;
3967
+ function array_array(arr) {
3968
+ return common_isValid(arr) ? common_isArray(arr) ? arr : [
3969
+ arr
3970
+ ] : [];
3971
+ }
3972
+ const isNumber = (value, fuzzy = !1)=>{
3973
+ const type = typeof value;
3974
+ return fuzzy ? "number" === type : "number" === type || isType(value, "Number");
3975
+ };
3976
+ const common_isNumber = isNumber;
3977
+ const isNil = (value)=>null == value;
3978
+ const common_isNil = isNil;
3979
+ const clamp_clamp = function(input, min, max) {
3980
+ return input < min ? min : input > max ? max : input;
3981
+ };
3982
+ const clamp = clamp_clamp;
3983
+ function hslToRgb(h, s, l) {
3984
+ s /= 100, l /= 100;
3985
+ const c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(h / 60 % 2 - 1)), m = l - c / 2;
3986
+ let r = 0, g = 0, b = 0;
3987
+ return 0 <= h && h < 60 ? (r = c, g = x, b = 0) : 60 <= h && h < 120 ? (r = x, g = c, b = 0) : 120 <= h && h < 180 ? (r = 0, g = c, b = x) : 180 <= h && h < 240 ? (r = 0, g = x, b = c) : 240 <= h && h < 300 ? (r = x, g = 0, b = c) : 300 <= h && h < 360 && (r = c, g = 0, b = x), r = Math.round(255 * (r + m)), g = Math.round(255 * (g + m)), b = Math.round(255 * (b + m)), {
3988
+ r: r,
3989
+ g: g,
3990
+ b: b
3991
+ };
3992
+ }
3993
+ function rgbToHsl(r, g, b) {
3994
+ r /= 255, g /= 255, b /= 255;
3995
+ const cMin = Math.min(r, g, b), cMax = Math.max(r, g, b), delta = cMax - cMin;
3996
+ let h = 0, s = 0, l = 0;
3997
+ return h = 0 === delta ? 0 : cMax === r ? (g - b) / delta % 6 : cMax === g ? (b - r) / delta + 2 : (r - g) / delta + 4, h = Math.round(60 * h), h < 0 && (h += 360), l = (cMax + cMin) / 2, s = 0 === delta ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(100 * s).toFixed(1), l = +(100 * l).toFixed(1), {
3998
+ h: h,
3999
+ s: s,
4000
+ l: l
4001
+ };
4002
+ }
4003
+ const REG_HEX = /^#([0-9a-f]{3,8})$/, DEFAULT_COLORS_OPACITY = {
4004
+ transparent: 4294967040
4005
+ };
4006
+ const DEFAULT_COLORS = {
4007
+ aliceblue: 15792383,
4008
+ antiquewhite: 16444375,
4009
+ aqua: 65535,
4010
+ aquamarine: 8388564,
4011
+ azure: 15794175,
4012
+ beige: 16119260,
4013
+ bisque: 16770244,
4014
+ black: 0,
4015
+ blanchedalmond: 16772045,
4016
+ blue: 255,
4017
+ blueviolet: 9055202,
4018
+ brown: 10824234,
4019
+ burlywood: 14596231,
4020
+ cadetblue: 6266528,
4021
+ chartreuse: 8388352,
4022
+ chocolate: 13789470,
4023
+ coral: 16744272,
4024
+ cornflowerblue: 6591981,
4025
+ cornsilk: 16775388,
4026
+ crimson: 14423100,
4027
+ cyan: 65535,
4028
+ darkblue: 139,
4029
+ darkcyan: 35723,
4030
+ darkgoldenrod: 12092939,
4031
+ darkgray: 11119017,
4032
+ darkgreen: 25600,
4033
+ darkgrey: 11119017,
4034
+ darkkhaki: 12433259,
4035
+ darkmagenta: 9109643,
4036
+ darkolivegreen: 5597999,
4037
+ darkorange: 16747520,
4038
+ darkorchid: 10040012,
4039
+ darkred: 9109504,
4040
+ darksalmon: 15308410,
4041
+ darkseagreen: 9419919,
4042
+ darkslateblue: 4734347,
4043
+ darkslategray: 3100495,
4044
+ darkslategrey: 3100495,
4045
+ darkturquoise: 52945,
4046
+ darkviolet: 9699539,
4047
+ deeppink: 16716947,
4048
+ deepskyblue: 49151,
4049
+ dimgray: 6908265,
4050
+ dimgrey: 6908265,
4051
+ dodgerblue: 2003199,
4052
+ firebrick: 11674146,
4053
+ floralwhite: 16775920,
4054
+ forestgreen: 2263842,
4055
+ fuchsia: 16711935,
4056
+ gainsboro: 14474460,
4057
+ ghostwhite: 16316671,
4058
+ gold: 16766720,
4059
+ goldenrod: 14329120,
4060
+ gray: 8421504,
4061
+ green: 32768,
4062
+ greenyellow: 11403055,
4063
+ grey: 8421504,
4064
+ honeydew: 15794160,
4065
+ hotpink: 16738740,
4066
+ indianred: 13458524,
4067
+ indigo: 4915330,
4068
+ ivory: 16777200,
4069
+ khaki: 15787660,
4070
+ lavender: 15132410,
4071
+ lavenderblush: 16773365,
4072
+ lawngreen: 8190976,
4073
+ lemonchiffon: 16775885,
4074
+ lightblue: 11393254,
4075
+ lightcoral: 15761536,
4076
+ lightcyan: 14745599,
4077
+ lightgoldenrodyellow: 16448210,
4078
+ lightgray: 13882323,
4079
+ lightgreen: 9498256,
4080
+ lightgrey: 13882323,
4081
+ lightpink: 16758465,
4082
+ lightsalmon: 16752762,
4083
+ lightseagreen: 2142890,
4084
+ lightskyblue: 8900346,
4085
+ lightslategray: 7833753,
4086
+ lightslategrey: 7833753,
4087
+ lightsteelblue: 11584734,
4088
+ lightyellow: 16777184,
4089
+ lime: 65280,
4090
+ limegreen: 3329330,
4091
+ linen: 16445670,
4092
+ magenta: 16711935,
4093
+ maroon: 8388608,
4094
+ mediumaquamarine: 6737322,
4095
+ mediumblue: 205,
4096
+ mediumorchid: 12211667,
4097
+ mediumpurple: 9662683,
4098
+ mediumseagreen: 3978097,
4099
+ mediumslateblue: 8087790,
4100
+ mediumspringgreen: 64154,
4101
+ mediumturquoise: 4772300,
4102
+ mediumvioletred: 13047173,
4103
+ midnightblue: 1644912,
4104
+ mintcream: 16121850,
4105
+ mistyrose: 16770273,
4106
+ moccasin: 16770229,
4107
+ navajowhite: 16768685,
4108
+ navy: 128,
4109
+ oldlace: 16643558,
4110
+ olive: 8421376,
4111
+ olivedrab: 7048739,
4112
+ orange: 16753920,
4113
+ orangered: 16729344,
4114
+ orchid: 14315734,
4115
+ palegoldenrod: 15657130,
4116
+ palegreen: 10025880,
4117
+ paleturquoise: 11529966,
4118
+ palevioletred: 14381203,
4119
+ papayawhip: 16773077,
4120
+ peachpuff: 16767673,
4121
+ peru: 13468991,
4122
+ pink: 16761035,
4123
+ plum: 14524637,
4124
+ powderblue: 11591910,
4125
+ purple: 8388736,
4126
+ rebeccapurple: 6697881,
4127
+ red: 16711680,
4128
+ rosybrown: 12357519,
4129
+ royalblue: 4286945,
4130
+ saddlebrown: 9127187,
4131
+ salmon: 16416882,
4132
+ sandybrown: 16032864,
4133
+ seagreen: 3050327,
4134
+ seashell: 16774638,
4135
+ sienna: 10506797,
4136
+ silver: 12632256,
4137
+ skyblue: 8900331,
4138
+ slateblue: 6970061,
4139
+ slategray: 7372944,
4140
+ slategrey: 7372944,
4141
+ snow: 16775930,
4142
+ springgreen: 65407,
4143
+ steelblue: 4620980,
4144
+ tan: 13808780,
4145
+ teal: 32896,
4146
+ thistle: 14204888,
4147
+ tomato: 16737095,
4148
+ turquoise: 4251856,
4149
+ violet: 15631086,
4150
+ wheat: 16113331,
4151
+ white: 16777215,
4152
+ whitesmoke: 16119285,
4153
+ yellow: 16776960,
4154
+ yellowgreen: 10145074
4155
+ };
4156
+ function Color_hex(value) {
4157
+ return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
4158
+ }
4159
+ function Color_rgb(value) {
4160
+ return common_isNumber(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : common_isArray(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
4161
+ }
4162
+ function rgba(value) {
4163
+ return common_isNumber(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : common_isArray(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
4164
+ }
4165
+ function SRGBToLinear(c) {
4166
+ return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
4167
+ }
4168
+ function LinearToSRGB(c) {
4169
+ return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
4170
+ }
4171
+ const setHex = (formatValue, forceHex)=>{
4172
+ const isHex = REG_HEX.exec(formatValue);
4173
+ if (forceHex || isHex) {
4174
+ const hex = parseInt(isHex[1], 16), hexLength = isHex[1].length;
4175
+ return 3 === hexLength ? new RGB((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? Color_rgb(hex) : 8 === hexLength ? new RGB(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : null;
4176
+ }
4177
+ };
4178
+ class Color {
4179
+ static Brighter(source, b = 1) {
4180
+ return 1 === b ? source : new Color(source).brighter(b).toRGBA();
4181
+ }
4182
+ static SetOpacity(source, o = 1) {
4183
+ return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
4184
+ }
4185
+ static getColorBrightness(source, model = "hsl") {
4186
+ const color = source instanceof Color ? source : new Color(source);
4187
+ switch(model){
4188
+ case "hsv":
4189
+ default:
4190
+ return color.getHSVBrightness();
4191
+ case "hsl":
4192
+ return color.getHSLBrightness();
4193
+ case "lum":
4194
+ return color.getLuminance();
4195
+ case "lum2":
4196
+ return color.getLuminance2();
4197
+ case "lum3":
4198
+ return color.getLuminance3();
4199
+ case "wcag":
4200
+ return color.getLuminanceWCAG();
4201
+ }
4202
+ }
4203
+ static parseColorString(value) {
4204
+ if (common_isValid(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
4205
+ if (common_isValid(DEFAULT_COLORS[value])) return Color_rgb(DEFAULT_COLORS[value]);
4206
+ const formatValue = `${value}`.trim().toLowerCase(), hexRes = setHex(formatValue);
4207
+ if (void 0 !== hexRes) return hexRes;
4208
+ if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
4209
+ const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
4210
+ return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
4211
+ }
4212
+ if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
4213
+ const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","), rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
4214
+ return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
4215
+ }
4216
+ }
4217
+ constructor(value){
4218
+ const color = Color.parseColorString(value);
4219
+ color ? this.color = color : (console.warn(`Warn: 传入${value}无法解析为Color`), this.color = new RGB(255, 255, 255));
4220
+ }
4221
+ toRGBA() {
4222
+ return this.color.formatRgb();
4223
+ }
4224
+ toString() {
4225
+ return this.color.formatRgb();
4226
+ }
4227
+ toHex() {
4228
+ return this.color.formatHex();
4229
+ }
4230
+ toHsl() {
4231
+ return this.color.formatHsl();
4232
+ }
4233
+ brighter(k) {
4234
+ const { r: r, g: g, b: b } = this.color;
4235
+ return this.color.r = Math.max(0, Math.min(255, Math.floor(r * k))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * k))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * k))), this;
4236
+ }
4237
+ add(color) {
4238
+ const { r: r, g: g, b: b } = this.color;
4239
+ return this.color.r += Math.min(255, r + color.color.r), this.color.g += Math.min(255, g + color.color.g), this.color.b += Math.min(255, b + color.color.b), this;
4240
+ }
4241
+ sub(color) {
4242
+ return this.color.r = Math.max(0, this.color.r - color.color.r), this.color.g = Math.max(0, this.color.g - color.color.g), this.color.b = Math.max(0, this.color.b - color.color.b), this;
4243
+ }
4244
+ multiply(color) {
4245
+ const { r: r, g: g, b: b } = this.color;
4246
+ return this.color.r = Math.max(0, Math.min(255, Math.floor(r * color.color.r))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * color.color.g))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * color.color.b))), this;
4247
+ }
4248
+ getHSVBrightness() {
4249
+ return Math.max(this.color.r, this.color.g, this.color.b) / 255;
4250
+ }
4251
+ getHSLBrightness() {
4252
+ return .5 * (Math.max(this.color.r, this.color.g, this.color.b) / 255 + Math.min(this.color.r, this.color.g, this.color.b) / 255);
4253
+ }
4254
+ setHsl(h, s, l) {
4255
+ const opacity = this.color.opacity, hsl = rgbToHsl(this.color.r, this.color.g, this.color.b), rgb = hslToRgb(common_isNil(h) ? hsl.h : clamp(h, 0, 360), common_isNil(s) ? hsl.s : s >= 0 && s <= 1 ? 100 * s : s, common_isNil(l) ? hsl.l : l <= 1 && l >= 0 ? 100 * l : l);
4256
+ return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
4257
+ }
4258
+ setRGB(r, g, b) {
4259
+ return common_isNil(r) || (this.color.r = r), common_isNil(g) || (this.color.g = g), common_isNil(b) || (this.color.b = b), this;
4260
+ }
4261
+ setHex(value) {
4262
+ const formatValue = `${value}`.trim().toLowerCase(), res = setHex(formatValue, !0);
4263
+ return null != res ? res : this;
4264
+ }
4265
+ setColorName(name) {
4266
+ const hex = DEFAULT_COLORS[name.toLowerCase()];
4267
+ return void 0 !== hex ? this.setHex(hex) : console.warn("THREE.Color: Unknown color " + name), this;
4268
+ }
4269
+ setScalar(scalar) {
4270
+ return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
4271
+ }
4272
+ setOpacity(o = 1) {
4273
+ return this.color.opacity = o, this;
4274
+ }
4275
+ getLuminance() {
4276
+ return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
4277
+ }
4278
+ getLuminance2() {
4279
+ return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
4280
+ }
4281
+ getLuminance3() {
4282
+ return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
4283
+ }
4284
+ getLuminanceWCAG() {
4285
+ const RsRGB = this.color.r / 255, GsRGB = this.color.g / 255, BsRGB = this.color.b / 255;
4286
+ let R, G, B;
4287
+ R = RsRGB <= .03928 ? RsRGB / 12.92 : Math.pow((RsRGB + .055) / 1.055, 2.4), G = GsRGB <= .03928 ? GsRGB / 12.92 : Math.pow((GsRGB + .055) / 1.055, 2.4), B = BsRGB <= .03928 ? BsRGB / 12.92 : Math.pow((BsRGB + .055) / 1.055, 2.4);
4288
+ return .2126 * R + .7152 * G + .0722 * B;
4289
+ }
4290
+ clone() {
4291
+ return new Color(this.color.toString());
4292
+ }
4293
+ copyGammaToLinear(color, gammaFactor = 2) {
4294
+ return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
4295
+ }
4296
+ copyLinearToGamma(color, gammaFactor = 2) {
4297
+ const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
4298
+ return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
4299
+ }
4300
+ convertGammaToLinear(gammaFactor) {
4301
+ return this.copyGammaToLinear(this, gammaFactor), this;
4302
+ }
4303
+ convertLinearToGamma(gammaFactor) {
4304
+ return this.copyLinearToGamma(this, gammaFactor), this;
4305
+ }
4306
+ copySRGBToLinear(color) {
4307
+ return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
4308
+ }
4309
+ copyLinearToSRGB(color) {
4310
+ return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
4311
+ }
4312
+ convertSRGBToLinear() {
4313
+ return this.copySRGBToLinear(this), this;
4314
+ }
4315
+ convertLinearToSRGB() {
4316
+ return this.copyLinearToSRGB(this), this;
4317
+ }
4318
+ }
4319
+ class RGB {
4320
+ constructor(r, g, b, opacity){
4321
+ this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), common_isValid(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
4322
+ }
4323
+ formatHex() {
4324
+ return `#${Color_hex(this.r) + Color_hex(this.g) + Color_hex(this.b) + (1 === this.opacity ? "" : Color_hex(255 * this.opacity))}`;
4325
+ }
4326
+ formatRgb() {
4327
+ const opacity = this.opacity;
4328
+ return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
4329
+ }
4330
+ formatHsl() {
4331
+ const opacity = this.opacity, { h: h, s: s, l: l } = rgbToHsl(this.r, this.g, this.b);
4332
+ return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
4333
+ }
4334
+ toString() {
4335
+ return this.formatHex();
4336
+ }
4337
+ }
4338
+ const splitLine = (spec, context)=>{
4339
+ const { advancedVSeed } = context;
4340
+ const { annotation, chartType, datasetReshapeInfo } = advancedVSeed;
4341
+ if (!annotation || !annotation.annotationHorizontalLine) return spec;
4342
+ const baseConfig = advancedVSeed.config[chartType];
4343
+ const splitLineConfig = array_array(annotation.annotationHorizontalLine).find((item)=>!!item.splitLine);
4344
+ const splitValue = +splitLineConfig?.yValue;
4345
+ if (Number.isNaN(splitValue) || !chunk_6GTAPB47_e(splitValue)) return spec;
4346
+ const result = {
4347
+ ...spec
4348
+ };
4349
+ const colorTheme = baseConfig?.color ?? {};
4350
+ const colorConfig = {
4351
+ positiveColor: colorTheme.positiveColor || 'red',
4352
+ negativeColor: colorTheme.negativeColor || 'green',
4353
+ ...chunk_BZNENX2T_r(splitLineConfig?.splitLine) ? splitLineConfig?.splitLine : {}
4354
+ };
4355
+ const groupMark = {
4356
+ type: 'group',
4357
+ name: 'annotationHorizontalLine-splitLine',
4358
+ zIndex: 300,
4359
+ style: {
4360
+ splitConfig: (datum, ctx)=>{
4361
+ const vchart = ctx.vchart;
4362
+ const chart = vchart.getChart();
4363
+ const lineSeries = chart.getAllSeries().find((s)=>'line' === s.type || 'area' === s.type);
4364
+ if (!lineSeries) return;
4365
+ const lineMark = lineSeries.getMarkInName('line') ?? lineSeries.getMarkInName('area');
4366
+ if (!lineMark) return;
4367
+ const lineGraphics = lineMark.getGraphics();
4368
+ if (!lineGraphics || 1 !== lineGraphics.length || !lineGraphics[0]) return;
4369
+ const points = lineGraphics[0].attribute.points ?? [];
4370
+ if (lineGraphics[0].attribute.segments?.length) lineGraphics[0].attribute.segments.forEach((seg)=>{
4371
+ seg.points.forEach((pt)=>{
4372
+ points.push({
4373
+ x: pt.x,
4374
+ y: pt.y
4375
+ });
4376
+ });
4377
+ });
4378
+ if (!points || !points.length) return;
4379
+ const splitCoordinate = lineSeries.getYAxisHelper().getScale(0).scale(splitValue);
4380
+ const minY = Math.min(...points.map((p)=>p.y));
4381
+ const maxY = Math.max(...points.map((p)=>p.y));
4382
+ const ratio = (splitCoordinate - minY) / (maxY - minY);
4383
+ const lineStroke = {
4384
+ gradient: 'linear',
4385
+ x0: 0,
4386
+ x1: 0,
4387
+ y0: 0,
4388
+ y1: 1,
4389
+ stops: [
4390
+ {
4391
+ color: colorConfig.positiveColor,
4392
+ offset: 0
4393
+ },
4394
+ {
4395
+ color: colorConfig.positiveColor,
4396
+ offset: ratio
4397
+ },
4398
+ {
4399
+ color: colorConfig.negativeColor,
4400
+ offset: ratio + 0.0000001
4401
+ },
4402
+ {
4403
+ color: colorConfig.negativeColor,
4404
+ offset: 1
4405
+ }
4406
+ ]
4407
+ };
4408
+ const areaFill = {
4409
+ gradient: 'linear',
4410
+ x0: 0,
4411
+ x1: 0,
4412
+ y0: 0,
4413
+ y1: 1,
4414
+ stops: [
4415
+ {
4416
+ color: colorConfig.positiveColor,
4417
+ offset: 0
4418
+ },
4419
+ {
4420
+ color: new Color(colorConfig.positiveColor).setOpacity(0).toRGBA(),
4421
+ offset: ratio
4422
+ },
4423
+ {
4424
+ offset: ratio + 0.0000001,
4425
+ color: new Color(colorConfig.negativeColor).setOpacity(0).toRGBA()
4426
+ },
4427
+ {
4428
+ color: colorConfig.negativeColor,
4429
+ offset: 1
4430
+ }
4431
+ ]
4432
+ };
4433
+ const attrs = {
4434
+ segments: null,
4435
+ points
4436
+ };
4437
+ if ('area' === lineGraphics[0].type) {
4438
+ attrs.stroke = lineStroke;
4439
+ attrs.fill = areaFill;
4440
+ } else attrs.stroke = lineStroke;
4441
+ lineGraphics[0].setAttributes(attrs);
4442
+ lineGraphics[0].setFinalAttributes?.(attrs);
4443
+ const start = lineSeries.getRegion().getLayoutStartPoint();
4444
+ return {
4445
+ points: points.map((entry)=>({
4446
+ x: entry.x + start.x,
4447
+ y: entry.y + start.y
4448
+ })),
4449
+ splitCoordinate,
4450
+ areaFill,
4451
+ lineStroke
4452
+ };
4453
+ }
4454
+ },
4455
+ children: [
4456
+ {
4457
+ type: 'area',
4458
+ interactive: false,
4459
+ zIndex: 500,
4460
+ style: {
4461
+ fillOpacity: 0.5,
4462
+ points: (datum, ctx, opt)=>{
4463
+ const parentNode = opt.mark?._product?.parent;
4464
+ if (parentNode?.attribute?.splitConfig) {
4465
+ const { points, splitCoordinate } = parentNode.attribute.splitConfig;
4466
+ return points.map((entry)=>({
4467
+ ...entry,
4468
+ y1: splitCoordinate
4469
+ }));
4470
+ }
4471
+ return [];
4472
+ },
4473
+ fill: (datum, ctx, opt)=>{
4474
+ const parentNode = opt.mark?._product?.parent;
4475
+ if (parentNode?.attribute?.splitConfig) {
4476
+ const { areaFill } = parentNode.attribute.splitConfig;
4477
+ return areaFill;
4478
+ }
4479
+ }
4480
+ }
4481
+ }
4482
+ ]
4483
+ };
4484
+ if (!result.customMark) result.customMark = [];
4485
+ result.customMark.push(groupMark);
4486
+ const seriesSpec = 'line' === result.type || 'area' === result.type ? result : result.series?.find((s)=>'line' === s.type || 'area' === s.type);
4487
+ if (seriesSpec) {
4488
+ if (!seriesSpec.point) seriesSpec.point = {};
4489
+ if (!seriesSpec.line) seriesSpec.line = {};
4490
+ if (!seriesSpec.point.style) seriesSpec.point.style = {};
4491
+ if (!seriesSpec.line.style) seriesSpec.line.style = {};
4492
+ const measureValueKey = datasetReshapeInfo[0].foldInfo.measureValue;
4493
+ seriesSpec.point.style.fill = (datum)=>{
4494
+ console.log(datum);
4495
+ return datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor;
4496
+ };
4497
+ seriesSpec.line.style.stroke = (datum)=>datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor;
4498
+ if (seriesSpec.label && seriesSpec.label.visible && chunk_JK3VNB42_n(seriesSpec.label.style?.fill)) seriesSpec.label.style = {
4499
+ ...seriesSpec.label.style,
4500
+ fill: (datum)=>datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor
4501
+ };
4502
+ }
4503
+ return result;
4504
+ };
3973
4505
  const initPivot = (spec)=>{
3974
4506
  const result = {
3975
4507
  ...spec
@@ -4001,7 +4533,7 @@
4001
4533
  isShowOverflowTextTooltip: true
4002
4534
  },
4003
4535
  corner: {
4004
- titleOnDimension: 'all'
4536
+ titleOnDimension: 'row'
4005
4537
  },
4006
4538
  animationAppear: {
4007
4539
  duration: 600,
@@ -4012,13 +4544,14 @@
4012
4544
  };
4013
4545
  const pivotGridStyle = (spec, context)=>{
4014
4546
  const { vseed, advancedVSeed } = context;
4015
- const { config, chartType } = advancedVSeed;
4547
+ const { config, chartType, dimensions } = advancedVSeed;
4016
4548
  const themConfig = config?.[chartType]?.pivotGrid ?? {};
4017
4549
  const onlyCombination = !isPivot(vseed) && isCombination(vseed);
4018
4550
  const result = {
4019
4551
  ...spec
4020
4552
  };
4021
4553
  const transparent = 'rgba(0,0,0,0)';
4554
+ const hasColumnDimension = dimensions.some((dim)=>'column' === dim.encoding);
4022
4555
  const borderColor = themConfig.borderColor ?? '#e3e5eb';
4023
4556
  const bodyFontColor = themConfig.bodyFontColor ?? '#141414';
4024
4557
  const headerFontColor = themConfig.headerFontColor ?? '#21252c';
@@ -4036,12 +4569,12 @@
4036
4569
  bodyStyle: {
4037
4570
  borderColor,
4038
4571
  color: bodyFontColor,
4039
- borderLineWidth: [
4040
- 1,
4041
- outlineBorderLineWidth,
4042
- 0,
4043
- 1
4044
- ],
4572
+ borderLineWidth: (arg)=>[
4573
+ 0 === arg.row ? outlineBorderLineWidth : 1,
4574
+ outlineBorderLineWidth,
4575
+ 0,
4576
+ 0 === arg.col ? outlineBorderLineWidth : 1
4577
+ ],
4045
4578
  bgColor: transparent,
4046
4579
  hover: {
4047
4580
  cellBgColor: 'transparent'
@@ -4050,12 +4583,12 @@
4050
4583
  headerStyle: {
4051
4584
  borderColor,
4052
4585
  fontSize: 12,
4053
- borderLineWidth: [
4054
- outlineBorderLineWidth,
4055
- outlineBorderLineWidth,
4056
- 1,
4057
- 1
4058
- ],
4586
+ borderLineWidth: (arg)=>[
4587
+ outlineBorderLineWidth,
4588
+ outlineBorderLineWidth,
4589
+ 1,
4590
+ 0 === arg.col ? outlineBorderLineWidth : 1
4591
+ ],
4059
4592
  color: headerFontColor,
4060
4593
  textAlign: 'center',
4061
4594
  bgColor: headerBackgroundColor,
@@ -4075,12 +4608,12 @@
4075
4608
  0,
4076
4609
  4
4077
4610
  ],
4078
- borderLineWidth: [
4079
- 1,
4080
- 1,
4081
- 1,
4082
- outlineBorderLineWidth
4083
- ],
4611
+ borderLineWidth: (arg)=>[
4612
+ 0 === arg.row ? outlineBorderLineWidth : 1,
4613
+ 1,
4614
+ 0,
4615
+ outlineBorderLineWidth
4616
+ ],
4084
4617
  bgColor: headerBackgroundColor,
4085
4618
  hover: {
4086
4619
  cellBgColor: hoverHeaderBackgroundColor,
@@ -4108,13 +4641,7 @@
4108
4641
  ],
4109
4642
  bgColor: headerBackgroundColor,
4110
4643
  frameStyle: {
4111
- borderColor,
4112
- borderLineWidth: [
4113
- outlineBorderLineWidth,
4114
- 0,
4115
- 0,
4116
- outlineBorderLineWidth
4117
- ]
4644
+ borderColor
4118
4645
  },
4119
4646
  hover: {
4120
4647
  cellBgColor: hoverHeaderBackgroundColor,
@@ -4128,9 +4655,9 @@
4128
4655
  frameStyle: {
4129
4656
  borderColor,
4130
4657
  borderLineWidth: [
4658
+ outlineBorderLineWidth,
4131
4659
  outlineBorderLineWidth,
4132
4660
  1,
4133
- 0,
4134
4661
  1
4135
4662
  ]
4136
4663
  },
@@ -4142,7 +4669,7 @@
4142
4669
  cornerLeftBottomCellStyle: {
4143
4670
  borderColor,
4144
4671
  borderLineWidth: [
4145
- 1,
4672
+ outlineBorderLineWidth,
4146
4673
  0,
4147
4674
  outlineBorderLineWidth,
4148
4675
  outlineBorderLineWidth
@@ -4163,14 +4690,19 @@
4163
4690
  },
4164
4691
  cornerRightBottomCellStyle: {
4165
4692
  borderColor,
4166
- borderLineWidth: 0,
4167
4693
  bgColor: headerBackgroundColor,
4694
+ borderLineWidth: [
4695
+ 1,
4696
+ outlineBorderLineWidth,
4697
+ outlineBorderLineWidth,
4698
+ 1
4699
+ ],
4168
4700
  frameStyle: {
4169
4701
  borderColor,
4170
4702
  borderLineWidth: [
4171
4703
  1,
4172
- 1,
4173
- 1,
4704
+ outlineBorderLineWidth,
4705
+ outlineBorderLineWidth,
4174
4706
  1
4175
4707
  ]
4176
4708
  },
@@ -4180,9 +4712,15 @@
4180
4712
  },
4181
4713
  rightFrozenStyle: {
4182
4714
  borderColor,
4183
- borderLineWidth: 1,
4184
4715
  bgColor: headerBackgroundColor,
4716
+ borderLineWidth: (arg)=>[
4717
+ 0 === arg.row || hasColumnDimension && 1 === arg.row ? outlineBorderLineWidth : 1,
4718
+ outlineBorderLineWidth,
4719
+ 0,
4720
+ 1
4721
+ ],
4185
4722
  hover: {
4723
+ borderLineWidth: 0,
4186
4724
  cellBgColor: hoverHeaderBackgroundColor
4187
4725
  }
4188
4726
  },
@@ -4294,6 +4832,16 @@
4294
4832
  records: records
4295
4833
  };
4296
4834
  };
4835
+ const pivotAxisStyle = (axisStyle)=>(spec, context)=>{
4836
+ const result = axisStyle(spec, context);
4837
+ if (result.axes) result.axes.forEach((axis)=>{
4838
+ axis.domainLine = {
4839
+ visible: false
4840
+ };
4841
+ if (axis.grid && axis.grid.visible && axis.grid.style) axis.grid.style.strokeOpacity = 0.3;
4842
+ });
4843
+ return result;
4844
+ };
4297
4845
  const pivotRowDimensions = (spec, context)=>{
4298
4846
  const result = {
4299
4847
  ...spec
@@ -4328,6 +4876,31 @@
4328
4876
  columns: columns
4329
4877
  };
4330
4878
  };
4879
+ const pivotTitle = (spec, context)=>{
4880
+ const result = {
4881
+ ...spec
4882
+ };
4883
+ const { advancedVSeed } = context;
4884
+ const { config, chartType } = advancedVSeed;
4885
+ const themConfig = config?.[chartType]?.pivotGrid ?? {};
4886
+ if (result.columns && result.columns.length > 0) result.title = {
4887
+ text: spec.columns.map((entry)=>entry.title).join('/'),
4888
+ align: 'center',
4889
+ orient: 'top',
4890
+ padding: [
4891
+ 2,
4892
+ 0,
4893
+ 0,
4894
+ 0
4895
+ ],
4896
+ textStyle: {
4897
+ fontSize: themConfig.titleFontSize ?? 12,
4898
+ fill: themConfig.titleFontColor ?? '#000',
4899
+ fontWeight: themConfig.titleFontWeight ?? 'bold'
4900
+ }
4901
+ };
4902
+ return result;
4903
+ };
4331
4904
  const pivotDiscreteLegend = (spec, context)=>{
4332
4905
  const result = {
4333
4906
  ...spec
@@ -4546,7 +5119,8 @@
4546
5119
  annotationPoint_annotationPoint,
4547
5120
  annotationVerticalLine_annotationVerticalLine,
4548
5121
  annotationHorizontalLine_annotationHorizontalLine,
4549
- annotationArea_annotationArea
5122
+ annotationArea_annotationArea,
5123
+ splitLine
4550
5124
  ];
4551
5125
  const pivotLine = [
4552
5126
  initPivot,
@@ -4560,7 +5134,7 @@
4560
5134
  datasetXY,
4561
5135
  progressive,
4562
5136
  xBand,
4563
- yLinear,
5137
+ pivotAxisStyle(yLinear),
4564
5138
  verticalCrosshairLine,
4565
5139
  colorPointStyleFill(pointStyle_pointStyle),
4566
5140
  pointStateDimensionHover,
@@ -4570,10 +5144,12 @@
4570
5144
  annotationPoint_annotationPoint,
4571
5145
  annotationVerticalLine_annotationVerticalLine,
4572
5146
  annotationHorizontalLine_annotationHorizontalLine,
4573
- annotationArea_annotationArea
5147
+ annotationArea_annotationArea,
5148
+ splitLine
4574
5149
  ]),
4575
5150
  pivotRowDimensions,
4576
5151
  pivotColumnDimensions,
5152
+ pivotTitle,
4577
5153
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
4578
5154
  ];
4579
5155
  const lineSpecPipeline = [
@@ -4680,6 +5256,38 @@
4680
5256
  };
4681
5257
  return result;
4682
5258
  };
5259
+ const regressionLine_regressionLine = (advancedVSeed, context)=>{
5260
+ const { vseed } = context;
5261
+ let keys = [];
5262
+ if ('histogram' === vseed.chartType) keys = [
5263
+ 'kdeRegressionLine',
5264
+ 'ecdfRegressionLine'
5265
+ ];
5266
+ else if ('scatter' === vseed.chartType) keys = [
5267
+ 'linearRegressionLine',
5268
+ 'lowessRegressionLine',
5269
+ 'polynomialRegressionLine',
5270
+ 'logisticRegressionLine'
5271
+ ];
5272
+ else if ('column' === vseed.chartType) keys = [
5273
+ 'polynomialRegressionLine'
5274
+ ];
5275
+ if (keys.length) {
5276
+ const regressionLineConfig = {};
5277
+ let hasLine = false;
5278
+ keys.forEach((key)=>{
5279
+ if (vseed[key]) {
5280
+ hasLine = true;
5281
+ regressionLineConfig[key] = true === vseed[key] ? {} : vseed[key];
5282
+ }
5283
+ });
5284
+ return hasLine ? {
5285
+ ...advancedVSeed,
5286
+ regressionLine: regressionLineConfig
5287
+ } : advancedVSeed;
5288
+ }
5289
+ return advancedVSeed;
5290
+ };
4683
5291
  const columnAdvancedPipeline = [
4684
5292
  initAdvancedVSeed_initAdvancedVSeed,
4685
5293
  default_defaultMeasures_defaultMeasures,
@@ -4708,7 +5316,8 @@
4708
5316
  columnConfig,
4709
5317
  theme_theme,
4710
5318
  markStyle_markStyle,
4711
- annotation_annotation
5319
+ annotation_annotation,
5320
+ regressionLine_regressionLine
4712
5321
  ];
4713
5322
  const initColumn = (spec, context)=>{
4714
5323
  const result = {
@@ -5031,7 +5640,442 @@
5031
5640
  markArea: markArea
5032
5641
  };
5033
5642
  };
5034
- const column = [
5643
+ function clamper(a, b) {
5644
+ let t;
5645
+ return a > b && (t = a, a = b, b = t), (x)=>Math.max(a, Math.min(b, x));
5646
+ }
5647
+ function invNorm(p) {
5648
+ if (p <= 0 || p >= 1) return 0;
5649
+ const c1 = -0.00778489400243029, c2 = -0.322396458041136, c3 = -2.40075827716184, c4 = -2.54973253934373, c5 = 4.37466414146497, c6 = 2.93816398269878, d1 = .00778469570904146, d2 = .32246712907004, d3 = 2.445134137143, d4 = 3.75440866190742;
5650
+ let q, r;
5651
+ return p < .02425 ? (q = Math.sqrt(-2 * Math.log(p)), (((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / ((((d1 * q + d2) * q + d3) * q + d4) * q + 1)) : p <= .97575 ? (q = p - .5, r = q * q, (((((-39.6968302866538 * r + 220.946098424521) * r - 275.928510446969) * r + 138.357751867269) * r - 30.6647980661472) * r + 2.50662827745924) * q / (((((-54.4760987982241 * r + 161.585836858041) * r - 155.698979859887) * r + 66.8013118877197) * r - 13.2806815528857) * r + 1)) : (q = Math.sqrt(-2 * Math.log(1 - p)), -(((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / ((((d1 * q + d2) * q + d3) * q + d4) * q + 1));
5652
+ }
5653
+ function computeLinearCIComponents(data, x, y, predict) {
5654
+ let min = 1 / 0, max = -1 / 0, n = 0, sumX = 0;
5655
+ for(let i = 0; i < data.length; i++){
5656
+ const d = data[i];
5657
+ let dx = x(d), dy = y(d);
5658
+ !common_isNil(dx) && (dx *= 1) >= dx && !common_isNil(dy) && (dy *= 1) >= dy && (dx < min && (min = dx), dx > max && (max = dx), n++, sumX += dx);
5659
+ }
5660
+ if (0 === n) return {
5661
+ min: min,
5662
+ max: max,
5663
+ n: n,
5664
+ X: 0,
5665
+ SSE: 0,
5666
+ Sxx: 0
5667
+ };
5668
+ const X = sumX / n;
5669
+ let SSE = 0, Sxx = 0;
5670
+ for(let i = 0; i < data.length; i++){
5671
+ const d = data[i];
5672
+ let dx = x(d), dy = y(d);
5673
+ if (!common_isNil(dx) && (dx *= 1) >= dx && !common_isNil(dy) && (dy *= 1) >= dy) {
5674
+ const r = dy - predict(dx);
5675
+ SSE += r * r;
5676
+ const dxc = dx - X;
5677
+ Sxx += dxc * dxc;
5678
+ }
5679
+ }
5680
+ return {
5681
+ min: min,
5682
+ max: max,
5683
+ n: n,
5684
+ X: X,
5685
+ SSE: SSE,
5686
+ Sxx: Sxx
5687
+ };
5688
+ }
5689
+ function stdErrorsAt(px, comps) {
5690
+ const { n: n, X: X, Sxx: Sxx, SSE: SSE } = comps, s2 = n > 2 ? SSE / (n - 2) : 0;
5691
+ return {
5692
+ seMean: Sxx > 0 ? Math.sqrt(s2 * (1 / n + (px - X) * (px - X) / Sxx)) : Math.sqrt(s2 / n),
5693
+ sePred: Math.sqrt(s2 * (1 + 1 / n + (Sxx > 0 ? (px - X) * (px - X) / Sxx : 0)))
5694
+ };
5695
+ }
5696
+ function ordinaryLeastSquares(uX, uY, uXY, uX2) {
5697
+ const denom = uX2 - uX * uX;
5698
+ if (Math.abs(denom) < Number.EPSILON) return {
5699
+ a: uY,
5700
+ b: 0
5701
+ };
5702
+ const b = (uXY - uX * uY) / denom;
5703
+ return {
5704
+ a: uY - b * uX,
5705
+ b: b
5706
+ };
5707
+ }
5708
+ function visitPoints(data, x, y, callback) {
5709
+ for(let i = 0; i < data.length; i++){
5710
+ const d = data[i];
5711
+ let xi = x(d), yi = y(d);
5712
+ !common_isNil(xi) && (xi *= 1) >= xi && !common_isNil(yi) && (yi *= 1) >= yi && callback(xi, yi, i);
5713
+ }
5714
+ }
5715
+ function rSquared(data, x, y, uY, predict) {
5716
+ let ssr = 0, sst = 0;
5717
+ for(let i = 0; i < data.length; i++){
5718
+ const d = data[i];
5719
+ let yi = y(d);
5720
+ if (!common_isNil(yi) && (yi *= 1) >= yi) {
5721
+ const r = yi - predict(x(d));
5722
+ ssr += r * r;
5723
+ const t = yi - uY;
5724
+ sst += t * t;
5725
+ }
5726
+ }
5727
+ return 0 === sst ? 0 : 1 - ssr / sst;
5728
+ }
5729
+ function regressionLinear(data, x = (d)=>d.x, y = (d)=>d.y) {
5730
+ let n = 0, meanX = 0, meanY = 0, meanXY = 0, meanX2 = 0;
5731
+ visitPoints(data, x, y, (xi, yi)=>{
5732
+ n++, meanX += (xi - meanX) / n, meanY += (yi - meanY) / n, meanXY += (xi * yi - meanXY) / n, meanX2 += (xi * xi - meanX2) / n;
5733
+ });
5734
+ const { a: a, b: b } = ordinaryLeastSquares(meanX, meanY, meanXY, meanX2), predict = (xx)=>a + b * xx, comps = computeLinearCIComponents(data, x, y, predict);
5735
+ return {
5736
+ coef: {
5737
+ a: a,
5738
+ b: b
5739
+ },
5740
+ predict: predict,
5741
+ rSquared: rSquared(data, x, y, meanY, predict),
5742
+ evaluateGrid: function(N) {
5743
+ const out = [];
5744
+ if (0 === comps.n || N <= 0) return out;
5745
+ if (comps.min === comps.max) {
5746
+ for(let i = 0; i < N; i++)out.push({
5747
+ x: comps.min,
5748
+ y: predict(comps.min)
5749
+ });
5750
+ return out;
5751
+ }
5752
+ const step = (comps.max - comps.min) / (N - 1);
5753
+ for(let i = 0; i < N; i++){
5754
+ const px = i === N - 1 ? comps.max : comps.min + step * i;
5755
+ out.push({
5756
+ x: px,
5757
+ y: predict(px)
5758
+ });
5759
+ }
5760
+ return out;
5761
+ },
5762
+ confidenceInterval: function(N = 50, alpha = .05) {
5763
+ const out = [];
5764
+ if (0 === comps.n || N <= 0) return out;
5765
+ const z = invNorm(1 - alpha / 2);
5766
+ if (comps.min === comps.max) {
5767
+ const m = predict(comps.min), errs = stdErrorsAt(comps.min, comps);
5768
+ for(let i = 0; i < N; i++)out.push({
5769
+ x: comps.min,
5770
+ mean: m,
5771
+ lower: m - z * errs.seMean,
5772
+ upper: m + z * errs.seMean,
5773
+ predLower: m - z * errs.sePred,
5774
+ predUpper: m + z * errs.sePred
5775
+ });
5776
+ return out;
5777
+ }
5778
+ const step = (comps.max - comps.min) / (N - 1);
5779
+ for(let i = 0; i < N; i++){
5780
+ const px = i === N - 1 ? comps.max : comps.min + step * i, m = predict(px), errs = stdErrorsAt(px, comps);
5781
+ out.push({
5782
+ x: px,
5783
+ mean: m,
5784
+ lower: m - z * errs.seMean,
5785
+ upper: m + z * errs.seMean,
5786
+ predLower: m - z * errs.sePred,
5787
+ predUpper: m + z * errs.sePred
5788
+ });
5789
+ }
5790
+ return out;
5791
+ }
5792
+ };
5793
+ }
5794
+ function solveLinearSystem(A, b) {
5795
+ const n = b.length, M = new Array(n);
5796
+ for(let i = 0; i < n; i++)M[i] = A[i].slice(), M[i].push(b[i]);
5797
+ for(let k = 0; k < n; k++){
5798
+ let maxRow = k, maxVal = Math.abs(M[k][k]);
5799
+ for(let i = k + 1; i < n; i++){
5800
+ const v = Math.abs(M[i][k]);
5801
+ v > maxVal && (maxVal = v, maxRow = i);
5802
+ }
5803
+ if (maxRow !== k) {
5804
+ const tmp = M[k];
5805
+ M[k] = M[maxRow], M[maxRow] = tmp;
5806
+ }
5807
+ if (Math.abs(M[k][k]) < 1e-12) return new Array(n).fill(0);
5808
+ for(let j = k + 1; j <= n; j++)M[k][j] = M[k][j] / M[k][k];
5809
+ M[k][k] = 1;
5810
+ for(let i = 0; i < n; i++){
5811
+ if (i === k) continue;
5812
+ const factor = M[i][k];
5813
+ if (0 !== factor) {
5814
+ for(let j = k + 1; j <= n; j++)M[i][j] -= factor * M[k][j];
5815
+ M[i][k] = 0;
5816
+ }
5817
+ }
5818
+ }
5819
+ const x = new Array(n);
5820
+ for(let i = 0; i < n; i++)x[i] = M[i][n];
5821
+ return x;
5822
+ }
5823
+ function regressionPolynomial(data, x = (d)=>d.x, y = (d)=>d.y, options = {}) {
5824
+ var _a;
5825
+ let degree = null != (_a = options.degree) ? _a : 0;
5826
+ degree < 0 && (degree = 0);
5827
+ const m = degree + 1, sums = new Array(2 * degree + 1).fill(0);
5828
+ visitPoints(data, x, y, (dx, dy)=>{
5829
+ let xp = 1;
5830
+ for(let k = 0; k < sums.length; k++)sums[k] += xp, xp *= dx;
5831
+ });
5832
+ const A = new Array(m);
5833
+ for(let i = 0; i < m; i++){
5834
+ A[i] = new Array(m).fill(0);
5835
+ for(let j = 0; j < m; j++)A[i][j] = sums[i + j];
5836
+ }
5837
+ const B = new Array(m).fill(0);
5838
+ visitPoints(data, x, y, (dx, dy)=>{
5839
+ let xp = 1;
5840
+ for(let k = 0; k < m; k++)B[k] += dy * xp, xp *= dx;
5841
+ });
5842
+ const coef = solveLinearSystem(A, B), predict = (xx)=>{
5843
+ let xp = 1, v = 0;
5844
+ for(let k = 0; k < coef.length; k++)v += coef[k] * xp, xp *= xx;
5845
+ return v;
5846
+ };
5847
+ return {
5848
+ degree: degree,
5849
+ coef: coef,
5850
+ predict: predict,
5851
+ rSquared: rSquared(data, x, y, (()=>{
5852
+ let sum = 0, cnt = 0;
5853
+ return visitPoints(data, x, y, (_dx, dy)=>{
5854
+ sum += dy, cnt++;
5855
+ }), 0 === cnt ? 0 : sum / cnt;
5856
+ })(), predict),
5857
+ evaluateGrid (N) {
5858
+ const out = [];
5859
+ if (N <= 0) return out;
5860
+ let min = 1 / 0, max = -1 / 0;
5861
+ if (visitPoints(data, x, y, (dx)=>{
5862
+ common_isNil(dx) || (dx < min && (min = dx), dx > max && (max = dx));
5863
+ }), min === 1 / 0 || max === -1 / 0) return out;
5864
+ if (min === max) {
5865
+ const v = predict(min);
5866
+ for(let i = 0; i < N; i++)out.push({
5867
+ x: min,
5868
+ y: v
5869
+ });
5870
+ return out;
5871
+ }
5872
+ const step = (max - min) / (N - 1);
5873
+ for(let i = 0; i < N; i++){
5874
+ const px = i === N - 1 ? max : min + step * i;
5875
+ out.push({
5876
+ x: px,
5877
+ y: predict(px)
5878
+ });
5879
+ }
5880
+ return out;
5881
+ },
5882
+ confidenceInterval (N = 50, alpha = .05) {
5883
+ const out = [];
5884
+ if (N <= 0) return out;
5885
+ const comps = computeLinearCIComponents(data, x, y, predict);
5886
+ if (0 === comps.n) return out;
5887
+ const z = Math.abs(invNorm(1 - alpha / 2));
5888
+ if (comps.min === comps.max) {
5889
+ const v = predict(comps.min), errs = stdErrorsAt(comps.min, comps);
5890
+ for(let i = 0; i < N; i++)out.push({
5891
+ x: comps.min,
5892
+ mean: v,
5893
+ lower: v - z * errs.seMean,
5894
+ upper: v + z * errs.seMean,
5895
+ predLower: v - z * errs.sePred,
5896
+ predUpper: v + z * errs.sePred
5897
+ });
5898
+ return out;
5899
+ }
5900
+ const step = (comps.max - comps.min) / (N - 1);
5901
+ for(let i = 0; i < N; i++){
5902
+ const px = i === N - 1 ? comps.max : comps.min + step * i, yh = predict(px), errs = stdErrorsAt(px, comps);
5903
+ out.push({
5904
+ x: px,
5905
+ mean: yh,
5906
+ lower: yh - z * errs.seMean,
5907
+ upper: yh + z * errs.seMean,
5908
+ predLower: yh - z * errs.sePred,
5909
+ predUpper: yh + z * errs.sePred
5910
+ });
5911
+ }
5912
+ return out;
5913
+ }
5914
+ };
5915
+ }
5916
+ const defaultRegressionLineColor = (datum, ctx, opt)=>{
5917
+ const parentNode = opt.mark?._product?.parent;
5918
+ if (parentNode?.attribute?.data) return parentNode.attribute.data.color;
5919
+ };
5920
+ const defaultRegressionLineLabelX = (datum, ctx, opt)=>{
5921
+ const parentNode = opt.mark?._product?.parent;
5922
+ if (parentNode?.attribute?.data?.linePoints) {
5923
+ const points = parentNode.attribute.data.linePoints;
5924
+ return points[points.length - 1]?.x;
5925
+ }
5926
+ };
5927
+ const defaultRegressionLineLabelY = (datum, ctx, opt)=>{
5928
+ const parentNode = opt.mark?._product?.parent;
5929
+ if (parentNode?.attribute?.data?.linePoints) {
5930
+ const points = parentNode.attribute.data.linePoints;
5931
+ return points[points.length - 1]?.y;
5932
+ }
5933
+ };
5934
+ const columnPolynomialRegressionLine = (spec, context)=>{
5935
+ const result = {
5936
+ ...spec
5937
+ };
5938
+ const { advancedVSeed } = context;
5939
+ const { chartType, regressionLine } = advancedVSeed;
5940
+ const lineTheme = advancedVSeed.config[chartType]?.regressionLine;
5941
+ if (!regressionLine || !regressionLine.polynomialRegressionLine) return result;
5942
+ const lineList = array_array(regressionLine.polynomialRegressionLine);
5943
+ if (!result.customMark) result.customMark = [];
5944
+ lineList.forEach((line, lineIndex)=>{
5945
+ const theme = lineTheme.linearRegressionLine ?? {};
5946
+ const { color, lineWidth, lineDash, text, textColor, textFontSize, textFontWeight, confidenceIntervalOpacity, confidenceIntervalVisible = theme.confidenceIntervalVisible } = line;
5947
+ const childrenMarks = [];
5948
+ result.customMark.push({
5949
+ type: 'group',
5950
+ interactive: false,
5951
+ zIndex: 500,
5952
+ name: `polynomialRegressionLine-${lineIndex}`,
5953
+ style: {
5954
+ data: (datum, ctx)=>{
5955
+ const vchart = ctx.vchart;
5956
+ const chart = vchart.getChart();
5957
+ const s = chart.getAllSeries()[0];
5958
+ if (s) {
5959
+ const rect = s.getRegion().getLayoutRect();
5960
+ if (0 === rect.width || 0 === rect.height) return null;
5961
+ const start = s.getRegion().getLayoutStartPoint();
5962
+ const yClamper = clamper(start.y, start.y + rect.height);
5963
+ const data = s.getViewData()?.latestData;
5964
+ const fieldX = s.fieldX?.[0];
5965
+ const fieldY = s.fieldY?.[0];
5966
+ const xValues = s.getRawDataStatisticsByField(fieldX).values;
5967
+ if (!fieldX || !fieldY || !data || data.length <= 2 || xValues.length <= 2) return null;
5968
+ const { confidenceInterval, evaluateGrid } = regressionPolynomial(xValues.map((xVal, index)=>{
5969
+ const filteredData = data.filter((d)=>d[fieldX] === xVal);
5970
+ return {
5971
+ x: index,
5972
+ y: Math.max(...filteredData.map((d)=>d[fieldY]))
5973
+ };
5974
+ }), void 0, void 0, {
5975
+ degree: line.degree ?? 2
5976
+ });
5977
+ const N = xValues.length;
5978
+ const xAxisHelper = s.getXAxisHelper();
5979
+ const halfBandWidth = xAxisHelper ? xAxisHelper.getBandwidth(0) / 2 : 0;
5980
+ const lineData = evaluateGrid(N);
5981
+ const linePoints = lineData.map((datum, index)=>{
5982
+ const d = {
5983
+ [fieldX]: xValues[index],
5984
+ [fieldY]: datum.y
5985
+ };
5986
+ return {
5987
+ x: s.dataToPositionX(d) + start.x + halfBandWidth,
5988
+ y: yClamper(s.dataToPositionY(d) + start.y)
5989
+ };
5990
+ });
5991
+ const result = {
5992
+ linePoints,
5993
+ color: s.getOption().globalScale.getScale('color')?.scale(s.getSeriesKeys()[0])
5994
+ };
5995
+ if (confidenceIntervalVisible) {
5996
+ const intervalData = confidenceInterval(N);
5997
+ result.areaPoints = intervalData.map((datum, index)=>{
5998
+ const d = {
5999
+ [fieldX]: xValues[index],
6000
+ [fieldY]: datum.lower
6001
+ };
6002
+ return {
6003
+ x: s.dataToPositionX(d) + start.x + halfBandWidth,
6004
+ y: yClamper(s.dataToPositionY(d) + start.y),
6005
+ y1: yClamper(s.dataToPositionY({
6006
+ [fieldY]: datum.upper
6007
+ }) + start.y)
6008
+ };
6009
+ });
6010
+ }
6011
+ return result;
6012
+ }
6013
+ return null;
6014
+ }
6015
+ },
6016
+ children: childrenMarks
6017
+ });
6018
+ if (confidenceIntervalVisible) childrenMarks.push({
6019
+ type: 'area',
6020
+ interactive: false,
6021
+ zIndex: 500,
6022
+ style: {
6023
+ lineWidth: lineWidth ?? theme.lineWidth,
6024
+ lineDash: lineDash ?? theme.lineDash,
6025
+ fillOpacity: confidenceIntervalOpacity ?? theme.confidenceIntervalOpacity,
6026
+ fill: color ?? defaultRegressionLineColor,
6027
+ points: (datum, ctx, opt)=>{
6028
+ const parentNode = opt.mark?._product?.parent;
6029
+ if (parentNode?.attribute?.data) return parentNode.attribute.data.areaPoints;
6030
+ return [];
6031
+ }
6032
+ }
6033
+ });
6034
+ childrenMarks.push({
6035
+ type: 'line',
6036
+ interactive: false,
6037
+ zIndex: 500,
6038
+ style: {
6039
+ lineWidth: lineWidth ?? theme.lineWidth,
6040
+ lineDash: lineDash ?? theme.lineDash,
6041
+ stroke: color ?? defaultRegressionLineColor,
6042
+ points: (datum, ctx, opt)=>{
6043
+ const parentNode = opt.mark?._product?.parent;
6044
+ if (parentNode?.attribute?.data) return parentNode.attribute.data.linePoints;
6045
+ return [];
6046
+ }
6047
+ }
6048
+ });
6049
+ if (!chunk_JK3VNB42_n(text)) childrenMarks.push({
6050
+ type: 'text',
6051
+ interactive: false,
6052
+ zIndex: 500,
6053
+ style: {
6054
+ textAlign: 'end',
6055
+ fill: textColor ?? theme.textColor,
6056
+ fontSize: textFontSize ?? theme.textFontSize,
6057
+ fontWeight: textFontWeight ?? theme.textFontWeight,
6058
+ text: text,
6059
+ x: (datum, ctx, opt)=>{
6060
+ const parentNode = opt.mark?._product?.parent;
6061
+ if (parentNode?.attribute?.data?.linePoints) {
6062
+ const points = parentNode.attribute.data.linePoints;
6063
+ return points[points.length - 1]?.x;
6064
+ }
6065
+ },
6066
+ y: (datum, ctx, opt)=>{
6067
+ const parentNode = opt.mark?._product?.parent;
6068
+ if (parentNode?.attribute?.data?.linePoints) {
6069
+ const points = parentNode.attribute.data.linePoints;
6070
+ return points[points.length - 1]?.y;
6071
+ }
6072
+ }
6073
+ }
6074
+ });
6075
+ });
6076
+ return result;
6077
+ };
6078
+ const column = [
5035
6079
  initColumn,
5036
6080
  stackCornerRadius_stackCornerRadius,
5037
6081
  barMaxWidth_barMaxWidth,
@@ -5050,7 +6094,8 @@
5050
6094
  annotationPoint_annotationPoint,
5051
6095
  annotationVerticalLine_annotationVerticalLine,
5052
6096
  annotationHorizontalLine_annotationHorizontalLine,
5053
- annotationAreaBand
6097
+ annotationAreaBand,
6098
+ columnPolynomialRegressionLine
5054
6099
  ];
5055
6100
  const pivotColumn = [
5056
6101
  initPivot,
@@ -5060,13 +6105,14 @@
5060
6105
  pivotIndicators_pivotIndicators([
5061
6106
  initColumn,
5062
6107
  stackCornerRadius_stackCornerRadius,
6108
+ barMaxWidth_barMaxWidth,
5063
6109
  stackInverse,
5064
6110
  colorAdapter(color_color, linearColor),
5065
6111
  background_backgroundColor,
5066
6112
  datasetXY,
5067
6113
  progressive,
5068
6114
  xBand,
5069
- yLinear,
6115
+ pivotAxisStyle(yLinear),
5070
6116
  label_label,
5071
6117
  tooltip_tooltip,
5072
6118
  verticalCrosshairRect,
@@ -5074,10 +6120,12 @@
5074
6120
  annotationPoint_annotationPoint,
5075
6121
  annotationVerticalLine_annotationVerticalLine,
5076
6122
  annotationHorizontalLine_annotationHorizontalLine,
5077
- annotationAreaBand
6123
+ annotationAreaBand,
6124
+ columnPolynomialRegressionLine
5078
6125
  ]),
5079
6126
  pivotRowDimensions,
5080
6127
  pivotColumnDimensions,
6128
+ pivotTitle,
5081
6129
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
5082
6130
  ];
5083
6131
  const columnSpecPipeline = [
@@ -5109,8 +6157,8 @@
5109
6157
  };
5110
6158
  return result;
5111
6159
  };
5112
- const areaConfig = lineConfig;
5113
- const areaPercentConfig = lineConfig;
6160
+ const areaConfig = line_lineConfig;
6161
+ const areaPercentConfig = line_lineConfig;
5114
6162
  const barConfig = columnConfig;
5115
6163
  const barParallelConfig = columnConfig;
5116
6164
  const barPercentConfig = columnConfig;
@@ -5259,12 +6307,13 @@
5259
6307
  pivotIndicators_pivotIndicators([
5260
6308
  initColumnParallel,
5261
6309
  stackCornerRadius_stackCornerRadius,
6310
+ barMaxWidth_barMaxWidth,
5262
6311
  colorAdapter(color_color, linearColor),
5263
6312
  background_backgroundColor,
5264
6313
  datasetXY,
5265
6314
  progressive,
5266
6315
  xBand,
5267
- yLinear,
6316
+ pivotAxisStyle(yLinear),
5268
6317
  label_label,
5269
6318
  tooltip_tooltip,
5270
6319
  verticalCrosshairRect,
@@ -5276,6 +6325,7 @@
5276
6325
  ]),
5277
6326
  pivotRowDimensions,
5278
6327
  pivotColumnDimensions,
6328
+ pivotTitle,
5279
6329
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
5280
6330
  ];
5281
6331
  const columnParallelSpecPipeline = [
@@ -5353,13 +6403,14 @@
5353
6403
  initColumn,
5354
6404
  stackCornerRadius_stackCornerRadius,
5355
6405
  stackInverse,
6406
+ barMaxWidth_barMaxWidth,
5356
6407
  colorAdapter(color_color, linearColor),
5357
6408
  percent_percent,
5358
6409
  background_backgroundColor,
5359
6410
  datasetXY,
5360
6411
  progressive,
5361
6412
  xBand,
5362
- yLinear,
6413
+ pivotAxisStyle(yLinear),
5363
6414
  label_label,
5364
6415
  tooltip_tooltip,
5365
6416
  verticalCrosshairRect,
@@ -5371,6 +6422,7 @@
5371
6422
  ]),
5372
6423
  pivotRowDimensions,
5373
6424
  pivotColumnDimensions,
6425
+ pivotTitle,
5374
6426
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
5375
6427
  ];
5376
6428
  const columnPercentSpecPipeline = [
@@ -5793,12 +6845,13 @@
5793
6845
  pivotIndicators_pivotIndicators([
5794
6846
  initBar,
5795
6847
  stackCornerRadius_stackCornerRadius,
6848
+ barMaxWidth_barMaxWidth,
5796
6849
  colorAdapter(color_color, linearColor),
5797
6850
  background_backgroundColor,
5798
6851
  datasetYX,
5799
6852
  progressive,
5800
6853
  xLinear,
5801
- yBand,
6854
+ pivotAxisStyle(yBand),
5802
6855
  label_label,
5803
6856
  tooltip_tooltip,
5804
6857
  colorBarStyleFill(barStyle_barStyle),
@@ -5810,6 +6863,7 @@
5810
6863
  ]),
5811
6864
  pivotRowDimensions,
5812
6865
  pivotColumnDimensions,
6866
+ pivotTitle,
5813
6867
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
5814
6868
  ];
5815
6869
  const barSpecPipeline = [
@@ -5906,11 +6960,12 @@
5906
6960
  pivotIndicators_pivotIndicators([
5907
6961
  initBarParallel,
5908
6962
  stackCornerRadius_stackCornerRadius,
6963
+ barMaxWidth_barMaxWidth,
5909
6964
  colorAdapter(color_color, linearColor),
5910
6965
  background_backgroundColor,
5911
6966
  datasetYX,
5912
6967
  xLinear,
5913
- yBand,
6968
+ pivotAxisStyle(yBand),
5914
6969
  label_label,
5915
6970
  tooltip_tooltip,
5916
6971
  colorBarStyleFill(barStyle_barStyle),
@@ -5922,6 +6977,7 @@
5922
6977
  ]),
5923
6978
  pivotRowDimensions,
5924
6979
  pivotColumnDimensions,
6980
+ pivotTitle,
5925
6981
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
5926
6982
  ];
5927
6983
  const barParallelSpecPipeline = [
@@ -5990,12 +7046,13 @@
5990
7046
  pivotIndicators_pivotIndicators([
5991
7047
  initBar,
5992
7048
  stackCornerRadius_stackCornerRadius,
7049
+ barMaxWidth_barMaxWidth,
5993
7050
  colorAdapter(color_color, linearColor),
5994
7051
  background_backgroundColor,
5995
7052
  percent_percent,
5996
7053
  datasetYX,
5997
- yBand,
5998
7054
  xLinear,
7055
+ pivotAxisStyle(yBand),
5999
7056
  label_label,
6000
7057
  tooltip_tooltip,
6001
7058
  colorBarStyleFill(barStyle_barStyle),
@@ -6007,6 +7064,7 @@
6007
7064
  ]),
6008
7065
  pivotRowDimensions,
6009
7066
  pivotColumnDimensions,
7067
+ pivotTitle,
6010
7068
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
6011
7069
  ];
6012
7070
  const barPercentSpecPipeline = [
@@ -6171,7 +7229,8 @@
6171
7229
  annotationPoint_annotationPoint,
6172
7230
  annotationVerticalLine_annotationVerticalLine,
6173
7231
  annotationHorizontalLine_annotationHorizontalLine,
6174
- annotationArea_annotationArea
7232
+ annotationArea_annotationArea,
7233
+ splitLine
6175
7234
  ];
6176
7235
  const pivotArea = [
6177
7236
  initPivot,
@@ -6186,7 +7245,7 @@
6186
7245
  datasetXY,
6187
7246
  progressive,
6188
7247
  xBand,
6189
- yLinear,
7248
+ pivotAxisStyle(yLinear),
6190
7249
  label_label,
6191
7250
  tooltip_tooltip,
6192
7251
  verticalCrosshairLine,
@@ -6197,10 +7256,12 @@
6197
7256
  annotationPoint_annotationPoint,
6198
7257
  annotationVerticalLine_annotationVerticalLine,
6199
7258
  annotationHorizontalLine_annotationHorizontalLine,
6200
- annotationArea_annotationArea
7259
+ annotationArea_annotationArea,
7260
+ splitLine
6201
7261
  ]),
6202
7262
  pivotRowDimensions,
6203
7263
  pivotColumnDimensions,
7264
+ pivotTitle,
6204
7265
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
6205
7266
  ];
6206
7267
  const areaSpecPipeline = [
@@ -6277,7 +7338,7 @@
6277
7338
  datasetXY,
6278
7339
  progressive,
6279
7340
  xBand,
6280
- yLinear,
7341
+ pivotAxisStyle(yLinear),
6281
7342
  label_label,
6282
7343
  tooltip_tooltip,
6283
7344
  verticalCrosshairLine,
@@ -6292,6 +7353,7 @@
6292
7353
  ]),
6293
7354
  pivotRowDimensions,
6294
7355
  pivotColumnDimensions,
7356
+ pivotTitle,
6295
7357
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
6296
7358
  ];
6297
7359
  const areaPercentSpecPipeline = [
@@ -6645,7 +7707,8 @@
6645
7707
  scatterConfig,
6646
7708
  theme_theme,
6647
7709
  markStyle_markStyle,
6648
- annotation_annotation
7710
+ annotation_annotation,
7711
+ regressionLine_regressionLine
6649
7712
  ];
6650
7713
  const initScatter = (spec, context)=>{
6651
7714
  const result = {
@@ -6779,12 +7842,7 @@
6779
7842
  visible: true,
6780
7843
  hasShape: true,
6781
7844
  shapeType: 'rectRound',
6782
- key: (v)=>{
6783
- const { measureId, foldMap } = foldInfo;
6784
- const datum = v;
6785
- const id = datum[measureId];
6786
- return foldMap[id] || id;
6787
- },
7845
+ key: Object.values(foldInfo.foldMap)[0],
6788
7846
  value: (v)=>{
6789
7847
  const { measureId, measureValue } = foldInfo;
6790
7848
  const datum = v;
@@ -6806,46 +7864,430 @@
6806
7864
  const result = {
6807
7865
  ...spec
6808
7866
  };
6809
- const { advancedVSeed, vseed } = context;
6810
- const { chartType } = vseed;
6811
- const config = advancedVSeed.config?.[chartType]?.crosshairLine;
6812
- if (!config) return result;
6813
- if (!result.crosshair) result.crosshair = {};
6814
- const visible = config.visible || true;
6815
- const lineColor = config.lineColor || void 0;
6816
- const labelColor = config.labelColor || void 0;
6817
- const labelVisible = config.labelVisible || void 0;
6818
- const labelBackgroundColor = config.labelBackgroundColor || void 0;
6819
- const crosshair = result.crosshair;
6820
- crosshair.yField = {
6821
- visible,
6822
- line: {
6823
- type: 'line',
6824
- style: {
6825
- lineWidth: 1,
6826
- opacity: 1,
6827
- stroke: lineColor,
6828
- lineDash: config.lineDash ?? [
6829
- 4,
6830
- 2
6831
- ]
7867
+ const { advancedVSeed, vseed } = context;
7868
+ const { chartType } = vseed;
7869
+ const config = advancedVSeed.config?.[chartType]?.crosshairLine;
7870
+ if (!config) return result;
7871
+ if (!result.crosshair) result.crosshair = {};
7872
+ const visible = config.visible || true;
7873
+ const lineColor = config.lineColor || void 0;
7874
+ const labelColor = config.labelColor || void 0;
7875
+ const labelVisible = config.labelVisible || void 0;
7876
+ const labelBackgroundColor = config.labelBackgroundColor || void 0;
7877
+ const crosshair = result.crosshair;
7878
+ crosshair.yField = {
7879
+ visible,
7880
+ line: {
7881
+ type: 'line',
7882
+ style: {
7883
+ lineWidth: 1,
7884
+ opacity: 1,
7885
+ stroke: lineColor,
7886
+ lineDash: config.lineDash ?? [
7887
+ 4,
7888
+ 2
7889
+ ]
7890
+ }
7891
+ },
7892
+ label: {
7893
+ visible: labelVisible,
7894
+ labelBackground: {
7895
+ visible: labelVisible,
7896
+ style: {
7897
+ fill: labelBackgroundColor
7898
+ }
7899
+ },
7900
+ style: {
7901
+ fill: labelColor
7902
+ }
7903
+ }
7904
+ };
7905
+ return result;
7906
+ };
7907
+ function tricube(u) {
7908
+ const uu = Math.abs(u);
7909
+ if (uu >= 1) return 0;
7910
+ const t = 1 - uu * uu * uu;
7911
+ return t * t * t;
7912
+ }
7913
+ function regressionLowess(data, x = (d)=>d.x, y = (d)=>d.y, options = {}) {
7914
+ const span = options.span || .3, degree = 0 === options.degree ? 0 : 1, iterations = null == options.iterations ? 2 : options.iterations, ptsX = [], ptsY = [];
7915
+ visitPoints(data, x, y, (dx, dy)=>{
7916
+ ptsX.push(dx), ptsY.push(dy);
7917
+ });
7918
+ const n = ptsX.length;
7919
+ function predictSingle(x0, robustWeights) {
7920
+ if (0 === n) return 0;
7921
+ const dists = [];
7922
+ for(let i = 0; i < n; i++)dists.push({
7923
+ idx: i,
7924
+ dist: Math.abs(ptsX[i] - x0)
7925
+ });
7926
+ dists.sort((a, b)=>a.dist - b.dist);
7927
+ const m = Math.max(2, Math.min(n, Math.floor(span * n))), maxDist = dists[m - 1].dist || 0, w = new Array(m);
7928
+ let sumw = 0;
7929
+ for(let i = 0; i < m; i++){
7930
+ const idx = dists[i].idx;
7931
+ let wi = tricube(0 === maxDist ? 0 : dists[i].dist / maxDist);
7932
+ robustWeights && null != robustWeights[idx] && (wi *= robustWeights[idx]), w[i] = wi, sumw += wi;
7933
+ }
7934
+ if (0 === sumw) return ptsY[dists[0].idx];
7935
+ if (0 === degree) {
7936
+ let s = 0;
7937
+ for(let i = 0; i < m; i++)s += w[i] * ptsY[dists[i].idx];
7938
+ return s / sumw;
7939
+ }
7940
+ let sw = 0, sx = 0, sy = 0, sxx = 0, sxy = 0;
7941
+ for(let i = 0; i < m; i++){
7942
+ const idx = dists[i].idx, xi = ptsX[idx], yi = ptsY[idx], wi = w[i];
7943
+ sw += wi, sx += wi * xi, sy += wi * yi, sxx += wi * xi * xi, sxy += wi * xi * yi;
7944
+ }
7945
+ const meanX = sx / sw, meanY = sy / sw, denom = sxx - sx * meanX, slope = Math.abs(denom) < 1e-12 ? 0 : (sxy - sx * meanY) / denom;
7946
+ return meanY - slope * meanX + slope * x0;
7947
+ }
7948
+ function predict(x0) {
7949
+ if (Array.isArray(x0)) {
7950
+ const out = [];
7951
+ for(let i = 0; i < x0.length; i++)out.push(predictSingle(x0[i]));
7952
+ return out;
7953
+ }
7954
+ return predictSingle(x0);
7955
+ }
7956
+ return {
7957
+ predict: predict,
7958
+ evaluate: predict,
7959
+ evaluateGrid: function(N) {
7960
+ const out = [];
7961
+ if (N <= 0) return out;
7962
+ if (0 === n) return out;
7963
+ let min = 1 / 0, max = -1 / 0;
7964
+ for(let i = 0; i < n; i++)ptsX[i] < min && (min = ptsX[i]), ptsX[i] > max && (max = ptsX[i]);
7965
+ if (min === max) {
7966
+ const v = predictSingle(min);
7967
+ for(let i = 0; i < N; i++)out.push({
7968
+ x: min,
7969
+ y: v
7970
+ });
7971
+ return out;
7972
+ }
7973
+ const step = (max - min) / (N - 1);
7974
+ let robustWeights;
7975
+ for(let iter = 0; iter < iterations; iter++){
7976
+ const fits = [];
7977
+ for(let i = 0; i < n; i++)fits.push(predictSingle(ptsX[i], robustWeights));
7978
+ const res = [];
7979
+ for(let i = 0; i < n; i++)res.push(Math.abs(ptsY[i] - fits[i]));
7980
+ const med = res.slice().sort((a, b)=>a - b)[Math.floor(n / 2)] || 0;
7981
+ robustWeights = new Array(n);
7982
+ for(let i = 0; i < n; i++){
7983
+ const u = 0 === med ? 0 : res[i] / (6 * med), w = Math.abs(u) >= 1 ? 0 : (1 - u * u) * (1 - u * u);
7984
+ robustWeights[i] = w;
7985
+ }
7986
+ }
7987
+ for(let i = 0; i < N; i++){
7988
+ const px = i === N - 1 ? max : min + step * i;
7989
+ out.push({
7990
+ x: px,
7991
+ y: predictSingle(px, robustWeights)
7992
+ });
7993
+ }
7994
+ return out;
7995
+ },
7996
+ confidenceInterval: function(N = 50, alpha = .05) {
7997
+ const out = [];
7998
+ if (N <= 0) return out;
7999
+ if (0 === n) return out;
8000
+ let min = 1 / 0, max = -1 / 0;
8001
+ for(let i = 0; i < n; i++)ptsX[i] < min && (min = ptsX[i]), ptsX[i] > max && (max = ptsX[i]);
8002
+ if (min === 1 / 0 || max === -1 / 0) return out;
8003
+ const comps = computeLinearCIComponents(data, x, y, (xx)=>predictSingle(xx));
8004
+ if (0 === comps.n) return out;
8005
+ const z = Math.abs(invNorm(1 - alpha / 2));
8006
+ if (comps.min === comps.max) {
8007
+ const v = predictSingle(comps.min), errs = stdErrorsAt(comps.min, comps);
8008
+ for(let i = 0; i < N; i++)out.push({
8009
+ x: comps.min,
8010
+ mean: v,
8011
+ lower: v - z * errs.seMean,
8012
+ upper: v + z * errs.seMean,
8013
+ predLower: v - z * errs.sePred,
8014
+ predUpper: v + z * errs.sePred
8015
+ });
8016
+ return out;
8017
+ }
8018
+ const step = (max - min) / (N - 1);
8019
+ for(let i = 0; i < N; i++){
8020
+ const px = i === N - 1 ? max : min + step * i, yh = predictSingle(px), errs = stdErrorsAt(px, comps);
8021
+ out.push({
8022
+ x: px,
8023
+ mean: yh,
8024
+ lower: yh - z * errs.seMean,
8025
+ upper: yh + z * errs.seMean,
8026
+ predLower: yh - z * errs.sePred,
8027
+ predUpper: yh + z * errs.sePred
8028
+ });
8029
+ }
8030
+ return out;
8031
+ }
8032
+ };
8033
+ }
8034
+ function regressionLogistic(data, x = (d)=>d.x, y = (d)=>d.y, options) {
8035
+ var _a, _b;
8036
+ const maxIter = null != (_a = null == options ? void 0 : options.maxIteration) ? _a : 25, tol = null != (_b = null == options ? void 0 : options.tol) ? _b : 1e-6, xs = [], ys = [];
8037
+ visitPoints(data, x, y, (dx, dy)=>{
8038
+ xs.push(dx), ys.push(dy ? 1 : 0);
8039
+ });
8040
+ const n = xs.length;
8041
+ if (0 === n) return {
8042
+ coef: [
8043
+ 0,
8044
+ 0
8045
+ ],
8046
+ predict: (_x)=>0,
8047
+ evaluateGrid: (N)=>[],
8048
+ confidenceInterval: (N = 50)=>[]
8049
+ };
8050
+ let intercept = 0, beta = 0;
8051
+ for(let iter = 0; iter < maxIter; iter++){
8052
+ const p = new Array(n);
8053
+ let converged = !0;
8054
+ for(let i = 0; i < n; i++){
8055
+ const z = intercept + beta * xs[i], pi = 1 / (1 + Math.exp(-z));
8056
+ p[i] = pi;
8057
+ }
8058
+ let g0 = 0, g1 = 0, h00 = 0, h01 = 0, h11 = 0;
8059
+ for(let i = 0; i < n; i++){
8060
+ const wi = p[i] * (1 - p[i]), diff = ys[i] - p[i];
8061
+ g0 += diff, g1 += diff * xs[i], h00 += wi, h01 += wi * xs[i], h11 += wi * xs[i] * xs[i];
8062
+ }
8063
+ const det = h00 * h11 - h01 * h01;
8064
+ if (Math.abs(det) < 1e-12) break;
8065
+ const delta0 = (h11 * g0 - h01 * g1) / det, delta1 = (-h01 * g0 + h00 * g1) / det;
8066
+ if (intercept += delta0, beta += delta1, (Math.abs(delta0) > tol || Math.abs(delta1) > tol) && (converged = !1), converged) break;
8067
+ }
8068
+ const predict = (xx)=>{
8069
+ const z = intercept + beta * xx;
8070
+ return 1 / (1 + Math.exp(-z));
8071
+ };
8072
+ return {
8073
+ coef: [
8074
+ intercept,
8075
+ beta
8076
+ ],
8077
+ predict: predict,
8078
+ evaluateGrid: function(N) {
8079
+ const out = [];
8080
+ if (N <= 0) return out;
8081
+ let min = 1 / 0, max = -1 / 0;
8082
+ if (visitPoints(data, x, y, (dx)=>{
8083
+ dx < min && (min = dx), dx > max && (max = dx);
8084
+ }), min === 1 / 0 || max === -1 / 0) return out;
8085
+ if (min === max) {
8086
+ const v = predict(min);
8087
+ for(let i = 0; i < N; i++)out.push({
8088
+ x: min,
8089
+ y: v
8090
+ });
8091
+ return out;
8092
+ }
8093
+ const step = (max - min) / (N - 1);
8094
+ for(let i = 0; i < N; i++){
8095
+ const px = i === N - 1 ? max : min + step * i;
8096
+ out.push({
8097
+ x: px,
8098
+ y: predict(px)
8099
+ });
6832
8100
  }
8101
+ return out;
6833
8102
  },
6834
- label: {
6835
- visible: labelVisible,
6836
- labelBackground: {
6837
- visible: labelVisible,
6838
- style: {
6839
- fill: labelBackgroundColor
6840
- }
6841
- },
6842
- style: {
6843
- fill: labelColor
8103
+ confidenceInterval: function(N = 50, alpha = .05) {
8104
+ const out = [];
8105
+ if (N <= 0) return out;
8106
+ const comps = computeLinearCIComponents(data, x, y, predict);
8107
+ if (0 === comps.n) return out;
8108
+ const z = Math.abs(invNorm(1 - alpha / 2));
8109
+ if (comps.min === comps.max) {
8110
+ const v = predict(comps.min), errs = stdErrorsAt(comps.min, comps);
8111
+ for(let i = 0; i < N; i++)out.push({
8112
+ x: comps.min,
8113
+ mean: v,
8114
+ lower: v - z * errs.seMean,
8115
+ upper: v + z * errs.seMean,
8116
+ predLower: v - z * errs.sePred,
8117
+ predUpper: v + z * errs.sePred
8118
+ });
8119
+ return out;
8120
+ }
8121
+ const step = (comps.max - comps.min) / (N - 1);
8122
+ for(let i = 0; i < N; i++){
8123
+ const px = i === N - 1 ? comps.max : comps.min + step * i, yh = predict(px), errs = stdErrorsAt(px, comps);
8124
+ out.push({
8125
+ x: px,
8126
+ mean: yh,
8127
+ lower: yh - z * errs.seMean,
8128
+ upper: yh + z * errs.seMean,
8129
+ predLower: yh - z * errs.sePred,
8130
+ predUpper: yh + z * errs.sePred
8131
+ });
6844
8132
  }
8133
+ return out;
6845
8134
  }
6846
8135
  };
6847
- return result;
6848
- };
8136
+ }
8137
+ const generateRegressionLinePipe = (type, regressionFunction, getOptions)=>(spec, context)=>{
8138
+ const result = {
8139
+ ...spec
8140
+ };
8141
+ const { advancedVSeed } = context;
8142
+ const { chartType, regressionLine } = advancedVSeed;
8143
+ const lineTheme = advancedVSeed.config[chartType]?.regressionLine;
8144
+ if (!regressionLine || !regressionLine[type]) return result;
8145
+ const lineList = array_array(regressionLine[type]);
8146
+ if (!result.customMark) result.customMark = [];
8147
+ lineList.forEach((line, lineIndex)=>{
8148
+ const theme = lineTheme.linearRegressionLine ?? {};
8149
+ const { color, lineWidth, lineDash, text, textColor, textFontSize, textFontWeight, confidenceIntervalOpacity, confidenceIntervalVisible = theme.confidenceIntervalVisible } = line;
8150
+ const childrenMarks = [];
8151
+ result.customMark.push({
8152
+ type: 'group',
8153
+ interactive: false,
8154
+ zIndex: 500,
8155
+ name: `${type}-${lineIndex}`,
8156
+ style: {
8157
+ data: (datum, ctx)=>{
8158
+ const vchart = ctx.vchart;
8159
+ const chart = vchart.getChart();
8160
+ const s = chart.getAllSeries()[0];
8161
+ if (s) {
8162
+ const rect = s.getRegion().getLayoutRect();
8163
+ const segments = [];
8164
+ if (0 === rect.width || 0 === rect.height) return segments;
8165
+ const start = s.getRegion().getLayoutStartPoint();
8166
+ const yClamper = clamper(start.y, start.y + rect.height);
8167
+ const colorAttrOptions = s.getColorAttribute();
8168
+ const groups = s.getSeriesKeys();
8169
+ const data = s.getViewData()?.latestData;
8170
+ const fieldX = s.fieldX?.[0];
8171
+ const fieldY = s.fieldY?.[0];
8172
+ if (!groups.length) groups.push(void 0);
8173
+ groups.forEach((group)=>{
8174
+ const groupData = data.filter((d)=>d[colorAttrOptions?.field] === group);
8175
+ if (!groupData.length) return;
8176
+ const { confidenceInterval, evaluateGrid } = regressionFunction(groupData, (datum)=>datum?.[fieldX], (datum)=>datum?.[fieldY], getOptions?.(line));
8177
+ const N = Math.max(3, Math.floor(groupData.length / 4));
8178
+ const mainColor = color ?? colorAttrOptions?.scale?.scale(group);
8179
+ const lineData = evaluateGrid(N);
8180
+ const linePoints = lineData.map((ld)=>{
8181
+ const d = {
8182
+ [fieldX]: ld.x,
8183
+ [fieldY]: ld.y
8184
+ };
8185
+ return {
8186
+ x: s.dataToPositionX(d) + start.x,
8187
+ y: yClamper(s.dataToPositionY(d) + start.y)
8188
+ };
8189
+ });
8190
+ segments.push({
8191
+ color: mainColor,
8192
+ linePoints
8193
+ });
8194
+ if (confidenceIntervalVisible) {
8195
+ const intervalData = confidenceInterval(N);
8196
+ const areaPoints = intervalData.map((datum)=>{
8197
+ const d = {
8198
+ [fieldX]: datum.x,
8199
+ [fieldY]: datum.lower
8200
+ };
8201
+ return {
8202
+ x: s.dataToPositionX(d) + start.x,
8203
+ y: yClamper(s.dataToPositionY(d) + start.y),
8204
+ y1: yClamper(s.dataToPositionY({
8205
+ [fieldY]: datum.upper
8206
+ }) + start.y)
8207
+ };
8208
+ });
8209
+ segments[segments.length - 1].areaPoints = areaPoints;
8210
+ }
8211
+ });
8212
+ return segments;
8213
+ }
8214
+ return [];
8215
+ }
8216
+ },
8217
+ children: childrenMarks
8218
+ });
8219
+ if (confidenceIntervalVisible) childrenMarks.push({
8220
+ type: 'area',
8221
+ interactive: false,
8222
+ zIndex: 500,
8223
+ style: {
8224
+ lineWidth: lineWidth ?? theme.lineWidth,
8225
+ lineDash: lineDash ?? theme.lineDash,
8226
+ fillOpacity: confidenceIntervalOpacity ?? theme.confidenceIntervalOpacity,
8227
+ fill: 'red',
8228
+ segments: (datum, ctx, opt)=>{
8229
+ const parentNode = opt.mark?._product?.parent;
8230
+ if (parentNode?.attribute?.data?.length) return parentNode.attribute.data.map((d)=>({
8231
+ points: d.areaPoints ?? [],
8232
+ fill: d.color
8233
+ }));
8234
+ return [];
8235
+ }
8236
+ }
8237
+ });
8238
+ childrenMarks.push({
8239
+ type: 'line',
8240
+ interactive: false,
8241
+ zIndex: 500,
8242
+ style: {
8243
+ lineWidth: lineWidth ?? theme.lineWidth,
8244
+ lineDash: lineDash ?? theme.lineDash,
8245
+ stroke: 'red',
8246
+ segments: (datum, ctx, opt)=>{
8247
+ const parentNode = opt.mark?._product?.parent;
8248
+ if (parentNode?.attribute?.data?.length) return parentNode.attribute.data.map((d)=>({
8249
+ points: d.linePoints,
8250
+ stroke: d.color
8251
+ }));
8252
+ return [];
8253
+ }
8254
+ }
8255
+ });
8256
+ if (!chunk_JK3VNB42_n(text)) childrenMarks.push({
8257
+ type: 'text',
8258
+ interactive: false,
8259
+ zIndex: 500,
8260
+ style: {
8261
+ textAlign: 'end',
8262
+ fill: textColor ?? theme.textColor,
8263
+ fontSize: textFontSize ?? theme.textFontSize,
8264
+ fontWeight: textFontWeight ?? theme.textFontWeight,
8265
+ text: text,
8266
+ x: (datum, ctx, opt)=>{
8267
+ const parentNode = opt.mark?._product?.parent;
8268
+ if (parentNode?.attribute?.data?.length) {
8269
+ const point = parentNode.attribute.data[parentNode.attribute.data.length - 1].linePoints;
8270
+ return point[point.length - 1]?.x;
8271
+ }
8272
+ },
8273
+ y: (datum, ctx, opt)=>{
8274
+ const parentNode = opt.mark?._product?.parent;
8275
+ if (parentNode?.attribute?.data?.length) {
8276
+ const point = parentNode.attribute.data[parentNode.attribute.data.length - 1].linePoints;
8277
+ return point[point.length - 1]?.y;
8278
+ }
8279
+ }
8280
+ }
8281
+ });
8282
+ });
8283
+ return result;
8284
+ };
8285
+ const linearRegressionLine = generateRegressionLinePipe('linearRegressionLine', regressionLinear);
8286
+ const lowessRegressionLine = generateRegressionLinePipe('lowessRegressionLine', regressionLowess);
8287
+ const polynomialRegressionLine = generateRegressionLinePipe('polynomialRegressionLine', regressionPolynomial, (lineConfig)=>({
8288
+ degree: lineConfig.degree ?? 2
8289
+ }));
8290
+ const logisticRegressionLine = generateRegressionLinePipe('logisticRegressionLine', regressionLogistic);
6849
8291
  const scatter = [
6850
8292
  initScatter,
6851
8293
  colorAdapter(color_color, linearColor),
@@ -6865,7 +8307,11 @@
6865
8307
  annotationPoint_annotationPoint,
6866
8308
  annotationVerticalLine_annotationVerticalLine,
6867
8309
  annotationHorizontalLine_annotationHorizontalLine,
6868
- annotationArea_annotationArea
8310
+ annotationArea_annotationArea,
8311
+ linearRegressionLine,
8312
+ lowessRegressionLine,
8313
+ polynomialRegressionLine,
8314
+ logisticRegressionLine
6869
8315
  ];
6870
8316
  const pivotScatter = [
6871
8317
  initPivot,
@@ -6879,7 +8325,7 @@
6879
8325
  datasetScatter,
6880
8326
  progressive,
6881
8327
  xLinear,
6882
- yLinear,
8328
+ pivotAxisStyle(yLinear),
6883
8329
  scatterSize,
6884
8330
  labelScatter,
6885
8331
  tooltipScatter,
@@ -6890,10 +8336,13 @@
6890
8336
  annotationPoint_annotationPoint,
6891
8337
  annotationVerticalLine_annotationVerticalLine,
6892
8338
  annotationHorizontalLine_annotationHorizontalLine,
6893
- annotationArea_annotationArea
8339
+ annotationArea_annotationArea,
8340
+ linearRegressionLine,
8341
+ lowessRegressionLine
6894
8342
  ]),
6895
8343
  pivotRowDimensions,
6896
8344
  pivotColumnDimensions,
8345
+ pivotTitle,
6897
8346
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
6898
8347
  ];
6899
8348
  const scatterSpecPipeline = [
@@ -7577,7 +9026,7 @@
7577
9026
  title: {
7578
9027
  visible: true
7579
9028
  },
7580
- content: createDimensionContent(measures, foldInfoList[0], unfoldInfo)
9029
+ content: createDimensionContent(dimensions, measures, foldInfoList[0], unfoldInfo)
7581
9030
  }
7582
9031
  };
7583
9032
  return result;
@@ -7608,7 +9057,7 @@
7608
9057
  title: {
7609
9058
  visible: true
7610
9059
  },
7611
- content: createDimensionContent(measures, foldInfoList[1], unfoldInfo)
9060
+ content: createDimensionContent(dimensions, measures, foldInfoList[1], unfoldInfo)
7612
9061
  }
7613
9062
  };
7614
9063
  return result;
@@ -7907,7 +9356,7 @@
7907
9356
  ]),
7908
9357
  xBand,
7909
9358
  yLinearPrimary,
7910
- yLinearSecondary,
9359
+ pivotAxisStyle(yLinearSecondary),
7911
9360
  colorAdapter(color_color, linearColor),
7912
9361
  background_backgroundColor,
7913
9362
  verticalCrosshairRect,
@@ -7918,6 +9367,7 @@
7918
9367
  ]),
7919
9368
  pivotRowDimensions,
7920
9369
  pivotColumnDimensions,
9370
+ pivotTitle,
7921
9371
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
7922
9372
  ];
7923
9373
  const dualAxisSpecPipeline = [
@@ -8098,6 +9548,13 @@
8098
9548
  ...spec,
8099
9549
  hideIndicatorName: true
8100
9550
  });
9551
+ const addRegionPadding = (spec)=>{
9552
+ const result = {
9553
+ ...spec
9554
+ };
9555
+ if (result.region && result.region.length > 0) result.region[0].padding = 10;
9556
+ return result;
9557
+ };
8101
9558
  const pie = [
8102
9559
  initPie,
8103
9560
  colorAdapter(color_color, linearColor),
@@ -8131,10 +9588,12 @@
8131
9588
  annotationPoint_annotationPoint,
8132
9589
  annotationVerticalLine_annotationVerticalLine,
8133
9590
  annotationHorizontalLine_annotationHorizontalLine,
8134
- annotationArea_annotationArea
9591
+ annotationArea_annotationArea,
9592
+ addRegionPadding
8135
9593
  ]),
8136
9594
  pivotRowDimensions,
8137
9595
  pivotColumnDimensions,
9596
+ pivotTitle,
8138
9597
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
8139
9598
  ];
8140
9599
  const pieSpecPipeline = [
@@ -8215,6 +9674,7 @@
8215
9674
  datasetPivot,
8216
9675
  pivotIndicators_pivotIndicators([
8217
9676
  initDonut,
9677
+ addRegionPadding,
8218
9678
  colorAdapter(color_color, linearColor),
8219
9679
  background_backgroundColor,
8220
9680
  datasetXY,
@@ -8229,6 +9689,7 @@
8229
9689
  ]),
8230
9690
  pivotRowDimensions,
8231
9691
  pivotColumnDimensions,
9692
+ pivotTitle,
8232
9693
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
8233
9694
  ];
8234
9695
  const donutSpecPipeline = [
@@ -8435,6 +9896,7 @@
8435
9896
  datasetPivot,
8436
9897
  pivotIndicators_pivotIndicators([
8437
9898
  initRose,
9899
+ addRegionPadding,
8438
9900
  stackCornerRadius_stackCornerRadius,
8439
9901
  stackInverse,
8440
9902
  colorAdapter(color_color, linearColor),
@@ -8449,6 +9911,7 @@
8449
9911
  ]),
8450
9912
  pivotRowDimensions,
8451
9913
  pivotColumnDimensions,
9914
+ pivotTitle,
8452
9915
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
8453
9916
  ];
8454
9917
  const roseSpecPipeline = [
@@ -8555,6 +10018,7 @@
8555
10018
  datasetPivot,
8556
10019
  pivotIndicators_pivotIndicators([
8557
10020
  initRoseParallel,
10021
+ addRegionPadding,
8558
10022
  stackCornerRadius_stackCornerRadius,
8559
10023
  colorAdapter(color_color, linearColor),
8560
10024
  background_backgroundColor,
@@ -8572,6 +10036,7 @@
8572
10036
  ]),
8573
10037
  pivotRowDimensions,
8574
10038
  pivotColumnDimensions,
10039
+ pivotTitle,
8575
10040
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
8576
10041
  ];
8577
10042
  const roseParallelSpecPipeline = [
@@ -8772,6 +10237,7 @@
8772
10237
  datasetPivot,
8773
10238
  pivotIndicators_pivotIndicators([
8774
10239
  initRadar,
10240
+ addRegionPadding,
8775
10241
  colorAdapter(color_color, linearColor),
8776
10242
  background_backgroundColor,
8777
10243
  datasetXY,
@@ -8788,6 +10254,7 @@
8788
10254
  ]),
8789
10255
  pivotRowDimensions,
8790
10256
  pivotColumnDimensions,
10257
+ pivotTitle,
8791
10258
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
8792
10259
  ];
8793
10260
  const radarSpecPipeline = [
@@ -9004,6 +10471,7 @@
9004
10471
  ]),
9005
10472
  pivotRowDimensions,
9006
10473
  pivotColumnDimensions,
10474
+ pivotTitle,
9007
10475
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
9008
10476
  ];
9009
10477
  const funnelSpecPipeline = [
@@ -9310,7 +10778,7 @@
9310
10778
  pivotIndicatorsAsRow,
9311
10779
  datasetPivot,
9312
10780
  pivotIndicators_pivotIndicators([
9313
- initHeatmap,
10781
+ pivotAxisStyle(initHeatmap),
9314
10782
  background_backgroundColor,
9315
10783
  datasetXY,
9316
10784
  colorAdapter(color_color, linearColor),
@@ -9324,6 +10792,7 @@
9324
10792
  ]),
9325
10793
  pivotRowDimensions,
9326
10794
  pivotColumnDimensions,
10795
+ pivotTitle,
9327
10796
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
9328
10797
  ];
9329
10798
  const heatmapSpecPipeline = [
@@ -9432,16 +10901,6 @@
9432
10901
  ...tooltip
9433
10902
  ]);
9434
10903
  };
9435
- const isType_isType = (value, type)=>Object.prototype.toString.call(value) === `[object ${type}]`;
9436
- const isType = isType_isType;
9437
- const isArray = (value)=>Array.isArray ? Array.isArray(value) : isType(value, "Array");
9438
- const common_isArray = isArray;
9439
- const isNil = (value)=>null == value;
9440
- const common_isNil = isNil;
9441
- const clamp_clamp = function(input, min, max) {
9442
- return input < min ? min : input > max ? max : input;
9443
- };
9444
- const clamp = clamp_clamp;
9445
10904
  function toNumber(a) {
9446
10905
  return Number(a);
9447
10906
  }
@@ -9669,7 +11128,6 @@
9669
11128
  datasets.push(newDatasets);
9670
11129
  datasetReshapeInfo.push(reshapeInfo);
9671
11130
  });
9672
- console.log(datasets);
9673
11131
  return {
9674
11132
  ...result,
9675
11133
  dataset: datasets,
@@ -9874,7 +11332,7 @@
9874
11332
  datasetBoxplot,
9875
11333
  progressive,
9876
11334
  xBand,
9877
- yLinear,
11335
+ pivotAxisStyle(yLinear),
9878
11336
  label_label,
9879
11337
  tooltipBoxplot,
9880
11338
  colorBarStyleFill(barStyle_barStyle),
@@ -9886,6 +11344,7 @@
9886
11344
  ]),
9887
11345
  pivotRowDimensions,
9888
11346
  pivotColumnDimensions,
11347
+ pivotTitle,
9889
11348
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
9890
11349
  ];
9891
11350
  const boxplotSpecPipeline = [
@@ -10259,11 +11718,6 @@
10259
11718
  datasetReshapeInfo: datasetReshapeInfo
10260
11719
  };
10261
11720
  };
10262
- const regressionLine = (advancedVSeed, context)=>{
10263
- const { vseed } = context;
10264
- if ('histogramRegressionLine' in vseed && 'histogram' === vseed.chartType) advancedVSeed.histogramRegressionLine = vseed.histogramRegressionLine;
10265
- return advancedVSeed;
10266
- };
10267
11721
  const histogramAdvancedPipeline = [
10268
11722
  initAdvancedVSeed_initAdvancedVSeed,
10269
11723
  default_defaultMeasures_defaultMeasures,
@@ -10292,7 +11746,7 @@
10292
11746
  theme_theme,
10293
11747
  markStyle_markStyle,
10294
11748
  annotation_annotation,
10295
- regressionLine
11749
+ regressionLine_regressionLine
10296
11750
  ];
10297
11751
  const initHistogram = (spec)=>{
10298
11752
  const result = {
@@ -10495,6 +11949,97 @@
10495
11949
  }
10496
11950
  };
10497
11951
  }
11952
+ const kdeRegressionLine = (spec, context)=>{
11953
+ const result = {
11954
+ ...spec
11955
+ };
11956
+ const { advancedVSeed, vseed } = context;
11957
+ const { chartType, encoding = {}, dimensions, regressionLine } = advancedVSeed;
11958
+ const { dataset } = vseed;
11959
+ const lineTheme = advancedVSeed.config[chartType]?.regressionLine;
11960
+ if (!regressionLine || !regressionLine.kdeRegressionLine) return result;
11961
+ const rowColumnFields = T(dimensions.filter((dim)=>'row' === dim.encoding || 'column' === dim.encoding), (item)=>item.id);
11962
+ const lineList = array_array(regressionLine.kdeRegressionLine);
11963
+ if (!result.customMark) result.customMark = [];
11964
+ lineList.forEach((line, lineIndex)=>{
11965
+ const theme = lineTheme.kdeRegressionLine ?? {};
11966
+ const { color, lineWidth, lineDash, text, textColor, textFontSize, textFontWeight } = line;
11967
+ const childrenMarks = [];
11968
+ result.customMark.push({
11969
+ type: 'group',
11970
+ interactive: false,
11971
+ zIndex: 500,
11972
+ name: `kdeRegressionLine-${lineIndex}`,
11973
+ style: {
11974
+ data: (datum, ctx)=>{
11975
+ const vchart = ctx.vchart;
11976
+ const chart = vchart.getChart();
11977
+ const series = chart.getAllSeries().filter((s)=>'bar' === s.type);
11978
+ if (series && series.length) {
11979
+ const s = series[0];
11980
+ const region = s.getRegion().getLayoutStartPoint();
11981
+ const fieldX = s.fieldX?.[0];
11982
+ const scaleY = s.getYAxisHelper().getScale?.(0);
11983
+ const viewData = s.getViewData()?.latestData;
11984
+ if (!dataset || !dataset.length || !viewData || !viewData.length || !scaleY) return null;
11985
+ const simpleData = dataset.filter((entry)=>rowColumnFields.length ? rowColumnFields.every((dim)=>entry[dim.id] === viewData[0][dim.id]) : true).map((d)=>d[encoding.value?.[0]]);
11986
+ const res = kde_kde(simpleData, {
11987
+ bandwidth: Math.abs(viewData[0][BinEndMeasureId] - viewData[0][BinStartMeasureId])
11988
+ });
11989
+ const N = Math.max(3, Math.floor(simpleData.length / 4));
11990
+ const lineData = res.evaluateGrid(N);
11991
+ const scaleR = (k)=>scaleY.scale(k * simpleData.length * res.bandwidth);
11992
+ const linePoints = lineData.map((ld)=>{
11993
+ const d = {
11994
+ [fieldX]: ld.x
11995
+ };
11996
+ return {
11997
+ x: s.dataToPositionX(d) + region.x,
11998
+ y: scaleR(ld.y) + region.y
11999
+ };
12000
+ });
12001
+ return {
12002
+ linePoints,
12003
+ color: color ?? s.getOption().globalScale.getScale('color')?.scale(s.getSeriesKeys()[0])
12004
+ };
12005
+ }
12006
+ return null;
12007
+ }
12008
+ },
12009
+ children: childrenMarks
12010
+ });
12011
+ childrenMarks.push({
12012
+ type: 'line',
12013
+ interactive: false,
12014
+ zIndex: 500,
12015
+ style: {
12016
+ lineWidth: lineWidth ?? theme.lineWidth,
12017
+ lineDash: lineDash ?? theme.lineDash,
12018
+ stroke: color ?? defaultRegressionLineColor,
12019
+ points: (datum, ctx, opt)=>{
12020
+ const parentNode = opt.mark?._product?.parent;
12021
+ if (parentNode?.attribute?.data) return parentNode.attribute.data.linePoints;
12022
+ return [];
12023
+ }
12024
+ }
12025
+ });
12026
+ if (!chunk_JK3VNB42_n(text)) childrenMarks.push({
12027
+ type: 'text',
12028
+ interactive: false,
12029
+ zIndex: 500,
12030
+ style: {
12031
+ textAlign: 'end',
12032
+ fill: textColor ?? theme.textColor,
12033
+ fontSize: textFontSize ?? theme.textFontSize,
12034
+ fontWeight: textFontWeight ?? theme.textFontWeight,
12035
+ text: text,
12036
+ x: defaultRegressionLineLabelX,
12037
+ y: defaultRegressionLineLabelY
12038
+ }
12039
+ });
12040
+ });
12041
+ return result;
12042
+ };
10498
12043
  function ecdf(data) {
10499
12044
  const n = data.length, sorted = data.slice().sort((a, b)=>a - b);
10500
12045
  function evaluateSingle(x) {
@@ -10540,44 +12085,29 @@
10540
12085
  n: n
10541
12086
  };
10542
12087
  }
10543
- const getRegressionByType = (type, data, kdeOptions)=>{
10544
- switch(type){
10545
- case 'kde':
10546
- return kde_kde(data, kdeOptions);
10547
- case 'ecdf':
10548
- return ecdf(data);
10549
- }
10550
- };
10551
- const histogramRegressionLine_histogramRegressionLine = (spec, context)=>{
12088
+ const ecdfRegressionLine = (spec, context)=>{
10552
12089
  const result = {
10553
12090
  ...spec
10554
12091
  };
10555
12092
  const { advancedVSeed, vseed } = context;
10556
- const { chartType, encoding = {}, dimensions, histogramRegressionLine } = advancedVSeed;
12093
+ const { chartType, encoding = {}, dimensions, regressionLine } = advancedVSeed;
10557
12094
  const { dataset } = vseed;
10558
- const theme = advancedVSeed.config[chartType]?.histogramRegressionLine;
10559
- if (!histogramRegressionLine) return result;
12095
+ const lineTheme = advancedVSeed.config[chartType]?.regressionLine;
12096
+ if (!regressionLine || !regressionLine.ecdfRegressionLine) return result;
10560
12097
  const rowColumnFields = T(dimensions.filter((dim)=>'row' === dim.encoding || 'column' === dim.encoding), (item)=>item.id);
10561
- const lineList = Array.isArray(histogramRegressionLine) ? histogramRegressionLine : [
10562
- histogramRegressionLine
10563
- ];
12098
+ const lineList = array_array(regressionLine.ecdfRegressionLine);
10564
12099
  if (!result.customMark) result.customMark = [];
10565
- lineList.forEach((line)=>{
10566
- const { color, type, lineWidth, lineDash, text, textColor, textFontSize, textFontWeight } = line;
12100
+ lineList.forEach((line, lineIndex)=>{
12101
+ const theme = lineTheme?.ecdfRegressionLine ?? {};
12102
+ const { color, lineWidth, lineDash, text, textColor, textFontSize, textFontWeight } = line;
12103
+ const childrenMarks = [];
10567
12104
  result.customMark.push({
10568
- type: 'line',
12105
+ type: 'group',
10569
12106
  interactive: false,
10570
12107
  zIndex: 500,
12108
+ name: `ecdfRegressionLine-${lineIndex}`,
10571
12109
  style: {
10572
- lineWidth: lineWidth ?? theme?.lineWidth,
10573
- lineDash: lineDash ?? theme?.lineDash,
10574
- stroke: color ?? ((datum, ctx)=>{
10575
- const vchart = ctx.vchart;
10576
- const chart = vchart.getChart();
10577
- const series = chart.getAllSeries().filter((s)=>'bar' === s.type);
10578
- return series.length ? series[0].getOption().globalScale.getScale('color')?.scale(series[0].getSeriesKeys()[0]) : void 0;
10579
- }),
10580
- points: (datum, ctx)=>{
12110
+ data: (datum, ctx)=>{
10581
12111
  const vchart = ctx.vchart;
10582
12112
  const chart = vchart.getChart();
10583
12113
  const series = chart.getAllSeries().filter((s)=>'bar' === s.type);
@@ -10587,18 +12117,16 @@
10587
12117
  const fieldX = s.fieldX?.[0];
10588
12118
  const scaleY = s.getYAxisHelper().getScale?.(0);
10589
12119
  const viewData = s.getViewData()?.latestData;
10590
- if (!dataset || !dataset.length || !viewData || !viewData.length || !scaleY) return;
12120
+ if (!dataset || !dataset.length || !viewData || !viewData.length || !scaleY) return null;
10591
12121
  const simpleData = dataset.filter((entry)=>rowColumnFields.length ? rowColumnFields.every((dim)=>entry[dim.id] === viewData[0][dim.id]) : true).map((d)=>d[encoding.value?.[0]]);
10592
- const res = getRegressionByType(type, simpleData, 'kde' === type ? {
10593
- bandwidth: Math.abs(viewData[0][BinEndMeasureId] - viewData[0][BinStartMeasureId])
10594
- } : void 0);
12122
+ const res = ecdf(simpleData);
10595
12123
  const N = Math.max(3, Math.floor(simpleData.length / 4));
10596
12124
  const lineData = res.evaluateGrid(N);
10597
12125
  const yRange = scaleY.range();
10598
12126
  const y0 = yRange[0];
10599
12127
  const y1 = yRange[yRange.length - 1];
10600
- const scaleR = 'kde' === type ? (k)=>scaleY.scale(k * simpleData.length * res.bandwidth) : (e)=>y0 + (y1 - y0) * e;
10601
- return lineData.map((ld)=>{
12128
+ const scaleR = (e)=>y0 + (y1 - y0) * e;
12129
+ const linePoints = lineData.map((ld)=>{
10602
12130
  const d = {
10603
12131
  [fieldX]: ld.x
10604
12132
  };
@@ -10607,54 +12135,43 @@
10607
12135
  y: scaleR(ld.y) + region.y
10608
12136
  };
10609
12137
  });
12138
+ return {
12139
+ linePoints,
12140
+ color: color ?? s.getOption().globalScale.getScale('color')?.scale(s.getSeriesKeys()[0])
12141
+ };
10610
12142
  }
12143
+ return null;
12144
+ }
12145
+ },
12146
+ children: childrenMarks
12147
+ });
12148
+ childrenMarks.push({
12149
+ type: 'line',
12150
+ interactive: false,
12151
+ zIndex: 500,
12152
+ style: {
12153
+ lineWidth: lineWidth ?? theme.lineWidth,
12154
+ lineDash: lineDash ?? theme.lineDash,
12155
+ stroke: color ?? defaultRegressionLineColor,
12156
+ points: (datum, ctx, opt)=>{
12157
+ const parentNode = opt.mark?._product?.parent;
12158
+ if (parentNode?.attribute?.data) return parentNode.attribute.data.linePoints;
10611
12159
  return [];
10612
12160
  }
10613
12161
  }
10614
12162
  });
10615
- if (!chunk_JK3VNB42_n(text)) result.customMark.push({
12163
+ if (!chunk_JK3VNB42_n(text)) childrenMarks.push({
10616
12164
  type: 'text',
10617
12165
  interactive: false,
10618
12166
  zIndex: 500,
10619
12167
  style: {
10620
12168
  textAlign: 'end',
10621
- fill: textColor ?? theme?.textColor,
10622
- fontSize: textFontSize ?? theme?.textFontSize,
10623
- fontWeight: textFontWeight ?? theme?.textFontWeight,
12169
+ fill: textColor ?? theme.textColor,
12170
+ fontSize: textFontSize ?? theme.textFontSize,
12171
+ fontWeight: textFontWeight ?? theme.textFontWeight,
10624
12172
  text: text,
10625
- x: (datum, ctx)=>{
10626
- const vchart = ctx.vchart;
10627
- const chart = vchart.getChart();
10628
- const series = chart.getAllSeries().filter((s)=>'bar' === s.type);
10629
- if (series && series.length) {
10630
- const s = series[0];
10631
- const startPoint = s.getRegion().getLayoutStartPoint();
10632
- const fieldX = s.fieldX[0];
10633
- const fieldX2 = s.fieldX2;
10634
- const scaleY = s.getYAxisHelper().getScale?.(0);
10635
- const viewData = s.getViewData()?.latestData;
10636
- if (!dataset || !dataset.length || !viewData || !viewData.length || !scaleY) return;
10637
- const maxX = Math.max.apply(null, viewData.map((d)=>Math.max(d[fieldX], d[fieldX2])));
10638
- return startPoint.x + s.dataToPositionX({
10639
- [fieldX]: maxX
10640
- });
10641
- }
10642
- },
10643
- y: (datum, ctx)=>{
10644
- const vchart = ctx.vchart;
10645
- const chart = vchart.getChart();
10646
- const series = chart.getAllSeries().filter((s)=>'bar' === s.type);
10647
- if (series && series.length) {
10648
- const s = series[0];
10649
- const startPoint = s.getRegion().getLayoutStartPoint();
10650
- const fieldY = s.fieldY[0];
10651
- const viewData = s.getViewData()?.latestData;
10652
- if (!viewData || !viewData.length) return;
10653
- return 'ecdf' === type ? startPoint.y + 12 : startPoint.y + s.dataToPositionY({
10654
- [fieldY]: viewData[viewData.length - 1]?.[fieldY]
10655
- });
10656
- }
10657
- }
12173
+ x: defaultRegressionLineLabelX,
12174
+ y: defaultRegressionLineLabelY
10658
12175
  }
10659
12176
  });
10660
12177
  });
@@ -10677,7 +12194,8 @@
10677
12194
  annotationVerticalLine_annotationVerticalLine,
10678
12195
  annotationHorizontalLine_annotationHorizontalLine,
10679
12196
  annotationAreaBand,
10680
- histogramRegressionLine_histogramRegressionLine
12197
+ kdeRegressionLine,
12198
+ ecdfRegressionLine
10681
12199
  ];
10682
12200
  const pivotHistogram = [
10683
12201
  initPivot,
@@ -10690,7 +12208,7 @@
10690
12208
  datasetHistogram,
10691
12209
  progressive,
10692
12210
  xLinear,
10693
- yLinear,
12211
+ pivotAxisStyle(yLinear),
10694
12212
  label_label,
10695
12213
  tooltipHistogram,
10696
12214
  colorBarStyleFill(barStyle_barStyle),
@@ -10699,10 +12217,12 @@
10699
12217
  annotationVerticalLine_annotationVerticalLine,
10700
12218
  annotationHorizontalLine_annotationHorizontalLine,
10701
12219
  annotationAreaBand,
10702
- histogramRegressionLine_histogramRegressionLine
12220
+ kdeRegressionLine,
12221
+ ecdfRegressionLine
10703
12222
  ]),
10704
12223
  pivotRowDimensions,
10705
12224
  pivotColumnDimensions,
12225
+ pivotTitle,
10706
12226
  colorAdapter(pivotDiscreteLegend, pivotColorLegend)
10707
12227
  ];
10708
12228
  const histogramSpecPipeline = [
@@ -10774,11 +12294,15 @@
10774
12294
  ];
10775
12295
  const getLightColor = ()=>({
10776
12296
  linearColorScheme: getLightLinearColorScheme(),
10777
- colorScheme: getLightColorScheme()
12297
+ colorScheme: getLightColorScheme(),
12298
+ positiveColor: '#7E5DFF',
12299
+ negativeColor: '#EB3373'
10778
12300
  });
10779
12301
  const getDarkColor = ()=>({
10780
12302
  linearColorScheme: getDarkLinearColorScheme(),
10781
- colorScheme: getDarkColorScheme()
12303
+ colorScheme: getDarkColorScheme(),
12304
+ positiveColor: '#7E5DFF',
12305
+ negativeColor: '#EB3373'
10782
12306
  });
10783
12307
  const getDefaultLabel = ()=>({
10784
12308
  enable: true,
@@ -10846,7 +12370,10 @@
10846
12370
  headerFontColor: tableConfig.headerFontColor,
10847
12371
  headerBackgroundColor: 'transparent',
10848
12372
  hoverHeaderBackgroundColor: tableConfig.hoverHeaderBackgroundColor,
10849
- hoverHeaderInlineBackgroundColor: tableConfig.hoverHeaderInlineBackgroundColor
12373
+ hoverHeaderInlineBackgroundColor: tableConfig.hoverHeaderInlineBackgroundColor,
12374
+ titleFontColor: tableConfig.headerFontColor,
12375
+ titleFontSize: tableConfig.headerFontSize,
12376
+ titleFontWeight: 'bold'
10850
12377
  });
10851
12378
  const getLightPivotChartGridConfig = ()=>pickPivotChartGridConfig(getLightTableConfig());
10852
12379
  const getDarkPivotChartGridConfig = ()=>pickPivotChartGridConfig(getDarkTableConfig());
@@ -11130,18 +12657,70 @@
11130
12657
  const getDarkHeatmapCellTheme = ()=>({
11131
12658
  stroke: '#404349'
11132
12659
  });
11133
- const getDefaultHistogramRegressionLine = ()=>({
12660
+ const getDefaultRegressionLine = ()=>({
11134
12661
  lineWidth: 2,
11135
12662
  textFontSize: 12,
11136
12663
  textFontWeight: 400
11137
12664
  });
11138
- const getLightHistogramRegressionLine = ()=>({
11139
- ...getDefaultHistogramRegressionLine(),
11140
- textColor: '#364159'
12665
+ const getLightRegressionLine = ()=>({
12666
+ kdeRegressionLine: {
12667
+ ...getDefaultRegressionLine(),
12668
+ textColor: '#364159'
12669
+ },
12670
+ ecdfRegressionLine: {
12671
+ ...getDefaultRegressionLine(),
12672
+ textColor: '#364159'
12673
+ },
12674
+ linearRegressionLine: {
12675
+ ...getDefaultRegressionLine(),
12676
+ textColor: '#364159',
12677
+ confidenceIntervalOpacity: 0.2
12678
+ },
12679
+ lowessRegressionLine: {
12680
+ ...getDefaultRegressionLine(),
12681
+ textColor: '#364159',
12682
+ confidenceIntervalOpacity: 0.2
12683
+ },
12684
+ polynomialRegressionLine: {
12685
+ ...getDefaultRegressionLine(),
12686
+ textColor: '#364159',
12687
+ confidenceIntervalOpacity: 0.2
12688
+ },
12689
+ logisticRegressionLine: {
12690
+ ...getDefaultRegressionLine(),
12691
+ textColor: '#364159',
12692
+ confidenceIntervalOpacity: 0.2
12693
+ }
11141
12694
  });
11142
- const getDarkHistogramRegressionLine = ()=>({
11143
- ...getDefaultHistogramRegressionLine(),
11144
- textColor: '#ffffff'
12695
+ const getDarkRegressionLine = ()=>({
12696
+ kdeRegressionLine: {
12697
+ ...getDefaultRegressionLine(),
12698
+ textColor: '#FFFFFF'
12699
+ },
12700
+ ecdfRegressionLine: {
12701
+ ...getDefaultRegressionLine(),
12702
+ textColor: '#FFFFFF'
12703
+ },
12704
+ linearRegressionLine: {
12705
+ ...getDefaultRegressionLine(),
12706
+ textColor: '#FFFFFF',
12707
+ confidenceIntervalOpacity: 0.2
12708
+ },
12709
+ lowessRegressionLine: {
12710
+ ...getDefaultRegressionLine(),
12711
+ textColor: '#FFFFFF',
12712
+ confidenceIntervalOpacity: 0.2
12713
+ },
12714
+ polynomialRegressionLine: {
12715
+ ...getDefaultRegressionLine(),
12716
+ textColor: '#FFFFFF',
12717
+ confidenceIntervalOpacity: 0.2
12718
+ },
12719
+ logisticRegressionLine: {
12720
+ ...getDefaultRegressionLine(),
12721
+ textColor: '#FFFFFF',
12722
+ confidenceIntervalOpacity: 0.2
12723
+ }
11145
12724
  });
11146
12725
  const lightTheme = ()=>{
11147
12726
  const linearAxis = getLightLinearAxis();
@@ -11193,7 +12772,8 @@
11193
12772
  0
11194
12773
  ],
11195
12774
  pivotGrid: getLightPivotChartGridConfig(),
11196
- annotation: getLightAnnotation()
12775
+ annotation: getLightAnnotation(),
12776
+ regressionLine: getLightRegressionLine()
11197
12777
  },
11198
12778
  columnParallel: {
11199
12779
  ...baseConfig,
@@ -11314,7 +12894,8 @@
11314
12894
  showValuePercent: false
11315
12895
  },
11316
12896
  pivotGrid: getLightPivotChartGridConfig(),
11317
- annotation: getLightAnnotation()
12897
+ annotation: getLightAnnotation(),
12898
+ regressionLine: getLightRegressionLine()
11318
12899
  },
11319
12900
  dualAxis: {
11320
12901
  ...baseConfig,
@@ -11339,7 +12920,7 @@
11339
12920
  label: {
11340
12921
  ...baseConfig.label,
11341
12922
  showValuePercent: true,
11342
- labelLayout: 'labelLine',
12923
+ labelLayout: 'arc',
11343
12924
  showDimension: true
11344
12925
  },
11345
12926
  pivotGrid: getLightPivotChartGridConfig()
@@ -11349,7 +12930,7 @@
11349
12930
  label: {
11350
12931
  ...baseConfig.label,
11351
12932
  showValuePercent: true,
11352
- labelLayout: 'labelLine',
12933
+ labelLayout: 'arc',
11353
12934
  showDimension: true
11354
12935
  },
11355
12936
  pivotGrid: getLightPivotChartGridConfig()
@@ -11397,7 +12978,7 @@
11397
12978
  crosshairRect,
11398
12979
  pivotGrid: getLightPivotChartGridConfig(),
11399
12980
  annotation: getLightAnnotation(),
11400
- histogramRegressionLine: getLightHistogramRegressionLine()
12981
+ regressionLine: getLightRegressionLine()
11401
12982
  },
11402
12983
  boxPlot: {
11403
12984
  ...baseConfig,
@@ -11460,7 +13041,8 @@
11460
13041
  0
11461
13042
  ],
11462
13043
  pivotGrid: getDarkPivotChartGridConfig(),
11463
- annotation: getDarkAnnotation()
13044
+ annotation: getDarkAnnotation(),
13045
+ regressionLine: getDarkRegressionLine()
11464
13046
  },
11465
13047
  columnParallel: {
11466
13048
  ...baseConfig,
@@ -11575,7 +13157,8 @@
11575
13157
  showValuePercent: false
11576
13158
  },
11577
13159
  pivotGrid: getDarkPivotChartGridConfig(),
11578
- annotation: getDarkAnnotation()
13160
+ annotation: getDarkAnnotation(),
13161
+ regressionLine: getDarkRegressionLine()
11579
13162
  },
11580
13163
  dualAxis: {
11581
13164
  ...baseConfig,
@@ -11600,7 +13183,7 @@
11600
13183
  label: {
11601
13184
  ...baseConfig.label,
11602
13185
  showValuePercent: true,
11603
- labelLayout: 'labelLine',
13186
+ labelLayout: 'arc',
11604
13187
  showDimension: true
11605
13188
  },
11606
13189
  pivotGrid: getDarkPivotChartGridConfig()
@@ -11610,7 +13193,7 @@
11610
13193
  label: {
11611
13194
  ...baseConfig.label,
11612
13195
  showValuePercent: true,
11613
- labelLayout: 'labelLine',
13196
+ labelLayout: 'arc',
11614
13197
  showDimension: true
11615
13198
  },
11616
13199
  pivotGrid: getDarkPivotChartGridConfig()
@@ -11658,7 +13241,7 @@
11658
13241
  crosshairRect: crosshairRect,
11659
13242
  pivotGrid: getDarkPivotChartGridConfig(),
11660
13243
  annotation: getDarkAnnotation(),
11661
- histogramRegressionLine: getDarkHistogramRegressionLine()
13244
+ regressionLine: getDarkRegressionLine()
11662
13245
  },
11663
13246
  boxPlot: {
11664
13247
  ...baseConfig,
@@ -15731,7 +17314,10 @@
15731
17314
  outlineBorderLineWidth: schemas_number().nullish(),
15732
17315
  frameCornerRadius: schemas_number().nullish(),
15733
17316
  minChartWidth: schemas_number().nullish(),
15734
- minChartHeight: schemas_number().nullish()
17317
+ minChartHeight: schemas_number().nullish(),
17318
+ titleFontColor: schemas_string().nullish(),
17319
+ titleFontSize: schemas_number().nullish(),
17320
+ titleFontWeight: schemas_string().nullish()
15735
17321
  });
15736
17322
  const zLineConfig = schemas_object({
15737
17323
  backgroundColor: zBackgroundColor.nullish(),
@@ -15753,7 +17339,35 @@
15753
17339
  ]);
15754
17340
  const zBarMaxWidth = schemas_number().or(schemas_string());
15755
17341
  const zBarGapInGroup = schemas_number().or(schemas_string());
15756
- const zColumnConfig = schemas_object({
17342
+ const zEcdfRegressionLine = schemas_object({
17343
+ color: schemas_string().nullish(),
17344
+ lineWidth: schemas_number().nullish(),
17345
+ lineDash: schemas_array(schemas_number()).nullish(),
17346
+ text: schemas_string().nullish(),
17347
+ textColor: schemas_string().nullish(),
17348
+ textFontSize: schemas_number().nullish(),
17349
+ textFontWeight: schemas_number().nullish()
17350
+ });
17351
+ const zKdeRegressionLine = zEcdfRegressionLine.extend({});
17352
+ const zLinearRegressionLine = zEcdfRegressionLine.extend({
17353
+ confidenceIntervalVisible: schemas_boolean().nullish(),
17354
+ confidenceIntervalColor: schemas_string().nullish(),
17355
+ confidenceIntervalOpacity: schemas_number().nullish()
17356
+ });
17357
+ const zLogisticRegressionLine = zLinearRegressionLine.extend({});
17358
+ const zLowessRegressionLine = zLinearRegressionLine.extend({});
17359
+ const zPolynomialRegressionLine = zLinearRegressionLine.extend({
17360
+ degree: schemas_number().nullish()
17361
+ });
17362
+ const zRegressionLine = schemas_object({
17363
+ ecdfRegressionLine: zEcdfRegressionLine.or(schemas_array(zEcdfRegressionLine)).nullish(),
17364
+ kdeRegressionLine: zKdeRegressionLine.or(schemas_array(zKdeRegressionLine)).nullish(),
17365
+ linearRegressionLine: zLinearRegressionLine.or(schemas_array(zLinearRegressionLine)).nullish(),
17366
+ lowessRegressionLine: zLowessRegressionLine.or(schemas_array(zLowessRegressionLine)).nullish(),
17367
+ polynomialRegressionLine: zPolynomialRegressionLine.or(schemas_array(zPolynomialRegressionLine)).nullish(),
17368
+ logisticRegressionLine: zLogisticRegressionLine.or(schemas_array(zLogisticRegressionLine)).nullish()
17369
+ });
17370
+ const zColumnParallelConfig = schemas_object({
15757
17371
  backgroundColor: zBackgroundColor.nullish(),
15758
17372
  label: zLabel.nullish(),
15759
17373
  color: zColor.nullish(),
@@ -15768,8 +17382,10 @@
15768
17382
  pivotGrid: zPivotChartGridConfig.nullish(),
15769
17383
  annotation: zAnnotationConfig.nullish()
15770
17384
  });
15771
- const zColumnParallelConfig = zColumnConfig;
15772
- const zColumnPercentConfig = zColumnConfig;
17385
+ const zColumnConfig = zColumnParallelConfig.extend({
17386
+ regressionLine: zRegressionLine.nullish()
17387
+ });
17388
+ const zColumnPercentConfig = zColumnParallelConfig.extend({});
15773
17389
  const zBarConfig = schemas_object({
15774
17390
  backgroundColor: zBackgroundColor.nullish(),
15775
17391
  label: zLabel.nullish(),
@@ -15810,7 +17426,8 @@
15810
17426
  size: schemas_number().or(schemas_array(schemas_number())).nullish(),
15811
17427
  sizeRange: schemas_number().or(schemas_array(schemas_number())).nullish(),
15812
17428
  pivotGrid: zPivotChartGridConfig.nullish(),
15813
- annotation: zAnnotationConfig.nullish()
17429
+ annotation: zAnnotationConfig.nullish(),
17430
+ regressionLine: zRegressionLine.nullish()
15814
17431
  });
15815
17432
  const zDualAxisConfig = schemas_object({
15816
17433
  backgroundColor: zBackgroundColor.nullish(),
@@ -15896,19 +17513,6 @@
15896
17513
  annotation: zAnnotationConfig.nullish(),
15897
17514
  whiskers: zWhiskersConfig.nullish()
15898
17515
  });
15899
- const zHistogramRegressionLine = schemas_object({
15900
- type: union([
15901
- literal('kde'),
15902
- literal('ecdf')
15903
- ]).nullish(),
15904
- color: schemas_string().nullish(),
15905
- lineWidth: schemas_number().nullish(),
15906
- lineDash: schemas_array(schemas_number()).nullish(),
15907
- text: schemas_string().nullish(),
15908
- textColor: schemas_string().nullish(),
15909
- textFontSize: schemas_number().nullish(),
15910
- textFontWeight: schemas_number().nullish()
15911
- });
15912
17516
  const zHistogramConfig = schemas_object({
15913
17517
  backgroundColor: zBackgroundColor.nullish(),
15914
17518
  label: zLabel.nullish(),
@@ -15924,7 +17528,7 @@
15924
17528
  binCount: schemas_number().positive().nullish(),
15925
17529
  binStep: schemas_number().positive().nullish(),
15926
17530
  binValueType: literal('count').or(literal('percentage')).nullish(),
15927
- histogramRegressionLine: zHistogramRegressionLine.nullish()
17531
+ regressionLine: zRegressionLine.nullish()
15928
17532
  });
15929
17533
  const zConfig = schemas_object({
15930
17534
  table: zTableConfig.nullish(),
@@ -16199,6 +17803,7 @@
16199
17803
  annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
16200
17804
  annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
16201
17805
  annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).nullish(),
17806
+ polynomialRegressionLine: schemas_array(zPolynomialRegressionLine).or(zPolynomialRegressionLine).or(schemas_boolean()).nullish(),
16202
17807
  locale: zLocale.nullish()
16203
17808
  });
16204
17809
  const zColumnParallel = schemas_object({
@@ -16394,6 +17999,10 @@
16394
17999
  annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
16395
18000
  annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
16396
18001
  annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).nullish(),
18002
+ linearRegressionLine: schemas_array(zLinearRegressionLine).or(zLinearRegressionLine).or(schemas_boolean()).nullish(),
18003
+ lowessRegressionLine: schemas_array(zLowessRegressionLine).or(zLowessRegressionLine).or(schemas_boolean()).nullish(),
18004
+ polynomialRegressionLine: schemas_array(zPolynomialRegressionLine).or(zPolynomialRegressionLine).or(schemas_boolean()).nullish(),
18005
+ logisticRegressionLine: schemas_array(zLogisticRegressionLine).or(zLogisticRegressionLine).or(schemas_boolean()).nullish(),
16397
18006
  locale: zLocale.nullish()
16398
18007
  });
16399
18008
  const zDualAxis = schemas_object({
@@ -16451,7 +18060,8 @@
16451
18060
  annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
16452
18061
  annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
16453
18062
  annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).nullish(),
16454
- histogramRegressionLine: schemas_array(zHistogramRegressionLine).or(zHistogramRegressionLine).nullish(),
18063
+ ecdfRegressionLine: schemas_array(zEcdfRegressionLine).or(zEcdfRegressionLine).or(schemas_boolean()).nullish(),
18064
+ kdeRegressionLine: schemas_array(zKdeRegressionLine).or(zKdeRegressionLine).or(schemas_boolean()).nullish(),
16455
18065
  locale: zLocale.nullish()
16456
18066
  });
16457
18067
  const zRose = schemas_object({
@@ -16613,7 +18223,7 @@
16613
18223
  customTheme: zCustomThemeConfig,
16614
18224
  annotation: zAnnotation,
16615
18225
  locale: zLocale,
16616
- histogramRegressionLine: zHistogramRegressionLine.or(schemas_array(zHistogramRegressionLine)).nullish()
18226
+ regressionLine: zRegressionLine
16617
18227
  });
16618
18228
  return __webpack_exports__;
16619
18229
  })());