@visactor/vseed 0.1.14 → 0.1.16

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 (169) hide show
  1. package/dist/cjs/index.cjs +3 -1
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/builder/builder/buildAdvanced.js +1 -1
  4. package/dist/esm/builder/builder/buildAdvanced.js.map +1 -1
  5. package/dist/esm/builder/builder/buildSpec.js +2 -3
  6. package/dist/esm/builder/builder/buildSpec.js.map +1 -1
  7. package/dist/esm/builder/builder/builder.d.ts +1113 -9
  8. package/dist/esm/dataReshape/foldMeasures.d.ts +1 -0
  9. package/dist/esm/dataReshape/foldMeasures.js +5 -1
  10. package/dist/esm/dataReshape/foldMeasures.js.map +1 -1
  11. package/dist/esm/pipeline/advanced/chart/pipes/default/defaultDimensions.js +4 -3
  12. package/dist/esm/pipeline/advanced/chart/pipes/default/defaultDimensions.js.map +1 -1
  13. package/dist/esm/pipeline/advanced/chart/pipes/default/defaultMeasures.js +12 -9
  14. package/dist/esm/pipeline/advanced/chart/pipes/default/defaultMeasures.js.map +1 -1
  15. package/dist/esm/pipeline/advanced/chart/pipes/init/initAdvancedVSeed.js +2 -0
  16. package/dist/esm/pipeline/advanced/chart/pipes/init/initAdvancedVSeed.js.map +1 -1
  17. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithDualEncoding.js +4 -6
  18. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithDualEncoding.js.map +1 -1
  19. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithEncoding.js +2 -5
  20. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithEncoding.js.map +1 -1
  21. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithScatterEncoding.js +2 -4
  22. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithScatterEncoding.js.map +1 -1
  23. package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithDualEncoding.js +4 -6
  24. package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithDualEncoding.js.map +1 -1
  25. package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js +2 -5
  26. package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js.map +1 -1
  27. package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.js +2 -4
  28. package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.js.map +1 -1
  29. package/dist/esm/pipeline/advanced/table/pipes/default/defaultDimensions.js +13 -7
  30. package/dist/esm/pipeline/advanced/table/pipes/default/defaultDimensions.js.map +1 -1
  31. package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasures.js +13 -9
  32. package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasures.js.map +1 -1
  33. package/dist/esm/pipeline/advanced/table/pipes/init/initAdvancedVSeed.js +2 -0
  34. package/dist/esm/pipeline/advanced/table/pipes/init/initAdvancedVSeed.js.map +1 -1
  35. package/dist/esm/pipeline/advanced/table/pipes/reshape/reshapePivotTable.js +2 -1
  36. package/dist/esm/pipeline/advanced/table/pipes/reshape/reshapePivotTable.js.map +1 -1
  37. package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js +1 -3
  38. package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js.map +1 -1
  39. package/dist/esm/pipeline/spec/chart/pipeline/scatter.js +3 -3
  40. package/dist/esm/pipeline/spec/chart/pipeline/scatter.js.map +1 -1
  41. package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.d.ts +2 -0
  42. package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.js +11 -0
  43. package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.js.map +1 -0
  44. package/dist/esm/pipeline/spec/chart/pipes/axes/title/defaultTitleText.d.ts +2 -0
  45. package/dist/esm/pipeline/spec/chart/pipes/axes/title/defaultTitleText.js +14 -0
  46. package/dist/esm/pipeline/spec/chart/pipes/axes/title/defaultTitleText.js.map +1 -0
  47. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js +3 -1
  48. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js.map +1 -1
  49. package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js +8 -5
  50. package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js.map +1 -1
  51. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js +3 -1
  52. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js.map +1 -1
  53. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js +8 -5
  54. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js.map +1 -1
  55. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js +8 -5
  56. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js.map +1 -1
  57. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js +8 -5
  58. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js.map +1 -1
  59. package/dist/esm/pipeline/spec/chart/pipes/label/index.d.ts +1 -1
  60. package/dist/esm/pipeline/spec/chart/pipes/label/index.js +2 -2
  61. package/dist/esm/pipeline/spec/chart/pipes/label/label.d.ts +5 -1
  62. package/dist/esm/pipeline/spec/chart/pipes/label/label.js +41 -33
  63. package/dist/esm/pipeline/spec/chart/pipes/label/label.js.map +1 -1
  64. package/dist/esm/pipeline/spec/chart/pipes/label/labelDualAxis.js +15 -52
  65. package/dist/esm/pipeline/spec/chart/pipes/label/labelDualAxis.js.map +1 -1
  66. package/dist/esm/pipeline/spec/chart/pipes/label/{labelColorInversion.d.ts → labelScatter.d.ts} +1 -1
  67. package/dist/esm/pipeline/spec/chart/pipes/label/labelScatter.js +19 -0
  68. package/dist/esm/pipeline/spec/chart/pipes/label/labelScatter.js.map +1 -0
  69. package/dist/esm/pipeline/spec/chart/pipes/series/series.js +1 -0
  70. package/dist/esm/pipeline/spec/chart/pipes/series/series.js.map +1 -1
  71. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.d.ts +3 -3
  72. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js +13 -30
  73. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js.map +1 -1
  74. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js +6 -6
  75. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js.map +1 -1
  76. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js +6 -18
  77. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js.map +1 -1
  78. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js +6 -18
  79. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js.map +1 -1
  80. package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.js +8 -11
  81. package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.js.map +1 -1
  82. package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.js +8 -13
  83. package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.js.map +1 -1
  84. package/dist/esm/pipeline/utils/constant.d.ts +1 -0
  85. package/dist/esm/pipeline/utils/constant.js +2 -1
  86. package/dist/esm/pipeline/utils/constant.js.map +1 -1
  87. package/dist/esm/pipeline/utils/format/createFormatter.d.ts +1 -1
  88. package/dist/esm/pipeline/utils/format/createFormatter.js +3 -2
  89. package/dist/esm/pipeline/utils/format/createFormatter.js.map +1 -1
  90. package/dist/esm/pipeline/utils/format/createFormatterByMeasure.d.ts +2 -0
  91. package/dist/esm/pipeline/utils/format/createFormatterByMeasure.js +14 -0
  92. package/dist/esm/pipeline/utils/format/createFormatterByMeasure.js.map +1 -0
  93. package/dist/esm/pipeline/utils/format/createNumFormatter.d.ts +1 -1
  94. package/dist/esm/pipeline/utils/format/createNumFormatter.js.map +1 -1
  95. package/dist/esm/pipeline/utils/format/index.d.ts +1 -0
  96. package/dist/esm/pipeline/utils/format/index.js +1 -0
  97. package/dist/esm/pipeline/utils/index.d.ts +1 -0
  98. package/dist/esm/pipeline/utils/index.js +1 -0
  99. package/dist/esm/pipeline/utils/valid/checkVSeed.d.ts +2 -0
  100. package/dist/esm/pipeline/utils/valid/checkVSeed.js +11 -0
  101. package/dist/esm/pipeline/utils/valid/checkVSeed.js.map +1 -0
  102. package/dist/esm/pipeline/utils/valid/index.d.ts +1 -0
  103. package/dist/esm/pipeline/utils/valid/index.js +2 -0
  104. package/dist/esm/theme/dark.js +5 -1
  105. package/dist/esm/theme/dark.js.map +1 -1
  106. package/dist/esm/theme/light.js +23 -4
  107. package/dist/esm/theme/light.js.map +1 -1
  108. package/dist/esm/types/advancedVSeed.d.ts +947 -17
  109. package/dist/esm/types/chartType/area/zArea.d.ts +60 -0
  110. package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +60 -0
  111. package/dist/esm/types/chartType/bar/zBar.d.ts +60 -0
  112. package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +60 -0
  113. package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +60 -0
  114. package/dist/esm/types/chartType/column/zColumn.d.ts +60 -0
  115. package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +60 -0
  116. package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +60 -0
  117. package/dist/esm/types/chartType/donut/zDonut.d.ts +30 -0
  118. package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +270 -0
  119. package/dist/esm/types/chartType/funnel/zFunnel.d.ts +30 -0
  120. package/dist/esm/types/chartType/heatmap/zHeatmap.d.ts +30 -0
  121. package/dist/esm/types/chartType/line/zLine.d.ts +60 -0
  122. package/dist/esm/types/chartType/pie/zPie.d.ts +30 -0
  123. package/dist/esm/types/chartType/pivotTable/zPivotTable.d.ts +30 -0
  124. package/dist/esm/types/chartType/radar/zRadar.d.ts +30 -0
  125. package/dist/esm/types/chartType/rose/zRose.d.ts +30 -0
  126. package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +30 -0
  127. package/dist/esm/types/chartType/scatter/zScatter.d.ts +210 -0
  128. package/dist/esm/types/chartType/table/zTable.d.ts +30 -0
  129. package/dist/esm/types/properties/config/axes/bandAxis.d.ts +146 -3
  130. package/dist/esm/types/properties/config/axes/index.d.ts +0 -2
  131. package/dist/esm/types/properties/config/axes/index.js +0 -1
  132. package/dist/esm/types/properties/config/axes/linearAxis.d.ts +149 -3
  133. package/dist/esm/types/properties/config/axes/zLinearAxis.d.ts +60 -0
  134. package/dist/esm/types/properties/config/axes/zLinearAxis.js +2 -0
  135. package/dist/esm/types/properties/config/axes/zLinearAxis.js.map +1 -1
  136. package/dist/esm/types/properties/config/config.d.ts +916 -16
  137. package/dist/esm/types/properties/config/label/label.d.ts +3 -3
  138. package/dist/esm/types/properties/config/label/zLabel.js +1 -1
  139. package/dist/esm/types/properties/config/label/zLabel.js.map +1 -1
  140. package/dist/esm/types/properties/format/numFormat.js.map +1 -0
  141. package/dist/esm/types/properties/index.d.ts +1 -0
  142. package/dist/esm/types/properties/index.js +1 -0
  143. package/dist/esm/types/properties/measures/index.d.ts +0 -1
  144. package/dist/esm/types/properties/measures/index.js +0 -1
  145. package/dist/esm/types/properties/measures/measures.d.ts +6 -2
  146. package/dist/esm/types/properties/measures/zDualMeasures.d.ts +240 -0
  147. package/dist/esm/types/properties/measures/zMeasures.d.ts +90 -0
  148. package/dist/esm/types/properties/measures/zMeasures.js +2 -1
  149. package/dist/esm/types/properties/measures/zMeasures.js.map +1 -1
  150. package/dist/esm/types/properties/measures/zScatterMeasures.d.ts +240 -0
  151. package/dist/esm/types/properties/theme/customTheme.d.ts +916 -16
  152. package/dist/esm/types/zVseed.d.ts +1389 -99
  153. package/dist/umd/index.js +308 -366
  154. package/dist/umd/index.js.map +1 -1
  155. package/package.json +1 -1
  156. package/dist/esm/pipeline/spec/chart/pipes/label/labelColorInversion.js +0 -13
  157. package/dist/esm/pipeline/spec/chart/pipes/label/labelColorInversion.js.map +0 -1
  158. package/dist/esm/types/properties/config/axes/axis.d.ts +0 -208
  159. package/dist/esm/types/properties/config/axes/axis.js +0 -0
  160. package/dist/esm/types/properties/config/axes/zAxis.d.ts +0 -47
  161. package/dist/esm/types/properties/config/axes/zAxis.js +0 -54
  162. package/dist/esm/types/properties/config/axes/zAxis.js.map +0 -1
  163. package/dist/esm/types/properties/measures/format/numFormat.js.map +0 -1
  164. /package/dist/esm/types/properties/{measures/format → format}/formatter.d.ts +0 -0
  165. /package/dist/esm/types/properties/{measures/format → format}/formatter.js +0 -0
  166. /package/dist/esm/types/properties/{measures/format → format}/index.d.ts +0 -0
  167. /package/dist/esm/types/properties/{measures/format → format}/index.js +0 -0
  168. /package/dist/esm/types/properties/{measures/format → format}/numFormat.d.ts +0 -0
  169. /package/dist/esm/types/properties/{measures/format → format}/numFormat.js +0 -0
package/dist/umd/index.js CHANGED
@@ -106,6 +106,7 @@
106
106
  columnAdvancedPipeline: ()=>columnAdvancedPipeline,
107
107
  zLabel: ()=>zLabel,
108
108
  registerColumn: ()=>registerColumn,
109
+ createFormatterByMeasure: ()=>createFormatterByMeasure,
109
110
  findAllMeasures: ()=>findAllMeasures,
110
111
  funnelSpecPipeline: ()=>funnelSpecPipeline,
111
112
  isDimensionSelector: ()=>isDimensionSelector,
@@ -147,8 +148,8 @@
147
148
  registerHeatmap: ()=>registerHeatmap,
148
149
  registerBarPercent: ()=>registerBarPercent,
149
150
  ColorIdEncoding: ()=>ColorIdEncoding,
151
+ checkVSeed: ()=>checkVSeed,
150
152
  roseSpecPipeline: ()=>roseSpecPipeline,
151
- zCrosshairLine: ()=>zCrosshairLine,
152
153
  registerLightTheme: ()=>registerLightTheme,
153
154
  roseAdvancedPipeline: ()=>roseAdvancedPipeline,
154
155
  zBarParallel: ()=>zBarParallel,
@@ -174,9 +175,9 @@
174
175
  isVChart: ()=>isVChart,
175
176
  radarSpecPipeline: ()=>radarSpecPipeline,
176
177
  Builder: ()=>Builder,
178
+ zCrosshairLine: ()=>zCrosshairLine,
177
179
  zMeasureTree: ()=>zMeasureTree,
178
180
  zPieConfig: ()=>zPieConfig,
179
- zPivotTable: ()=>zPivotTable,
180
181
  registerLine: ()=>registerLine,
181
182
  registerCustomTheme: ()=>registerCustomTheme,
182
183
  zColor: ()=>zColor,
@@ -193,9 +194,9 @@
193
194
  darkTheme: ()=>darkTheme,
194
195
  createNumFormatter: ()=>createNumFormatter,
195
196
  zAreaConfig: ()=>zAreaConfig,
196
- zAxis: ()=>zAxis,
197
- isVTable: ()=>isVTable,
198
197
  zMeasures: ()=>zMeasures,
198
+ isVTable: ()=>isVTable,
199
+ zPivotTable: ()=>zPivotTable,
199
200
  zRadar: ()=>zRadar,
200
201
  zLine: ()=>zLine,
201
202
  columnSpecPipeline: ()=>columnSpecPipeline,
@@ -337,7 +338,7 @@
337
338
  return advancedVSeed;
338
339
  } catch (e) {
339
340
  console.error(e);
340
- throw new Error("buildAdvanced error, see error info in console");
341
+ throw new Error(`buildAdvanced error: ${e.message}.\ndetails info in console`);
341
342
  } finally{
342
343
  const end = 'undefined' != typeof performance ? performance.now() : Date.now();
343
344
  builder.performance['buildAdvanced'] = `${(end - start).toFixed(4)}ms`;
@@ -346,9 +347,8 @@
346
347
  const buildSpec = (builder, advancedVSeed)=>{
347
348
  const start = 'undefined' != typeof performance ? performance.now() : Date.now();
348
349
  const { chartType } = builder.vseed;
349
- if (!chartType) throw new Error('chartType is nil in buildSpec');
350
350
  const pipeline = Builder.getSpecPipeline(chartType);
351
- if (!pipeline) throw new Error(`no spec pipeline for chartType ${chartType}`);
351
+ if (!pipeline) throw new Error(`please invoke registerAll or register ${chartType} before build, no spec pipeline for chartType ${chartType}`);
352
352
  const context = {
353
353
  vseed: builder.vseed,
354
354
  advancedVSeed
@@ -360,7 +360,7 @@
360
360
  return spec;
361
361
  } catch (e) {
362
362
  console.error(e);
363
- throw new Error("buildSpec error, see error info in console");
363
+ throw new Error(`buildSpec error: ${e.message}.\ndetails info in console`);
364
364
  } finally{
365
365
  const end = 'undefined' != typeof performance ? performance.now() : Date.now();
366
366
  builder.performance['buildSpec'] = `${(end - start).toFixed(4)}ms`;
@@ -638,27 +638,79 @@
638
638
  static _customSpecPipe = {};
639
639
  static _themeMap = {};
640
640
  }
641
+ function chunk_VCYTMP4D_n(e) {
642
+ return void 0 === e ? !0 : "string" == typeof e || Array.isArray(e) ? 0 === e.length : 0 === Object.keys(e).length;
643
+ }
644
+ const checkVSeed = (vseed)=>{
645
+ const { chartType, dataset, dimensions, measures } = vseed;
646
+ if (!chartType) throw new Error('chartType is required');
647
+ if (!dataset || chunk_VCYTMP4D_n(dataset)) throw new Error('dataset is required, and must be an array');
648
+ if (dimensions && !Array.isArray(dimensions)) throw new Error('dimensions must be an array');
649
+ if (measures && !Array.isArray(measures)) throw new Error('measures must be an array');
650
+ };
641
651
  const initAdvancedVSeed = (advancedVSeed, context)=>{
642
652
  const { vseed } = context;
643
653
  const { chartType, locale } = vseed;
654
+ checkVSeed(vseed);
644
655
  return {
645
656
  ...advancedVSeed,
646
657
  chartType,
647
658
  locale: locale || 'zh-CN'
648
659
  };
649
660
  };
661
+ function chunk_D6FCK2GA_u(o, n, a) {
662
+ let t = (r)=>o(r, ...n);
663
+ return void 0 === a ? t : Object.assign(t, {
664
+ lazy: a,
665
+ lazyArgs: n
666
+ });
667
+ }
668
+ function chunk_WIMGWYZL_u(r, n, o) {
669
+ let a = r.length - n.length;
670
+ if (0 === a) return r(...n);
671
+ if (1 === a) return chunk_D6FCK2GA_u(r, n, o);
672
+ throw new Error("Wrong number of arguments");
673
+ }
674
+ function chunk_BCBB46UE_d(...n) {
675
+ return chunk_WIMGWYZL_u(chunk_BCBB46UE_u, n);
676
+ }
677
+ function chunk_BCBB46UE_u(n, o = [], t = []) {
678
+ if ("function" == typeof n) return n;
679
+ if ("object" != typeof n || null === n) return structuredClone(n);
680
+ let r = Object.getPrototypeOf(n);
681
+ if (!Array.isArray(n) && null !== r && r !== Object.prototype) return structuredClone(n);
682
+ let e = o.indexOf(n);
683
+ return -1 !== e ? t[e] : (o.push(n), Array.isArray(n) ? chunk_BCBB46UE_p(n, o, t) : chunk_BCBB46UE_i(n, o, t));
684
+ }
685
+ function chunk_BCBB46UE_i(n, o, t) {
686
+ let r = {};
687
+ t.push(r);
688
+ for (let [e, c] of Object.entries(n))r[e] = chunk_BCBB46UE_u(c, o, t);
689
+ return r;
690
+ }
691
+ function chunk_BCBB46UE_p(n, o, t) {
692
+ let r = [];
693
+ t.push(r);
694
+ for (let [e, c] of n.entries())r[e] = chunk_BCBB46UE_u(c, o, t);
695
+ return r;
696
+ }
697
+ const isMeasure = (measure)=>!('children' in measure);
698
+ const isMeasureGroup = (measure)=>'children' in measure;
699
+ const isMeasures = (measures)=>measures.every(isMeasure);
650
700
  const defaultMeasures_defaultMeasures = (advancedVSeed, context)=>{
651
701
  const { vseed } = context;
652
702
  const { measures, dataset } = vseed;
653
- if (measures && measures.length > 0) return {
654
- ...advancedVSeed,
655
- measures
656
- };
657
- if (!dataset) throw new Error('dataset is required');
658
- if (0 === dataset.length) return {
659
- ...advancedVSeed,
660
- measures: []
661
- };
703
+ if (measures && measures.length > 0) {
704
+ const clonedMeasures = chunk_BCBB46UE_d(measures);
705
+ preorderTraverse(clonedMeasures, (node)=>{
706
+ if (isMeasure(node)) node.alias = node.alias || node.id;
707
+ return false;
708
+ });
709
+ return {
710
+ ...advancedVSeed,
711
+ measures: clonedMeasures
712
+ };
713
+ }
662
714
  const top100dataset = dataset.slice(0, 100);
663
715
  const sample = top100dataset.reduce((prev, cur)=>({
664
716
  ...prev,
@@ -677,6 +729,8 @@
677
729
  measures: defaultMeasures
678
730
  };
679
731
  };
732
+ const isDimension = (dimension)=>!('children' in dimension);
733
+ const isDimensionGroup = (dimension)=>'children' in dimension;
680
734
  const findMeasureById = (measures = [], id)=>{
681
735
  if (!measures) return;
682
736
  let result;
@@ -718,12 +772,17 @@
718
772
  };
719
773
  const { vseed } = context;
720
774
  const { dimensions, dataset } = vseed;
721
- if (dimensions && dimensions.length > 0) return {
722
- ...result,
723
- dimensions
724
- };
725
- if (!dataset) throw new Error('dataset is required');
726
- if (0 === dataset.length) return result;
775
+ if (dimensions && dimensions.length > 0) {
776
+ const clonedDimensions = chunk_BCBB46UE_d(dimensions);
777
+ preorderTraverse(clonedDimensions, (node)=>{
778
+ if (isDimension(node)) node.alias = node.alias || node.id;
779
+ return false;
780
+ });
781
+ return {
782
+ ...advancedVSeed,
783
+ dimensions: clonedDimensions
784
+ };
785
+ }
727
786
  const measures = findAllMeasures(advancedVSeed.measures);
728
787
  const top100dataset = dataset.slice(0, 100);
729
788
  const sample = top100dataset.reduce((prev, cur)=>({
@@ -751,19 +810,6 @@
751
810
  dataset
752
811
  };
753
812
  };
754
- function chunk_D6FCK2GA_u(o, n, a) {
755
- let t = (r)=>o(r, ...n);
756
- return void 0 === a ? t : Object.assign(t, {
757
- lazy: a,
758
- lazyArgs: n
759
- });
760
- }
761
- function chunk_WIMGWYZL_u(r, n, o) {
762
- let a = r.length - n.length;
763
- if (0 === a) return r(...n);
764
- if (1 === a) return chunk_D6FCK2GA_u(r, n, o);
765
- throw new Error("Wrong number of arguments");
766
- }
767
813
  function chunk_2T7K3PFL_i(...e) {
768
814
  return chunk_WIMGWYZL_u(chunk_2T7K3PFL_o, e);
769
815
  }
@@ -821,29 +867,6 @@
821
867
  }
822
868
  return r;
823
869
  }
824
- function chunk_BCBB46UE_d(...n) {
825
- return chunk_WIMGWYZL_u(chunk_BCBB46UE_u, n);
826
- }
827
- function chunk_BCBB46UE_u(n, o = [], t = []) {
828
- if ("function" == typeof n) return n;
829
- if ("object" != typeof n || null === n) return structuredClone(n);
830
- let r = Object.getPrototypeOf(n);
831
- if (!Array.isArray(n) && null !== r && r !== Object.prototype) return structuredClone(n);
832
- let e = o.indexOf(n);
833
- return -1 !== e ? t[e] : (o.push(n), Array.isArray(n) ? chunk_BCBB46UE_p(n, o, t) : chunk_BCBB46UE_i(n, o, t));
834
- }
835
- function chunk_BCBB46UE_i(n, o, t) {
836
- let r = {};
837
- t.push(r);
838
- for (let [e, c] of Object.entries(n))r[e] = chunk_BCBB46UE_u(c, o, t);
839
- return r;
840
- }
841
- function chunk_BCBB46UE_p(n, o, t) {
842
- let r = [];
843
- t.push(r);
844
- for (let [e, c] of n.entries())r[e] = chunk_BCBB46UE_u(c, o, t);
845
- return r;
846
- }
847
870
  function chunk_SFZGYJFI_t(r) {
848
871
  return "string" == typeof r;
849
872
  }
@@ -931,9 +954,6 @@
931
954
  }
932
955
  };
933
956
  };
934
- const isMeasure = (measure)=>!('children' in measure);
935
- const isMeasureGroup = (measure)=>'children' in measure;
936
- const isMeasures = (measures)=>measures.every(isMeasure);
937
957
  const dimensionTreeToColumns = (spec, context)=>{
938
958
  const { advancedVSeed } = context;
939
959
  const dimensions = advancedVSeed.dimensions;
@@ -982,9 +1002,6 @@
982
1002
  });
983
1003
  return result || [];
984
1004
  };
985
- function chunk_VCYTMP4D_n(e) {
986
- return void 0 === e ? !0 : "string" == typeof e || Array.isArray(e) ? 0 === e.length : 0 === Object.keys(e).length;
987
- }
988
1005
  const createNumFormatter = (format, locale = intl.getLocale())=>{
989
1006
  const { type = 'number', ratio = 1, symbol = '', thousandSeparator = true, prefix = '', suffix = '', fractionDigits = 2, significantDigits, roundingMode = 'halfExpand', roundingPriority = 'auto' } = format || {};
990
1007
  const numFormatterOptions = {
@@ -1041,11 +1058,19 @@
1041
1058
  });
1042
1059
  return numFormatter.format(Number(value));
1043
1060
  };
1044
- const createFormatter = (format)=>createNumFormatter(format);
1045
- const autoFormatter = (value, locale)=>autoNumFormatter(value, locale);
1061
+ const createFormatter = (format, locale)=>createNumFormatter(format, locale);
1062
+ const autoFormatter = (value, locale = intl.getLocale())=>autoNumFormatter(value, locale);
1063
+ const createFormatterByMeasure = (measure)=>{
1064
+ if (!measure) return (v)=>String(v);
1065
+ const { numFormat, format, autoFormat } = measure;
1066
+ const formatterFormat = numFormat || format || {};
1067
+ if (true === autoFormat) return autoFormatter;
1068
+ if (chunk_JK3VNB42_n(autoFormat) && chunk_VCYTMP4D_n(formatterFormat)) return autoFormatter;
1069
+ if (!chunk_VCYTMP4D_n(formatterFormat)) return createFormatter(formatterFormat);
1070
+ return (v)=>String(v);
1071
+ };
1046
1072
  const measureTreeToColumns = (spec, context)=>{
1047
1073
  const { advancedVSeed } = context;
1048
- const { locale } = advancedVSeed;
1049
1074
  const measures = advancedVSeed.measures;
1050
1075
  const result = {
1051
1076
  ...spec
@@ -1053,7 +1078,7 @@
1053
1078
  const eachNode = (node)=>{
1054
1079
  if (isMeasure(node)) return {
1055
1080
  width: 'auto',
1056
- fieldFormat: fieldFormat(node, locale)
1081
+ fieldFormat: fieldFormat(node)
1057
1082
  };
1058
1083
  return {};
1059
1084
  };
@@ -1066,15 +1091,14 @@
1066
1091
  ]
1067
1092
  };
1068
1093
  };
1069
- const fieldFormat = (node, locale)=>(datum)=>{
1070
- const { format = {}, autoFormat = true, id } = node;
1094
+ const fieldFormat = (node)=>{
1095
+ const formatter = createFormatterByMeasure(node);
1096
+ return (datum)=>{
1097
+ const { id } = node;
1071
1098
  const value = datum[id];
1072
- if (!chunk_VCYTMP4D_n(format)) {
1073
- const formatter = createFormatter(format);
1074
- return formatter(value);
1075
- }
1076
- if (autoFormat) return autoFormatter(value, locale);
1099
+ return formatter(value);
1077
1100
  };
1101
+ };
1078
1102
  const measuresToColumns_treeTreeToColumns = (tree, callback)=>{
1079
1103
  const result = tree.map((item)=>{
1080
1104
  if ('children' in item && Array.isArray(item.children)) {
@@ -1331,7 +1355,7 @@
1331
1355
  return o;
1332
1356
  }
1333
1357
  const foldMeasures = (dataset, measures, options)=>{
1334
- const { measureId, measureName, measureValue, colorMeasureId } = options || {};
1358
+ const { measureId, measureName, measureValue, colorMeasureId, allowEmptyFold = true } = options || {};
1335
1359
  const foldInfo = {
1336
1360
  measureId,
1337
1361
  measureName,
@@ -1346,6 +1370,10 @@
1346
1370
  },
1347
1371
  foldMap: {}
1348
1372
  };
1373
+ if (!allowEmptyFold && 0 === measures.length) return {
1374
+ dataset,
1375
+ foldInfo
1376
+ };
1349
1377
  const result = new Array(dataset.length * measures.length);
1350
1378
  let index = 0;
1351
1379
  const ids = measures.map((d)=>d.id);
@@ -1391,7 +1419,8 @@
1391
1419
  const { dataset: newDatasets, foldInfo } = foldMeasures(dataset, findAllMeasures(measures), {
1392
1420
  measureId: FoldMeasureId,
1393
1421
  measureName: FoldMeasureName,
1394
- measureValue: FoldMeasureValue
1422
+ measureValue: FoldMeasureValue,
1423
+ allowEmptyFold: false
1395
1424
  });
1396
1425
  const datasetReshapeInfo = [
1397
1426
  {
@@ -1515,7 +1544,7 @@
1515
1544
  };
1516
1545
  const pivotIndicators = (spec, context)=>{
1517
1546
  const { advancedVSeed } = context;
1518
- const { locale, measures, datasetReshapeInfo } = advancedVSeed;
1547
+ const { measures, datasetReshapeInfo } = advancedVSeed;
1519
1548
  const { foldInfo } = datasetReshapeInfo[0];
1520
1549
  return {
1521
1550
  ...spec,
@@ -1528,25 +1557,20 @@
1528
1557
  indicatorKey: foldInfo.measureValue,
1529
1558
  title: 'indicator',
1530
1559
  width: 'auto',
1531
- format: pivotIndicators_fieldFormat(measures, foldInfo, locale)
1560
+ format: pivotIndicators_fieldFormat(measures, foldInfo)
1532
1561
  }
1533
1562
  ]
1534
1563
  };
1535
1564
  };
1536
- const pivotIndicators_fieldFormat = (measures, foldInfo, locale)=>(value, col, row, table)=>{
1565
+ const pivotIndicators_fieldFormat = (measures, foldInfo)=>(value, col, row, table)=>{
1537
1566
  if (!chunk_6GTAPB47_e(col) || !chunk_6GTAPB47_e(row) || !table) return value;
1538
1567
  const datum = table.getCellOriginRecord(col, row);
1539
1568
  if (!datum[0]) return value;
1540
1569
  const { measureId: foldMeasureId } = foldInfo;
1541
1570
  const measureId = datum[0][foldMeasureId];
1542
- const node = findMeasureById(measures, measureId);
1543
- if (!node) return value;
1544
- const { format = {}, autoFormat = true } = node;
1545
- if (!chunk_VCYTMP4D_n(format)) {
1546
- const formatter = createFormatter(format);
1547
- return formatter(value);
1548
- }
1549
- if (autoFormat) return autoFormatter(value, locale);
1571
+ const measure = findMeasureById(measures, measureId);
1572
+ const formatter = createFormatterByMeasure(measure);
1573
+ return formatter(value);
1550
1574
  };
1551
1575
  const rowHeaderStyle = (spec, context)=>{
1552
1576
  const result = {
@@ -1690,6 +1714,7 @@
1690
1714
  const initAdvancedVSeed_initAdvancedVSeed = (advancedVSeed, context)=>{
1691
1715
  const { vseed } = context;
1692
1716
  const { chartType, locale } = vseed;
1717
+ checkVSeed(vseed);
1693
1718
  return {
1694
1719
  ...advancedVSeed,
1695
1720
  chartType,
@@ -1699,15 +1724,17 @@
1699
1724
  const default_defaultMeasures_defaultMeasures = (advancedVSeed, context)=>{
1700
1725
  const { vseed } = context;
1701
1726
  const { measures, dataset } = vseed;
1702
- if (measures && measures.length > 0) return {
1703
- ...advancedVSeed,
1704
- measures: chunk_BCBB46UE_d(measures)
1705
- };
1706
- if (!dataset) throw new Error('dataset is required');
1707
- if (0 === dataset.length) return {
1708
- ...advancedVSeed,
1709
- measures: []
1710
- };
1727
+ if (measures && measures.length > 0) {
1728
+ const clonedMeasures = chunk_BCBB46UE_d(measures);
1729
+ preorderTraverse(clonedMeasures, (node)=>{
1730
+ if (isMeasure(node)) node.alias = node.alias || node.id;
1731
+ return false;
1732
+ });
1733
+ return {
1734
+ ...advancedVSeed,
1735
+ measures: clonedMeasures
1736
+ };
1737
+ }
1711
1738
  const top100dataset = dataset.slice(0, 100);
1712
1739
  const sample = top100dataset.reduce((prev, cur)=>({
1713
1740
  ...prev,
@@ -1734,10 +1761,11 @@
1734
1761
  const { dimensions, dataset } = vseed;
1735
1762
  if (dimensions && dimensions.length > 0) return {
1736
1763
  ...result,
1737
- dimensions: chunk_BCBB46UE_d(dimensions)
1764
+ dimensions: chunk_BCBB46UE_d(dimensions.map((dim)=>({
1765
+ ...dim,
1766
+ alias: dim.alias || dim.id
1767
+ })))
1738
1768
  };
1739
- if (!dataset) throw new Error('dataset is required');
1740
- if (0 === dataset.length) return result;
1741
1769
  const measures = findAllMeasures(advancedVSeed.measures);
1742
1770
  const top100dataset = dataset.slice(0, 100);
1743
1771
  const sample = top100dataset.reduce((prev, cur)=>({
@@ -1943,8 +1971,6 @@
1943
1971
  measures: measureTree
1944
1972
  };
1945
1973
  };
1946
- const isDimension = (dimension)=>!('children' in dimension);
1947
- const isDimensionGroup = (dimension)=>'children' in dimension;
1948
1974
  const deleteDimensionTreeByCallback = (dimensionTree, callback)=>{
1949
1975
  if (!dimensionTree) return dimensionTree;
1950
1976
  const stack = [
@@ -2100,12 +2126,9 @@
2100
2126
  };
2101
2127
  const { vseed } = context;
2102
2128
  const { dataset, chartType } = vseed;
2103
- const { dimensions, measures, encoding } = advancedVSeed;
2104
- if (!measures || !dimensions || !dataset || !encoding) return result;
2105
- if (0 === measures.length) throw new Error('measures can not be empty');
2106
- const hasEncoding = (vseed.dimensions || []).some((item)=>item.encoding);
2129
+ const { dimensions = [], measures = [], encoding } = advancedVSeed;
2107
2130
  const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, T(dimensions, (item)=>item.id), T(findAllMeasures(measures), (item)=>item.id), encoding, {
2108
- colorItemAsId: hasEncoding,
2131
+ colorItemAsId: false,
2109
2132
  colorMeasureId: getColorMeasureId(advancedVSeed)
2110
2133
  });
2111
2134
  return {
@@ -2129,14 +2152,11 @@
2129
2152
  };
2130
2153
  const { vseed } = context;
2131
2154
  const { dataset } = vseed;
2132
- const { dimensions, measures, encoding } = advancedVSeed;
2133
- if (!measures || !dimensions || !dataset || !encoding) return result;
2134
- if (0 === measures.length) throw new Error('measures can not be empty');
2155
+ const { dimensions = [], measures = [], encoding } = advancedVSeed;
2135
2156
  const measureGroups = [];
2136
2157
  if (measures) measures.forEach((measure)=>{
2137
2158
  if (measure.children && measure.children.length > 0) measureGroups.push(measure);
2138
2159
  });
2139
- const hasEncoding = (vseed.dimensions || []).some((item)=>item.encoding);
2140
2160
  const datasets = [];
2141
2161
  const datasetReshapeInfo = [];
2142
2162
  measureGroups.forEach((measureGroup, index)=>{
@@ -2144,7 +2164,7 @@
2144
2164
  if (!measures) return;
2145
2165
  const groupId = measureGroup.id;
2146
2166
  const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, T(dimensions, (item)=>item.id), T(measures, (item)=>item.id), encoding, {
2147
- colorItemAsId: hasEncoding,
2167
+ colorItemAsId: false,
2148
2168
  foldMeasureValue: `${FoldMeasureValue}${groupId}`,
2149
2169
  colorMeasureId: getColorMeasureId(advancedVSeed)
2150
2170
  });
@@ -2573,12 +2593,23 @@
2573
2593
  result.progressiveThreshold = 8000;
2574
2594
  return result;
2575
2595
  };
2596
+ const defaultTitleText = (measures, dimensions, idList = [])=>{
2597
+ const allMeasures = findAllMeasures(measures);
2598
+ return idList.map((id)=>{
2599
+ const alias = [
2600
+ ...allMeasures,
2601
+ ...dimensions
2602
+ ].find((f)=>f.id === id)?.alias || '';
2603
+ return alias;
2604
+ }).join(' & ');
2605
+ };
2576
2606
  const xBand = (spec, context)=>{
2577
2607
  const result = {
2578
2608
  ...spec
2579
2609
  };
2580
2610
  const { advancedVSeed, vseed } = context;
2581
2611
  const { chartType } = vseed;
2612
+ const { measures, dimensions, encoding } = advancedVSeed;
2582
2613
  const config = advancedVSeed.config?.[chartType]?.xAxis;
2583
2614
  if (!result.axes) result.axes = [];
2584
2615
  if (!config) {
@@ -2623,7 +2654,7 @@
2623
2654
  },
2624
2655
  title: {
2625
2656
  visible: title?.visible,
2626
- text: title?.titleText,
2657
+ text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x),
2627
2658
  style: {
2628
2659
  fill: title?.titleColor,
2629
2660
  fontSize: title?.titleFontSize,
@@ -2667,13 +2698,19 @@
2667
2698
  ];
2668
2699
  return result;
2669
2700
  };
2701
+ const createLinearFormat = (value, autoFormat, numFormat, formatter)=>{
2702
+ if (chunk_JK3VNB42_n(autoFormat) && chunk_VCYTMP4D_n(numFormat)) return autoFormatter(value);
2703
+ if (true === autoFormat) return autoFormatter(value);
2704
+ if (!chunk_VCYTMP4D_n(numFormat)) return formatter(value);
2705
+ return String(value);
2706
+ };
2670
2707
  const yLinear = (spec, context)=>{
2671
2708
  const result = {
2672
2709
  ...spec
2673
2710
  };
2674
2711
  const { advancedVSeed, vseed } = context;
2675
2712
  const { chartType } = vseed;
2676
- const { locale } = advancedVSeed;
2713
+ const { measures, dimensions, encoding } = advancedVSeed;
2677
2714
  const config = advancedVSeed.config?.[chartType]?.yAxis;
2678
2715
  if (!result.axes) result.axes = [];
2679
2716
  if (!config) {
@@ -2687,7 +2724,8 @@
2687
2724
  ];
2688
2725
  return result;
2689
2726
  }
2690
- const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
2727
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = config;
2728
+ const formatter = createNumFormatter(numFormat);
2691
2729
  const linearAxis = {
2692
2730
  visible,
2693
2731
  type: log ? 'log' : 'linear',
@@ -2700,7 +2738,7 @@
2700
2738
  min,
2701
2739
  label: {
2702
2740
  visible: label?.visible,
2703
- formatMethod: (value)=>autoFormatter(value, locale),
2741
+ formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
2704
2742
  style: {
2705
2743
  fill: label?.labelColor,
2706
2744
  angle: label?.labelAngle,
@@ -2710,7 +2748,7 @@
2710
2748
  },
2711
2749
  title: {
2712
2750
  visible: title?.visible,
2713
- text: title?.titleText,
2751
+ text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y),
2714
2752
  style: {
2715
2753
  fill: title?.titleColor,
2716
2754
  fontSize: title?.titleFontSize,
@@ -3278,31 +3316,58 @@
3278
3316
  ...spec
3279
3317
  };
3280
3318
  const { advancedVSeed, vseed } = context;
3281
- const { measures, datasetReshapeInfo } = advancedVSeed;
3319
+ const { datasetReshapeInfo } = advancedVSeed;
3282
3320
  const { chartType, encoding } = advancedVSeed;
3283
3321
  const baseConfig = advancedVSeed.config[chartType];
3322
+ const foldInfo = datasetReshapeInfo[0].foldInfo;
3284
3323
  if (!baseConfig || chunk_VCYTMP4D_n(baseConfig.label)) return result;
3285
- const { measureId, measureValue, statistics } = datasetReshapeInfo[0].foldInfo;
3286
3324
  const { label } = baseConfig;
3287
- const { enable, wrap, showValue, showValuePercent, labelOverlap, labelColorSmartInvert, labelColor, labelFontSize, labelFontWeight, labelBackgroundColor, labelPosition, autoFormat = true, numFormat = {} } = label;
3288
- const labelDims = T((vseed.dimensions || []).filter((item)=>encoding.label?.includes(item.id)), (item)=>item.id);
3289
- const labelMeas = T((vseed.measures || []).filter((item)=>encoding.label?.includes(item.id)), (item)=>item.id);
3325
+ result.label = buildLabel(label, vseed.measures, vseed.dimensions, advancedVSeed.measures, encoding, [
3326
+ foldInfo
3327
+ ]);
3328
+ return result;
3329
+ };
3330
+ const generateMeasureValue = (value, measure, labelAutoFormat, numFormat = {})=>{
3331
+ if (!measure) return value;
3332
+ const format = chunk_5S4PYKVY_t(numFormat, measure.numFormat || measure.format);
3333
+ const mergedMeasure = {
3334
+ ...measure,
3335
+ numFormat: format,
3336
+ autoFormat: labelAutoFormat || measure.autoFormat
3337
+ };
3338
+ const formatter = createFormatterByMeasure(mergedMeasure);
3339
+ return formatter(value);
3340
+ };
3341
+ const generateMeasurePercent = (value, sum, formatter)=>{
3342
+ if (null == value) return String(value);
3343
+ const num = Number(value);
3344
+ if (Number.isNaN(num)) return String(value);
3345
+ const percentValue = num / sum;
3346
+ return formatter(percentValue);
3347
+ };
3348
+ const buildLabel = (label, vseedMeasures = [], vseedDimensions = [], advancedVSeedMeasures, encoding, foldInfoList)=>{
3349
+ const { enable, wrap, showValue, showValuePercent, labelOverlap, labelColorSmartInvert, labelColor, labelFontSize, labelFontWeight, labelBackgroundColor, labelPosition, autoFormat, numFormat = {} } = label;
3350
+ const labelDims = T((vseedDimensions || []).filter((item)=>encoding.label?.includes(item.id)), (item)=>item.id);
3351
+ const labelMeas = T((vseedMeasures || []).filter((item)=>encoding.label?.includes(item.id)), (item)=>item.id);
3290
3352
  const percentFormat = chunk_5S4PYKVY_t(numFormat, {
3291
3353
  type: 'percent'
3292
3354
  });
3293
3355
  const percentFormatter = createFormatter(percentFormat);
3294
- result.label = {
3356
+ const result = {
3295
3357
  visible: enable,
3296
3358
  formatMethod: (_, datum)=>{
3297
3359
  const result = [];
3298
3360
  const dimLabels = labelDims.map((item)=>item.alias || item.id);
3299
3361
  const meaLabels = labelMeas.map((item)=>generateMeasureValue(datum[item.id], item, autoFormat, numFormat));
3300
- const measure = findMeasureById(measures, datum[measureId]);
3301
- const measureValueLabel = generateMeasureValue(datum[measureValue], measure, autoFormat, numFormat);
3302
- const measurePercentLabel = generateMeasurePercent(datum[measureValue], statistics.sum, percentFormatter);
3303
3362
  result.push(...dimLabels);
3304
- if (showValue) result.push(measureValueLabel);
3305
- if (showValuePercent) result.push(measurePercentLabel);
3363
+ foldInfoList.forEach((foldInfo)=>{
3364
+ const { measureId, measureValue, statistics } = foldInfo;
3365
+ const measure = findMeasureById(advancedVSeedMeasures, datum[measureId]);
3366
+ const measureValueLabel = generateMeasureValue(datum[measureValue], measure, autoFormat, numFormat);
3367
+ const measurePercentLabel = generateMeasurePercent(datum[measureValue], statistics.sum, percentFormatter);
3368
+ if (showValue) result.push(measureValueLabel);
3369
+ if (showValuePercent) result.push(measurePercentLabel);
3370
+ });
3306
3371
  result.push(...meaLabels);
3307
3372
  if (wrap) return result;
3308
3373
  return result.join(' ');
@@ -3316,36 +3381,18 @@
3316
3381
  },
3317
3382
  smartInvert: labelColorSmartInvert
3318
3383
  };
3319
- if (labelOverlap) result.label.overlap = {
3384
+ if (labelOverlap) result.overlap = {
3320
3385
  hideOnHit: true,
3321
3386
  clampForce: true
3322
3387
  };
3323
3388
  return result;
3324
3389
  };
3325
- const generateMeasureValue = (value, measure, labelAutoFormat = true, numFormat = {})=>{
3326
- if (!measure) return value;
3327
- const format = chunk_5S4PYKVY_t(numFormat, measure.format);
3328
- const autoFormat = labelAutoFormat || measure.autoFormat;
3329
- if (!chunk_VCYTMP4D_n(format)) {
3330
- const formatter = createFormatter(format);
3331
- return formatter(value);
3332
- }
3333
- if (autoFormat) return autoFormatter(value, intl.getLocale());
3334
- return String(value);
3335
- };
3336
- const generateMeasurePercent = (value, sum, formatter)=>{
3337
- if (null == value) return String(value);
3338
- const num = Number(value);
3339
- if (Number.isNaN(num)) return String(value);
3340
- const percentValue = num / sum;
3341
- return formatter(percentValue);
3342
- };
3343
3390
  const tooltip_tooltip = (spec, context)=>{
3344
3391
  const result = {
3345
3392
  ...spec
3346
3393
  };
3347
3394
  const { advancedVSeed, vseed } = context;
3348
- const { measures, datasetReshapeInfo, chartType, locale, dimensions, encoding } = advancedVSeed;
3395
+ const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed;
3349
3396
  const baseConfig = advancedVSeed.config[chartType];
3350
3397
  const { tooltip = {
3351
3398
  enable: true
@@ -3358,18 +3405,18 @@
3358
3405
  title: {
3359
3406
  visible: false
3360
3407
  },
3361
- content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), locale, foldInfo, unfoldInfo)
3408
+ content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), foldInfo, unfoldInfo)
3362
3409
  },
3363
3410
  dimension: {
3364
3411
  title: {
3365
3412
  visible: true
3366
3413
  },
3367
- content: createDimensionContent(measures, foldInfo, unfoldInfo, locale)
3414
+ content: createDimensionContent(measures, foldInfo, unfoldInfo)
3368
3415
  }
3369
3416
  };
3370
3417
  return result;
3371
3418
  };
3372
- const createDimensionContent = (measures, foldInfo, unfoldInfo, locale)=>{
3419
+ const createDimensionContent = (measures, foldInfo, unfoldInfo)=>{
3373
3420
  const { measureId, measureValue } = foldInfo;
3374
3421
  const { encodingColor } = unfoldInfo;
3375
3422
  return [
@@ -3387,19 +3434,13 @@
3387
3434
  const value = datum[measureValue];
3388
3435
  const id = datum[measureId];
3389
3436
  const measure = findMeasureById(measures, id);
3390
- if (!measure) return String(value);
3391
- const { format = {}, autoFormat = true } = measure;
3392
- if (!chunk_VCYTMP4D_n(format)) {
3393
- const formatter = createFormatter(format);
3394
- return formatter(value);
3395
- }
3396
- if (autoFormat) return autoFormatter(value, locale);
3397
- return String(value);
3437
+ const formatter = createFormatterByMeasure(measure);
3438
+ return formatter(value);
3398
3439
  }
3399
3440
  }
3400
3441
  ];
3401
3442
  };
3402
- const createMarkContent = (tooltip, dimensions, measures, locale, foldInfo, unfoldInfo)=>{
3443
+ const createMarkContent = (tooltip, dimensions, measures, foldInfo, unfoldInfo)=>{
3403
3444
  const dims = C(dimensions.filter((item)=>tooltip.includes(item.id)), T((item)=>item.id), T((item)=>item.alias));
3404
3445
  const meas = C(measures.filter((item)=>tooltip.includes(item.id)), T((item)=>item.id), T((item)=>item.alias));
3405
3446
  const dimContent = dims.map((item)=>({
@@ -3429,14 +3470,8 @@
3429
3470
  const originalData = datum[ORIGINAL_DATA];
3430
3471
  const value = originalData[id];
3431
3472
  const measure = findMeasureById(measures, id);
3432
- if (!measure) return String(value);
3433
- const { format = {}, autoFormat = true } = measure;
3434
- if (!chunk_VCYTMP4D_n(format)) {
3435
- const formatter = createFormatter(format);
3436
- return formatter(value);
3437
- }
3438
- if (autoFormat) return autoFormatter(value, locale);
3439
- return String(value);
3473
+ const formatter = createFormatterByMeasure(measure);
3474
+ return formatter(value);
3440
3475
  }
3441
3476
  }));
3442
3477
  const defaultContent = {
@@ -3457,13 +3492,8 @@
3457
3492
  const id = datum[measureId];
3458
3493
  const measure = findMeasureById(measures, id);
3459
3494
  if (!measure) return String(value);
3460
- const { format = {}, autoFormat = true } = measure;
3461
- if (!chunk_VCYTMP4D_n(format)) {
3462
- const formatter = createFormatter(format);
3463
- return formatter(value);
3464
- }
3465
- if (autoFormat) return autoFormatter(value, locale);
3466
- return String(value);
3495
+ const formatter = createFormatterByMeasure(measure);
3496
+ return formatter(value);
3467
3497
  }
3468
3498
  };
3469
3499
  return [
@@ -5198,8 +5228,8 @@
5198
5228
  ...spec
5199
5229
  };
5200
5230
  const { advancedVSeed, vseed } = context;
5231
+ const { encoding, dimensions, measures } = advancedVSeed;
5201
5232
  const { chartType } = vseed;
5202
- const { locale } = advancedVSeed;
5203
5233
  const config = advancedVSeed.config?.[chartType]?.xAxis;
5204
5234
  if (!result.axes) result.axes = [];
5205
5235
  if (!config) {
@@ -5213,7 +5243,8 @@
5213
5243
  ];
5214
5244
  return result;
5215
5245
  }
5216
- const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
5246
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = config;
5247
+ const formatter = createNumFormatter(numFormat);
5217
5248
  const linearAxis = {
5218
5249
  visible,
5219
5250
  type: log ? 'log' : 'linear',
@@ -5226,7 +5257,7 @@
5226
5257
  min,
5227
5258
  label: {
5228
5259
  visible: label?.visible,
5229
- formatMethod: (value)=>autoFormatter(value, locale),
5260
+ formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
5230
5261
  style: {
5231
5262
  fill: label?.labelColor,
5232
5263
  angle: label?.labelAngle,
@@ -5236,7 +5267,7 @@
5236
5267
  },
5237
5268
  title: {
5238
5269
  visible: title?.visible,
5239
- text: title?.titleText,
5270
+ text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x),
5240
5271
  style: {
5241
5272
  fill: title?.titleColor,
5242
5273
  fontSize: title?.titleFontSize,
@@ -5281,6 +5312,7 @@
5281
5312
  };
5282
5313
  const { advancedVSeed, vseed } = context;
5283
5314
  const { chartType } = vseed;
5315
+ const { measures, dimensions, encoding } = advancedVSeed;
5284
5316
  const config = advancedVSeed.config?.[chartType]?.yAxis;
5285
5317
  if (!result.axes) result.axes = [];
5286
5318
  if (!config) {
@@ -5326,7 +5358,7 @@
5326
5358
  },
5327
5359
  title: {
5328
5360
  visible: title?.visible,
5329
- text: title?.titleText,
5361
+ text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y),
5330
5362
  style: {
5331
5363
  fill: title?.titleColor,
5332
5364
  fontSize: title?.titleFontSize,
@@ -6074,10 +6106,8 @@
6074
6106
  };
6075
6107
  const { vseed } = context;
6076
6108
  const { dataset } = vseed;
6077
- const { dimensions, measures, encoding, chartType } = advancedVSeed;
6078
- if (!measures || !dimensions || !dataset || !encoding) return result;
6079
- if (0 === measures.length) throw new Error('measures can not be empty');
6080
- if (measures.length > 2) throw new Error('measures can not be more than 2');
6109
+ const { dimensions = [], measures = [], encoding, chartType } = advancedVSeed;
6110
+ if (measures.length > 2) throw new Error('measures can not be more than 2 groups in scatter');
6081
6111
  const foldInfoList = [];
6082
6112
  const unfoldInfoList = [];
6083
6113
  const datasets = [];
@@ -6133,8 +6163,7 @@
6133
6163
  };
6134
6164
  const { vseed } = context;
6135
6165
  const { dataset } = vseed;
6136
- const { dimensions, measures, encoding, chartType } = advancedVSeed;
6137
- if (!measures || !dimensions || !dataset || !encoding) return result;
6166
+ const { dimensions = [], measures = [], encoding, chartType } = advancedVSeed;
6138
6167
  const measureGroups = [];
6139
6168
  const depth = measureDepth(measures);
6140
6169
  if (3 === depth) measures.forEach((measure)=>{
@@ -6144,8 +6173,7 @@
6144
6173
  const datasetList = [];
6145
6174
  const datasetReshapeInfo = [];
6146
6175
  measureGroups.forEach((measures, index)=>{
6147
- if (0 === measures.length) throw new Error('measures can not be empty');
6148
- if (measures.length > 2) throw new Error('measures can not be more than 2');
6176
+ if (measures.length > 2) throw new Error('measures can not be more than 2 groups in scatter');
6149
6177
  const foldInfoList = [];
6150
6178
  const unfoldInfoList = [];
6151
6179
  const datasets = [];
@@ -6257,6 +6285,20 @@
6257
6285
  }
6258
6286
  };
6259
6287
  };
6288
+ const labelScatter = (spec, context)=>{
6289
+ const result = {
6290
+ ...spec
6291
+ };
6292
+ const { advancedVSeed, vseed } = context;
6293
+ const { datasetReshapeInfo } = advancedVSeed;
6294
+ const { chartType, encoding } = advancedVSeed;
6295
+ const baseConfig = advancedVSeed.config[chartType];
6296
+ if (!baseConfig || chunk_VCYTMP4D_n(baseConfig.label)) return result;
6297
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6298
+ const { label } = baseConfig;
6299
+ result.label = buildLabel(label, vseed.measures, vseed.dimensions, advancedVSeed.measures, encoding, foldInfoList);
6300
+ return result;
6301
+ };
6260
6302
  const tooltipScatter = (spec, context)=>{
6261
6303
  const result = {
6262
6304
  ...spec
@@ -6313,14 +6355,8 @@
6313
6355
  const originalData = datum[ORIGINAL_DATA];
6314
6356
  const value = originalData[id];
6315
6357
  const measure = findMeasureById(measures, id);
6316
- if (!measure) return String(value);
6317
- const { format = {}, autoFormat = true } = measure;
6318
- if (!chunk_VCYTMP4D_n(format)) {
6319
- const formatter = createFormatter(format);
6320
- return formatter(value);
6321
- }
6322
- if (autoFormat) return autoFormatter(value, locale);
6323
- return String(value);
6358
+ const formatter = createFormatterByMeasure(measure);
6359
+ return formatter(value);
6324
6360
  }
6325
6361
  }));
6326
6362
  const foldMeaContent = foldInfoList.map((foldInfo)=>({
@@ -6340,14 +6376,8 @@
6340
6376
  const value = datum[measureValue];
6341
6377
  const id = datum[measureId];
6342
6378
  const measure = findMeasureById(measures, id);
6343
- if (!measure) return String(value);
6344
- const { format = {}, autoFormat = true } = measure;
6345
- if (!chunk_VCYTMP4D_n(format)) {
6346
- const formatter = createFormatter(format);
6347
- return formatter(value);
6348
- }
6349
- if (autoFormat) return autoFormatter(value, locale);
6350
- return String(value);
6379
+ const formatter = createFormatterByMeasure(measure);
6380
+ return formatter(value);
6351
6381
  }
6352
6382
  }));
6353
6383
  return [
@@ -6408,7 +6438,7 @@
6408
6438
  progressive,
6409
6439
  xLinear,
6410
6440
  yLinear,
6411
- label_label,
6441
+ labelScatter,
6412
6442
  tooltipScatter,
6413
6443
  colorAdapter(discreteLegend, colorLegend),
6414
6444
  verticalCrosshairLine,
@@ -6433,7 +6463,7 @@
6433
6463
  progressive,
6434
6464
  xLinear,
6435
6465
  yLinear,
6436
- label_label,
6466
+ labelScatter,
6437
6467
  tooltipScatter,
6438
6468
  verticalCrosshairLine,
6439
6469
  horizontalCrosshairLine,
@@ -6626,19 +6656,16 @@
6626
6656
  };
6627
6657
  const { vseed } = context;
6628
6658
  const { dataset } = vseed;
6629
- const { dimensions, measures, encoding, chartType } = advancedVSeed;
6630
- if (!measures || !dimensions || !dataset || !encoding) return result;
6631
- if (0 === measures.length) throw new Error('measures can not be empty');
6632
- if (measures.length > 2) throw new Error('measures can not be more than 2');
6659
+ const { dimensions = [], measures = [], encoding, chartType } = advancedVSeed;
6660
+ if (measures.length > 2) throw new Error('measures can not be more than 2 groups in dualAxis');
6633
6661
  const foldInfoList = [];
6634
6662
  const unfoldInfoList = [];
6635
6663
  const datasets = [];
6636
6664
  const primaryMeasures = measures[0];
6637
6665
  const secondaryMeasures = measures[1] || [];
6638
- const hasEncoding = (vseed.dimensions || []).some((item)=>item.encoding);
6639
6666
  if (primaryMeasures && primaryMeasures.children) {
6640
6667
  const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, T(dimensions, (item)=>item.id), T(primaryMeasures.children, (item)=>item.id), encoding, {
6641
- colorItemAsId: hasEncoding,
6668
+ colorItemAsId: false,
6642
6669
  foldMeasureValue: FoldPrimaryMeasureValue,
6643
6670
  colorMeasureId: getColorMeasureId(advancedVSeed)
6644
6671
  });
@@ -6648,6 +6675,7 @@
6648
6675
  }
6649
6676
  if (secondaryMeasures && secondaryMeasures.children) {
6650
6677
  const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, T(dimensions, (item)=>item.id), T(secondaryMeasures.children, (item)=>item.id), encoding, {
6678
+ colorItemAsId: false,
6651
6679
  foldMeasureValue: FoldSecondaryMeasureValue,
6652
6680
  colorMeasureId: getColorMeasureId(advancedVSeed)
6653
6681
  });
@@ -6683,9 +6711,7 @@
6683
6711
  };
6684
6712
  const { vseed } = context;
6685
6713
  const { dataset } = vseed;
6686
- const { dimensions, measures, encoding, chartType } = advancedVSeed;
6687
- if (!measures || !dimensions || !dataset || !encoding) return result;
6688
- const hasEncoding = (vseed.dimensions || []).some((item)=>item.encoding);
6714
+ const { dimensions = [], measures = [], encoding, chartType } = advancedVSeed;
6689
6715
  const datasetList = [];
6690
6716
  const datasetReshapeInfo = [];
6691
6717
  const measureGroups = [];
@@ -6695,8 +6721,7 @@
6695
6721
  });
6696
6722
  else if (2 === depth) measureGroups.push(measures);
6697
6723
  measureGroups.forEach((measures, index)=>{
6698
- if (0 === measures.length) throw new Error('measures can not be empty');
6699
- if (measures.length > 2) throw new Error('measures can not be more than 2');
6724
+ if (measures.length > 2) throw new Error('measures can not be more than 2 groups in dualAxis');
6700
6725
  const foldInfoList = [];
6701
6726
  const unfoldInfoList = [];
6702
6727
  const datasets = [];
@@ -6704,7 +6729,7 @@
6704
6729
  const secondaryMeasures = measures[1] || [];
6705
6730
  if (primaryMeasures && primaryMeasures.children) {
6706
6731
  const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, T(dimensions, (item)=>item.id), T(primaryMeasures.children, (item)=>item.id), encoding, {
6707
- colorItemAsId: hasEncoding,
6732
+ colorItemAsId: false,
6708
6733
  foldMeasureValue: `${FoldPrimaryMeasureValue}${index}`,
6709
6734
  colorMeasureId: getColorMeasureId(advancedVSeed)
6710
6735
  });
@@ -6714,6 +6739,7 @@
6714
6739
  }
6715
6740
  if (secondaryMeasures && secondaryMeasures.children) {
6716
6741
  const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, T(dimensions, (item)=>item.id), T(secondaryMeasures.children, (item)=>item.id), encoding, {
6742
+ colorItemAsId: false,
6717
6743
  foldMeasureValue: `${FoldSecondaryMeasureValue}${index}`,
6718
6744
  colorMeasureId: getColorMeasureId(advancedVSeed)
6719
6745
  });
@@ -6819,6 +6845,7 @@
6819
6845
  const result = {
6820
6846
  type: 'common',
6821
6847
  padding: 0,
6848
+ labelLayout: 'region',
6822
6849
  region: [
6823
6850
  {
6824
6851
  clip: true
@@ -7074,71 +7101,33 @@
7074
7101
  const result = {
7075
7102
  ...spec
7076
7103
  };
7077
- const { advancedVSeed } = context;
7078
- const { measures, datasetReshapeInfo, locale } = advancedVSeed;
7104
+ const { advancedVSeed, vseed } = context;
7105
+ const { datasetReshapeInfo, encoding } = advancedVSeed;
7079
7106
  const { chartType } = advancedVSeed;
7080
7107
  const baseConfig = advancedVSeed.config[chartType];
7081
7108
  if (!baseConfig || !baseConfig.label) return result;
7082
7109
  const foldInfoList = datasetReshapeInfo[0].foldInfoList;
7083
- const { measureId, measureValue } = foldInfoList[0];
7084
- const { label } = baseConfig;
7085
- const { enable } = label;
7086
- result.label = {
7087
- visible: enable,
7088
- formatMethod: (value, datum)=>{
7089
- const result = [];
7090
- const formatValue = (value)=>{
7091
- const id = datum[measureId];
7092
- const measure = findMeasureById(measures, id);
7093
- if (!measure) return value;
7094
- const { format = {}, autoFormat = true } = measure;
7095
- if (!chunk_VCYTMP4D_n(format)) {
7096
- const formatter = createFormatter(format);
7097
- return formatter(value);
7098
- }
7099
- if (autoFormat) return autoFormatter(value, locale);
7100
- return String(value);
7101
- };
7102
- result.push(formatValue(datum[measureValue]));
7103
- return result.join(' ');
7104
- }
7105
- };
7110
+ result.label = buildLabel(baseConfig.label, vseed.measures, vseed.dimensions, advancedVSeed.measures, encoding, [
7111
+ foldInfoList[0]
7112
+ ]);
7113
+ result.label.zIndex = 1002;
7106
7114
  return result;
7107
7115
  };
7108
7116
  const labelSecondary = (spec, context)=>{
7109
7117
  const result = {
7110
7118
  ...spec
7111
7119
  };
7112
- const { advancedVSeed } = context;
7113
- const { measures, datasetReshapeInfo, locale } = advancedVSeed;
7120
+ const { advancedVSeed, vseed } = context;
7121
+ const { datasetReshapeInfo, encoding } = advancedVSeed;
7114
7122
  const { chartType } = advancedVSeed;
7115
7123
  const baseConfig = advancedVSeed.config[chartType];
7116
7124
  if (!baseConfig || !baseConfig.label) return result;
7117
7125
  if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
7118
7126
  const foldInfoList = datasetReshapeInfo[0].foldInfoList;
7119
- const { measureId, measureValue } = foldInfoList[1];
7120
- const { label } = baseConfig;
7121
- const { enable } = label;
7122
- result.label = {
7123
- visible: enable,
7124
- formatMethod: (value, datum)=>{
7125
- const result = [];
7126
- const formatValue = (value)=>{
7127
- const id = datum[measureId];
7128
- const measure = findMeasureById(measures, id);
7129
- if (!measure) return value;
7130
- const { format = {}, autoFormat = true } = measure;
7131
- if (!chunk_VCYTMP4D_n(format)) {
7132
- const formatter = createFormatter(format);
7133
- return formatter(value);
7134
- }
7135
- if (autoFormat) return autoFormatter(value, locale);
7136
- return String(value);
7137
- };
7138
- result.push(formatValue(datum[measureValue]));
7139
- return result.join(' ');
7140
- }
7141
- };
7127
+ result.label = buildLabel(baseConfig.label, vseed.measures, vseed.dimensions, advancedVSeed.measures, encoding, [
7128
+ foldInfoList[1]
7129
+ ]);
7130
+ result.label.zIndex = 1002;
7142
7131
  return result;
7143
7132
  };
7144
7133
  const tooltipPrimary = (spec, context)=>{
@@ -7146,7 +7135,7 @@
7146
7135
  ...spec
7147
7136
  };
7148
7137
  const { advancedVSeed, vseed } = context;
7149
- const { measures, datasetReshapeInfo, chartType, locale, dimensions, encoding } = advancedVSeed;
7138
+ const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed;
7150
7139
  const baseConfig = advancedVSeed.config[chartType];
7151
7140
  const { tooltip = {
7152
7141
  enable: true
@@ -7160,13 +7149,13 @@
7160
7149
  title: {
7161
7150
  visible: false
7162
7151
  },
7163
- content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), locale, foldInfoList[0], unfoldInfo)
7152
+ content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), foldInfoList[0], unfoldInfo)
7164
7153
  },
7165
7154
  dimension: {
7166
7155
  title: {
7167
7156
  visible: true
7168
7157
  },
7169
- content: createDimensionContent(measures, foldInfoList[0], unfoldInfo, locale)
7158
+ content: createDimensionContent(measures, foldInfoList[0], unfoldInfo)
7170
7159
  }
7171
7160
  };
7172
7161
  return result;
@@ -7176,7 +7165,7 @@
7176
7165
  ...spec
7177
7166
  };
7178
7167
  const { advancedVSeed, vseed } = context;
7179
- const { measures, datasetReshapeInfo, chartType, locale, dimensions, encoding } = advancedVSeed;
7168
+ const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed;
7180
7169
  const baseConfig = advancedVSeed.config[chartType];
7181
7170
  const { tooltip = {
7182
7171
  enable: true
@@ -7191,13 +7180,13 @@
7191
7180
  title: {
7192
7181
  visible: false
7193
7182
  },
7194
- content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), locale, foldInfoList[1], unfoldInfo)
7183
+ content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), foldInfoList[1], unfoldInfo)
7195
7184
  },
7196
7185
  dimension: {
7197
7186
  title: {
7198
7187
  visible: true
7199
7188
  },
7200
- content: createDimensionContent(measures, foldInfoList[1], unfoldInfo, locale)
7189
+ content: createDimensionContent(measures, foldInfoList[1], unfoldInfo)
7201
7190
  }
7202
7191
  };
7203
7192
  return result;
@@ -7208,7 +7197,7 @@
7208
7197
  };
7209
7198
  const { advancedVSeed, vseed } = context;
7210
7199
  const { chartType } = vseed;
7211
- const { locale, datasetReshapeInfo } = advancedVSeed;
7200
+ const { datasetReshapeInfo, encoding, measures, dimensions } = advancedVSeed;
7212
7201
  const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0];
7213
7202
  const primaryYAxis = advancedVSeed.config?.[chartType]?.primaryYAxis;
7214
7203
  const yAxisConfig = Array.isArray(primaryYAxis) ? primaryYAxis[index] || primaryYAxis[0] : primaryYAxis;
@@ -7236,7 +7225,8 @@
7236
7225
  ];
7237
7226
  return result;
7238
7227
  }
7239
- const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = yAxisConfig;
7228
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = yAxisConfig;
7229
+ const formatter = createNumFormatter(numFormat);
7240
7230
  const linearAxis = {
7241
7231
  visible: isEmptySecondary ? false : visible,
7242
7232
  id,
@@ -7251,7 +7241,7 @@
7251
7241
  min,
7252
7242
  label: {
7253
7243
  visible: label?.visible,
7254
- formatMethod: (value)=>autoFormatter(value, locale),
7244
+ formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
7255
7245
  style: {
7256
7246
  fill: label?.labelColor,
7257
7247
  angle: label?.labelAngle,
@@ -7261,7 +7251,7 @@
7261
7251
  },
7262
7252
  title: {
7263
7253
  visible: title?.visible,
7264
- text: title?.titleText,
7254
+ text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y),
7265
7255
  style: {
7266
7256
  fill: title?.titleColor,
7267
7257
  fontSize: title?.titleFontSize,
@@ -7306,7 +7296,7 @@
7306
7296
  };
7307
7297
  const { advancedVSeed, vseed } = context;
7308
7298
  const { chartType } = vseed;
7309
- const { locale, datasetReshapeInfo } = advancedVSeed;
7299
+ const { datasetReshapeInfo, measures, dimensions, encoding } = advancedVSeed;
7310
7300
  const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0];
7311
7301
  const secondaryYAxis = advancedVSeed.config?.[chartType]?.secondaryYAxis;
7312
7302
  const yAxisConfig = Array.isArray(secondaryYAxis) ? secondaryYAxis[index] || secondaryYAxis[0] : secondaryYAxis;
@@ -7340,7 +7330,8 @@
7340
7330
  ];
7341
7331
  return result;
7342
7332
  }
7343
- const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = yAxisConfig;
7333
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, numFormat = {}, autoFormat } = yAxisConfig;
7334
+ const formatter = createNumFormatter(numFormat);
7344
7335
  const linearAxis = {
7345
7336
  visible: isEmptySecondary ? false : visible,
7346
7337
  id,
@@ -7356,7 +7347,7 @@
7356
7347
  min,
7357
7348
  label: {
7358
7349
  visible: label?.visible,
7359
- formatMethod: (value)=>autoFormatter(value, locale),
7350
+ formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
7360
7351
  style: {
7361
7352
  fill: label?.labelColor,
7362
7353
  angle: label?.labelAngle,
@@ -7366,7 +7357,7 @@
7366
7357
  },
7367
7358
  title: {
7368
7359
  visible: title?.visible,
7369
- text: title?.titleText,
7360
+ text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y),
7370
7361
  style: {
7371
7362
  fill: title?.titleColor,
7372
7363
  fontSize: title?.titleFontSize,
@@ -8717,16 +8708,6 @@
8717
8708
  markStyle_markStyle,
8718
8709
  annotation_annotation
8719
8710
  ];
8720
- const labelColorInversion = (spec)=>{
8721
- const result = {
8722
- ...spec
8723
- };
8724
- if (result.label) result.label.smartInvert = true;
8725
- else result.label = {
8726
- smartInvert: true
8727
- };
8728
- return result;
8729
- };
8730
8711
  const colorCellStyleFill = (stylePipe)=>(spec, context)=>{
8731
8712
  const result = stylePipe(spec, context);
8732
8713
  const { advancedVSeed } = context;
@@ -8814,14 +8795,8 @@
8814
8795
  const originalData = datum[ORIGINAL_DATA];
8815
8796
  const value = originalData[id];
8816
8797
  const measure = findMeasureById(measures, id);
8817
- if (!measure) return String(value);
8818
- const { format = {}, autoFormat = true } = measure;
8819
- if (!chunk_VCYTMP4D_n(format)) {
8820
- const formatter = createFormatter(format);
8821
- return formatter(value);
8822
- }
8823
- if (autoFormat) return autoFormatter(value, locale);
8824
- return String(value);
8798
+ const formatter = createFormatterByMeasure(measure);
8799
+ return formatter(value);
8825
8800
  }
8826
8801
  }));
8827
8802
  const foldMeaContent = [
@@ -8843,14 +8818,8 @@
8843
8818
  const value = datum[measureValue];
8844
8819
  const id = datum[measureId];
8845
8820
  const measure = findMeasureById(measures, id);
8846
- if (!measure) return String(value);
8847
- const { format = {}, autoFormat = true } = measure;
8848
- if (!chunk_VCYTMP4D_n(format)) {
8849
- const formatter = createFormatter(format);
8850
- return formatter(value);
8851
- }
8852
- if (autoFormat) return autoFormatter(value, locale);
8853
- return String(value);
8821
+ const formatter = createFormatterByMeasure(measure);
8822
+ return formatter(value);
8854
8823
  }
8855
8824
  }));
8856
8825
  return [
@@ -8899,7 +8868,6 @@
8899
8868
  datasetXY,
8900
8869
  colorAdapter(color_color, linearColor),
8901
8870
  label_label,
8902
- labelColorInversion,
8903
8871
  colorAdapter(discreteLegend, colorLegend),
8904
8872
  colorCellStyleFill(cellStyle),
8905
8873
  tooltipHeatmap,
@@ -8919,7 +8887,6 @@
8919
8887
  datasetXY,
8920
8888
  colorAdapter(color_color, linearColor),
8921
8889
  label_label,
8922
- labelColorInversion,
8923
8890
  discreteLegend,
8924
8891
  tooltipHeatmap,
8925
8892
  colorCellStyleFill(cellStyle),
@@ -9139,7 +9106,12 @@
9139
9106
  columnPercent: {
9140
9107
  ...baseConfig,
9141
9108
  xAxis: bandAxis,
9142
- yAxis: linearAxis,
9109
+ yAxis: {
9110
+ ...linearAxis,
9111
+ numFormat: {
9112
+ type: 'percent'
9113
+ }
9114
+ },
9143
9115
  crosshairRect,
9144
9116
  stackCornerRadius: [
9145
9117
  4,
@@ -9174,7 +9146,12 @@
9174
9146
  },
9175
9147
  barPercent: {
9176
9148
  ...baseConfig,
9177
- xAxis: linearAxis,
9149
+ xAxis: {
9150
+ ...linearAxis,
9151
+ numFormat: {
9152
+ type: 'percent'
9153
+ }
9154
+ },
9178
9155
  yAxis: barBandAxis,
9179
9156
  crosshairRect,
9180
9157
  stackCornerRadius: [
@@ -9193,7 +9170,12 @@
9193
9170
  areaPercent: {
9194
9171
  ...baseConfig,
9195
9172
  xAxis: bandAxis,
9196
- yAxis: linearAxis,
9173
+ yAxis: {
9174
+ ...linearAxis,
9175
+ numFormat: {
9176
+ type: 'percent'
9177
+ }
9178
+ },
9197
9179
  crosshairLine
9198
9180
  },
9199
9181
  scatter: {
@@ -9261,7 +9243,11 @@
9261
9243
  ...baseConfig
9262
9244
  },
9263
9245
  heatmap: {
9264
- ...baseConfig
9246
+ ...baseConfig,
9247
+ label: {
9248
+ ...baseConfig.label,
9249
+ labelColorSmartInvert: true
9250
+ }
9265
9251
  }
9266
9252
  }
9267
9253
  };
@@ -9586,7 +9572,11 @@
9586
9572
  ...baseConfig
9587
9573
  },
9588
9574
  heatmap: {
9589
- ...baseConfig
9575
+ ...baseConfig,
9576
+ label: {
9577
+ ...baseConfig.label,
9578
+ labelColorSmartInvert: true
9579
+ }
9590
9580
  }
9591
9581
  }
9592
9582
  };
@@ -13015,6 +13005,7 @@
13015
13005
  id: schemas_string(),
13016
13006
  alias: schemas_string().optional(),
13017
13007
  autoFormat: schemas_boolean().default(true),
13008
+ numFormat: zNumFormat["default"]({}),
13018
13009
  format: zNumFormat["default"]({}),
13019
13010
  encoding: schemas_enum([
13020
13011
  'primaryYAxis',
@@ -13215,6 +13206,7 @@
13215
13206
  log: schemas_boolean().default(false).nullish(),
13216
13207
  logBase: schemas_number().default(10).nullish(),
13217
13208
  inverse: schemas_boolean().default(false).nullish(),
13209
+ numFormat: zNumFormat.nullish(),
13218
13210
  label: schemas_object({
13219
13211
  visible: schemas_boolean().default(true).nullish(),
13220
13212
  labelColor: schemas_string().default('#797B85').nullish(),
@@ -13501,56 +13493,6 @@
13501
13493
  funnel: zFunnelConfig.nullish(),
13502
13494
  heatmap: zHeatmapConfig.nullish()
13503
13495
  });
13504
- const zAxis = schemas_object({
13505
- visible: schemas_boolean().default(true).nullish(),
13506
- min: schemas_number().nullish(),
13507
- max: schemas_number().nullish(),
13508
- nice: schemas_boolean().default(true).nullish(),
13509
- zero: schemas_boolean().default(true).nullish(),
13510
- inverse: schemas_boolean().default(false).nullish(),
13511
- log: schemas_boolean().default(false).nullish(),
13512
- logBase: schemas_number().default(10).nullish(),
13513
- labelAutoHide: schemas_boolean().default(true).nullish(),
13514
- labelAutoHideGap: schemas_number().default(4).nullish(),
13515
- labelAutoRotate: schemas_boolean().default(true).nullish(),
13516
- labelAutoRotateAngleRange: schemas_array(schemas_number()).default([
13517
- 0,
13518
- -45,
13519
- -90
13520
- ]).nullish(),
13521
- labelAutoLimit: schemas_boolean().default(true).nullish(),
13522
- labelAutoLimitLength: schemas_number().default(100).nullish(),
13523
- label: schemas_object({
13524
- visible: schemas_boolean().default(true).nullish(),
13525
- labelColor: schemas_string().default('#797B85').nullish(),
13526
- labelFontSize: schemas_number().default(12).nullish(),
13527
- labelFontWeight: schemas_number().default(400).nullish(),
13528
- labelAngle: schemas_number().default(0).nullish()
13529
- }).nullish(),
13530
- line: schemas_object({
13531
- visible: schemas_boolean().default(true).nullish(),
13532
- lineColor: schemas_string().default('rgba(54, 65, 89, 0.30)').nullish(),
13533
- lineWidth: schemas_number().default(1).nullish()
13534
- }).nullish(),
13535
- tick: schemas_object({
13536
- visible: schemas_boolean().default(true).nullish(),
13537
- tickInside: schemas_boolean().default(false).nullish(),
13538
- tickColor: schemas_string().default('rgba(54, 65, 89, 0.30)').nullish(),
13539
- tickSize: schemas_number().default(4).nullish()
13540
- }).nullish(),
13541
- title: schemas_object({
13542
- visible: schemas_boolean().default(false).nullish(),
13543
- titleText: schemas_string().default('').nullish(),
13544
- titleColor: schemas_string().default('#646A73').nullish(),
13545
- titleFontSize: schemas_number().default(12).nullish(),
13546
- titleFontWeight: schemas_number().default(400).nullish()
13547
- }).nullish(),
13548
- grid: schemas_object({
13549
- visible: schemas_boolean().default(false).nullish(),
13550
- gridColor: schemas_string().default('rgba(54, 65, 89, 0.15)').nullish(),
13551
- gridWidth: schemas_number().default(0.5).nullish()
13552
- }).nullish()
13553
- });
13554
13496
  const zCustomThemeConfig = schemas_object({
13555
13497
  config: zConfig.nullish()
13556
13498
  });