@visactor/vchart 2.1.3 → 2.1.4-alpha.0

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 (98) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +165 -21
  3. package/build/index.js +165 -21
  4. package/build/index.min.js +1 -1
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/animation-planner.js +1 -1
  7. package/cjs/animation/callback-disappear.js +1 -1
  8. package/cjs/animation/config.js +2 -1
  9. package/cjs/animation/grammar-dector.js +1 -1
  10. package/cjs/animation/index.js +1 -1
  11. package/cjs/animation/interface.js +1 -1
  12. package/cjs/animation/sequential-animate.js +1 -1
  13. package/cjs/animation/spec.js +1 -1
  14. package/cjs/animation/state-transition.js +1 -1
  15. package/cjs/animation/utils.js +1 -1
  16. package/cjs/chart/util.js +1 -2
  17. package/cjs/compile/state-manager.js +2 -1
  18. package/cjs/component/axis/cartesian/axis.d.ts +12 -0
  19. package/cjs/component/axis/cartesian/axis.js +48 -2
  20. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  21. package/cjs/component/axis/cartesian/interface/common.d.ts +1 -1
  22. package/cjs/component/axis/cartesian/interface/common.js.map +1 -1
  23. package/cjs/constant/event.js +1 -2
  24. package/cjs/constant/marker.js +2 -1
  25. package/cjs/core/factory-registry.js +1 -1
  26. package/cjs/core/factory.js +1 -1
  27. package/cjs/core/index.js +1 -2
  28. package/cjs/core/instance-manager.js +1 -1
  29. package/cjs/core/interface.js +1 -1
  30. package/cjs/core/util.js +1 -1
  31. package/cjs/core/vchart.js +4 -2
  32. package/cjs/core/vchart.js.map +1 -1
  33. package/cjs/data/data-view-utils.js +1 -1
  34. package/cjs/data/initialize.js +1 -1
  35. package/cjs/data/register.js +1 -1
  36. package/cjs/mark/component.js +1 -1
  37. package/cjs/mark/component.js.map +1 -1
  38. package/cjs/series/bar/bar.d.ts +4 -0
  39. package/cjs/series/bar/bar.js +17 -6
  40. package/cjs/series/bar/bar.js.map +1 -1
  41. package/cjs/series/funnel/interface.d.ts +6 -1
  42. package/cjs/series/funnel/interface.js.map +1 -1
  43. package/cjs/series/treemap/interface.d.ts +1 -1
  44. package/cjs/series/treemap/interface.js.map +1 -1
  45. package/cjs/theme/builtin/common/series/funnel.js +18 -0
  46. package/cjs/theme/builtin/common/series/funnel.js.map +1 -1
  47. package/cjs/typings/spec/common.d.ts +4 -2
  48. package/cjs/typings/spec/common.js.map +1 -1
  49. package/cjs/util/spec/transform.d.ts +5 -2
  50. package/cjs/util/spec/transform.js +7 -11
  51. package/cjs/util/spec/transform.js.map +1 -1
  52. package/esm/animation/animation-planner.js +1 -1
  53. package/esm/animation/callback-disappear.js +1 -1
  54. package/esm/animation/config.js +2 -1
  55. package/esm/animation/grammar-dector.js +1 -1
  56. package/esm/animation/index.js +1 -1
  57. package/esm/animation/interface.js +1 -1
  58. package/esm/animation/sequential-animate.js +1 -1
  59. package/esm/animation/spec.js +1 -1
  60. package/esm/animation/state-transition.js +1 -1
  61. package/esm/animation/utils.js +1 -1
  62. package/esm/chart/util.js +1 -2
  63. package/esm/compile/state-manager.js +2 -1
  64. package/esm/component/axis/cartesian/axis.d.ts +12 -0
  65. package/esm/component/axis/cartesian/axis.js +48 -1
  66. package/esm/component/axis/cartesian/axis.js.map +1 -1
  67. package/esm/component/axis/cartesian/interface/common.d.ts +1 -1
  68. package/esm/component/axis/cartesian/interface/common.js.map +1 -1
  69. package/esm/constant/event.js +1 -2
  70. package/esm/constant/marker.js +2 -1
  71. package/esm/core/factory-registry.js +1 -1
  72. package/esm/core/factory.js +1 -1
  73. package/esm/core/index.js +1 -2
  74. package/esm/core/instance-manager.js +1 -1
  75. package/esm/core/interface.js +1 -1
  76. package/esm/core/util.js +1 -1
  77. package/esm/core/vchart.js +3 -2
  78. package/esm/core/vchart.js.map +1 -1
  79. package/esm/data/data-view-utils.js +1 -1
  80. package/esm/data/initialize.js +1 -1
  81. package/esm/data/register.js +1 -1
  82. package/esm/mark/component.js +1 -1
  83. package/esm/mark/component.js.map +1 -1
  84. package/esm/series/bar/bar.d.ts +4 -0
  85. package/esm/series/bar/bar.js +16 -5
  86. package/esm/series/bar/bar.js.map +1 -1
  87. package/esm/series/funnel/interface.d.ts +6 -1
  88. package/esm/series/funnel/interface.js.map +1 -1
  89. package/esm/series/treemap/interface.d.ts +1 -1
  90. package/esm/series/treemap/interface.js.map +1 -1
  91. package/esm/theme/builtin/common/series/funnel.js +18 -0
  92. package/esm/theme/builtin/common/series/funnel.js.map +1 -1
  93. package/esm/typings/spec/common.d.ts +4 -2
  94. package/esm/typings/spec/common.js.map +1 -1
  95. package/esm/util/spec/transform.d.ts +5 -2
  96. package/esm/util/spec/transform.js +7 -11
  97. package/esm/util/spec/transform.js.map +1 -1
  98. package/package.json +5 -5
package/build/index.es.js CHANGED
@@ -11469,6 +11469,24 @@ const getFunnelTheme = (is3d) => {
11469
11469
  fill: { type: 'palette', key: 'secondaryFontColor' },
11470
11470
  textBaseline: 'middle'
11471
11471
  }
11472
+ },
11473
+ conversionArrow: {
11474
+ line: {
11475
+ style: {
11476
+ stroke: 'black'
11477
+ }
11478
+ },
11479
+ symbol: {
11480
+ style: {
11481
+ fill: 'black'
11482
+ }
11483
+ },
11484
+ text: {
11485
+ style: {
11486
+ fontSize: 12,
11487
+ fill: '#606773'
11488
+ }
11489
+ }
11472
11490
  }
11473
11491
  };
11474
11492
  res[is3d ? 'transform3d' : 'transform'] = {
@@ -11647,27 +11665,27 @@ function specTransform(spec, special = {
11647
11665
  }
11648
11666
  return spec;
11649
11667
  }
11650
- function functionTransform(spec, VChart) {
11651
- if (!spec) {
11652
- return spec;
11668
+ function functionTransform(value, registry) {
11669
+ var _a;
11670
+ if (!value) {
11671
+ return value;
11672
+ }
11673
+ if (isString$1(value)) {
11674
+ return (_a = registry.getFunction(value)) !== null && _a !== void 0 ? _a : value;
11653
11675
  }
11654
- if (isPlainObject$1(spec)) {
11676
+ if (isPlainObject$1(value)) {
11655
11677
  const result = {};
11656
- for (const key in spec) {
11657
- if (Object.prototype.hasOwnProperty.call(spec, key)) {
11658
- if (isString$1(spec[key]) && VChart.getFunction(spec[key])) {
11659
- result[key] = VChart.getFunction(spec[key]);
11660
- continue;
11661
- }
11662
- result[key] = functionTransform(spec[key], VChart);
11678
+ for (const key in value) {
11679
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
11680
+ result[key] = functionTransform(value[key], registry);
11663
11681
  }
11664
11682
  }
11665
11683
  return result;
11666
11684
  }
11667
- if (isArray$1(spec)) {
11668
- return spec.map((s) => functionTransform(s, VChart));
11685
+ if (isArray$1(value)) {
11686
+ return value.map(item => functionTransform(item, registry));
11669
11687
  }
11670
- return spec;
11688
+ return value;
11671
11689
  }
11672
11690
  function transformFunctionAttribute(att, ...args) {
11673
11691
  if (isFunction$1(att)) {
@@ -19425,6 +19443,7 @@ class VChart {
19425
19443
  }
19426
19444
  let theme = this._currentTheme;
19427
19445
  keys.forEach((key, index) => {
19446
+ var _a;
19428
19447
  if (index === 1 && (keys[0] === 'series' || keys[0] === 'component')) {
19429
19448
  const buildInTheme = keys[0] === 'series' ? Factory.getSeriesBuiltInTheme(key) : Factory.getComponentBuiltInTheme(key);
19430
19449
  theme = theme ? mergeSpec({}, buildInTheme, theme[key]) : buildInTheme;
@@ -19436,6 +19455,9 @@ class VChart {
19436
19455
  theme = preprocessTheme({
19437
19456
  [key]: theme
19438
19457
  }, this._currentTheme.colorScheme, this._currentTheme.token)[key];
19458
+ if ((_a = this.getFunctionList()) === null || _a === void 0 ? void 0 : _a.length) {
19459
+ theme = functionTransform(theme, this);
19460
+ }
19439
19461
  }
19440
19462
  });
19441
19463
  this._cachedProcessedTheme[cacheKey] = theme;
@@ -19507,7 +19529,7 @@ class VChart {
19507
19529
  this._compiler.updateLayoutTag();
19508
19530
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
19509
19531
  this._initDataSet(this._option.dataSet);
19510
- this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
19532
+ this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
19511
19533
  this._bindResizeEvent();
19512
19534
  this._bindViewEvent();
19513
19535
  this._initChartPlugin();
@@ -20194,7 +20216,7 @@ class VChart {
20194
20216
  resize = true;
20195
20217
  }
20196
20218
  const lasAutoSize = this._autoSize;
20197
- this._autoSize = isTrueBrowser(this._option.mode) ? (_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true : false;
20219
+ this._autoSize = isTrueBrowser(this._option.mode) ? ((_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true) : false;
20198
20220
  if (this._autoSize !== lasAutoSize) {
20199
20221
  resize = true;
20200
20222
  }
@@ -25298,6 +25320,9 @@ class ComponentMark extends BaseMark {
25298
25320
  }
25299
25321
  else {
25300
25322
  this._component.setAttributes(attrs);
25323
+ if (this._product && this._component.parent !== this._product) {
25324
+ this._product.appendChild(this._component);
25325
+ }
25301
25326
  }
25302
25327
  if (this._component) {
25303
25328
  this._component.context = this._getCommonContext();
@@ -26023,6 +26048,9 @@ class CartesianAxis extends AxisComponent {
26023
26048
  });
26024
26049
  }
26025
26050
  };
26051
+ this._clearContinuousBarBandwidthCache = () => {
26052
+ this._continuousBarBandwidthCache = undefined;
26053
+ };
26026
26054
  this._transformLayoutPosition = (pos) => {
26027
26055
  let { x, y } = pos;
26028
26056
  if (isValidNumber$1(x)) {
@@ -26313,16 +26341,99 @@ class CartesianAxis extends AxisComponent {
26313
26341
  const getScale = (depth = 0) => {
26314
26342
  return this._scales[depth];
26315
26343
  };
26344
+ const getBandwidth = (depth = 0) => {
26345
+ return this._getContinuousBarBandwidth(depth);
26346
+ };
26316
26347
  return {
26317
26348
  isContinuous: isContinuous(this._scale.type),
26318
26349
  dataToPosition: this.dataToPosition.bind(this),
26319
26350
  getScale,
26351
+ getBandwidth,
26320
26352
  getAxisType: () => this.type,
26321
26353
  getAxisId: () => this.id,
26322
26354
  isInverse: () => this._inverse === true,
26323
26355
  getSpec: () => this._spec
26324
26356
  };
26325
26357
  }
26358
+ _getContinuousBarBandwidth(depth = 0) {
26359
+ if (depth !== 0 || !isContinuous(this._scale.type)) {
26360
+ return undefined;
26361
+ }
26362
+ const scale = this._scales[0];
26363
+ const domain = scale.domain();
26364
+ const range = scale.range();
26365
+ const domainStart = +(domain === null || domain === void 0 ? void 0 : domain[0]);
26366
+ const domainEnd = +(domain === null || domain === void 0 ? void 0 : domain[domain.length - 1]);
26367
+ const rangeStart = +(range === null || range === void 0 ? void 0 : range[0]);
26368
+ const rangeEnd = +(range === null || range === void 0 ? void 0 : range[range.length - 1]);
26369
+ if (!Number.isFinite(domainStart) ||
26370
+ !Number.isFinite(domainEnd) ||
26371
+ !Number.isFinite(rangeStart) ||
26372
+ !Number.isFinite(rangeEnd) ||
26373
+ domainStart === domainEnd) {
26374
+ return undefined;
26375
+ }
26376
+ const cache = this._continuousBarBandwidthCache;
26377
+ if (cache &&
26378
+ cache.scale === scale &&
26379
+ cache.domainStart === domainStart &&
26380
+ cache.domainEnd === domainEnd &&
26381
+ cache.rangeStart === rangeStart &&
26382
+ cache.rangeEnd === rangeEnd) {
26383
+ return cache.bandWidth;
26384
+ }
26385
+ const valueSet = new Set();
26386
+ const orient = this.getOrient();
26387
+ eachSeries(this._regions, s => {
26388
+ var _a, _b, _c, _d;
26389
+ if (s.type !== SeriesTypeEnum.bar) {
26390
+ return;
26391
+ }
26392
+ const barSeries = s;
26393
+ const field = isXAxis(orient) && barSeries.direction === "vertical"
26394
+ ? barSeries.fieldX[0]
26395
+ : isYAxis(orient) && barSeries.direction === "horizontal"
26396
+ ? barSeries.fieldY[0]
26397
+ : undefined;
26398
+ const values = (field ? (_d = (_c = (_b = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s)) === null || _b === void 0 ? void 0 : _b.latestData) === null || _c === void 0 ? void 0 : _c[field]) === null || _d === void 0 ? void 0 : _d.values : undefined);
26399
+ values === null || values === void 0 ? void 0 : values.forEach(value => {
26400
+ const numericValue = +value;
26401
+ if (Number.isFinite(numericValue)) {
26402
+ valueSet.add(numericValue);
26403
+ }
26404
+ });
26405
+ }, {
26406
+ userId: this._seriesUserId,
26407
+ specIndex: this._seriesIndex
26408
+ });
26409
+ const values = Array.from(valueSet).sort((a, b) => a - b);
26410
+ if (values.length < 2) {
26411
+ return undefined;
26412
+ }
26413
+ let minStep = Infinity;
26414
+ let lastValue = values[0];
26415
+ for (let i = 1; i < values.length; i++) {
26416
+ const value = values[i];
26417
+ const step = value - lastValue;
26418
+ if (step > 0 && step < minStep) {
26419
+ minStep = step;
26420
+ }
26421
+ lastValue = value;
26422
+ }
26423
+ const bandWidth = minStep < Infinity ? Math.abs(((rangeEnd - rangeStart) / (domainEnd - domainStart)) * minStep) : undefined;
26424
+ if (!Number.isFinite(bandWidth)) {
26425
+ return undefined;
26426
+ }
26427
+ this._continuousBarBandwidthCache = {
26428
+ scale,
26429
+ domainStart,
26430
+ domainEnd,
26431
+ rangeStart,
26432
+ rangeEnd,
26433
+ bandWidth
26434
+ };
26435
+ return bandWidth;
26436
+ }
26326
26437
  afterCompile() {
26327
26438
  var _a;
26328
26439
  const product = (_a = this._axisMark) === null || _a === void 0 ? void 0 : _a.getProduct();
@@ -26584,6 +26695,13 @@ class CartesianAxis extends AxisComponent {
26584
26695
  }
26585
26696
  initEvent() {
26586
26697
  super.initEvent();
26698
+ eachSeries(this._regions, s => {
26699
+ var _a, _b;
26700
+ (_b = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s)) === null || _b === void 0 ? void 0 : _b.target.addListener('change', this._clearContinuousBarBandwidthCache);
26701
+ }, {
26702
+ userId: this._seriesUserId,
26703
+ specIndex: this._seriesIndex
26704
+ });
26587
26705
  if (this._specVisible) {
26588
26706
  this.event.on(ChartEvent.layoutEnd, this._updateAxisLayout);
26589
26707
  this.event.on(ChartEvent.layoutEnd, this._fixAxisOnZero);
@@ -32502,6 +32620,27 @@ class BarSeries extends CartesianSeries {
32502
32620
  const policy = super._getSpecUpdatePolicy();
32503
32621
  return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), BAR_SERIES_COMPILE_ONLY_KEYS) });
32504
32622
  }
32623
+ getStatisticFields() {
32624
+ var _a;
32625
+ const fields = super.getStatisticFields();
32626
+ const positionAxisHelper = this.direction === "horizontal" ? this.getYAxisHelper() : this.getXAxisHelper();
32627
+ const positionFields = this.direction === "horizontal" ? this._fieldY : this._fieldX;
32628
+ const positionScale = (_a = positionAxisHelper === null || positionAxisHelper === void 0 ? void 0 : positionAxisHelper.getScale) === null || _a === void 0 ? void 0 : _a.call(positionAxisHelper, 0);
32629
+ if (positionScale && isContinuous(positionScale.type)) {
32630
+ positionFields.forEach(field => {
32631
+ const fieldStatistics = fields.find(entry => entry.key === field);
32632
+ if (fieldStatistics) {
32633
+ if (!fieldStatistics.operations.includes('values')) {
32634
+ fieldStatistics.operations.push('values');
32635
+ }
32636
+ }
32637
+ else {
32638
+ fields.push({ key: field, operations: ['values'] });
32639
+ }
32640
+ });
32641
+ }
32642
+ return fields;
32643
+ }
32505
32644
  initMark() {
32506
32645
  this._initBarBackgroundMark();
32507
32646
  this._barMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), { name: this._barMarkName, type: this._barMarkType }), {
@@ -32938,14 +33077,19 @@ class BarSeries extends CartesianSeries {
32938
33077
  this._barMark.setAnimationConfig(animationConfig((_b = Factory.getAnimationInKey('bar')) === null || _b === void 0 ? void 0 : _b(barAnimationParams, appearPreset), userAnimationConfig(this._barMarkName, this._spec, this._markAttributeContext), animationParams));
32939
33078
  }
32940
33079
  _getBarWidth(axisHelper, scaleDepth) {
32941
- var _a, _b;
33080
+ var _a;
32942
33081
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
32943
33082
  const depth = isNil$1(scaleDepth) ? depthFromSpec : Math.min(depthFromSpec, scaleDepth);
32944
- const bandWidth = (_b = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1)) !== null && _b !== void 0 ? _b : DefaultBandWidth$2;
32945
33083
  const hasBarWidth = isValid$1(this._spec.barWidth) && depth === depthFromSpec;
33084
+ const useFixedWidth = hasBarWidth &&
33085
+ typeof this._spec.barWidth === 'number' &&
33086
+ typeof this._spec.barMinWidth !== 'string' &&
33087
+ typeof this._spec.barMaxWidth !== 'string';
33088
+ const axisBandWidth = useFixedWidth ? undefined : (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
33089
+ const bandWidth = axisBandWidth !== null && axisBandWidth !== void 0 ? axisBandWidth : DefaultBandWidth$2;
32946
33090
  const hasBarMinWidth = isValid$1(this._spec.barMinWidth);
32947
33091
  const hasBarMaxWidth = isValid$1(this._spec.barMaxWidth);
32948
- let width = bandWidth;
33092
+ let width = axisHelper.isContinuous && !isNil$1(axisBandWidth) && !hasBarWidth ? bandWidth * 0.5 : bandWidth;
32949
33093
  if (hasBarWidth) {
32950
33094
  width = getActualNumValue(this._spec.barWidth, bandWidth);
32951
33095
  }
@@ -32958,7 +33102,7 @@ class BarSeries extends CartesianSeries {
32958
33102
  return width;
32959
33103
  }
32960
33104
  _getPosition(direction, datum, scaleDepth, mark) {
32961
- var _a, _b, _c, _d, _e;
33105
+ var _a, _b, _c, _d, _e, _f;
32962
33106
  let axisHelper;
32963
33107
  let sizeAttribute;
32964
33108
  let dataToPosition;
@@ -33003,7 +33147,7 @@ class BarSeries extends CartesianSeries {
33003
33147
  totalWidth += totalWidth + (groupCount - 1) * gap;
33004
33148
  }
33005
33149
  }
33006
- const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
33150
+ const center = scale.scale(datum[groupFields[0]]) + ((_f = axisHelper.getBandwidth(0)) !== null && _f !== void 0 ? _f : bandWidth) / 2;
33007
33151
  return center - totalWidth / 2 + offSet;
33008
33152
  }
33009
33153
  const continuous = isContinuous(scale.type || 'band');
package/build/index.js CHANGED
@@ -33729,6 +33729,24 @@
33729
33729
  fill: { type: 'palette', key: 'secondaryFontColor' },
33730
33730
  textBaseline: 'middle'
33731
33731
  }
33732
+ },
33733
+ conversionArrow: {
33734
+ line: {
33735
+ style: {
33736
+ stroke: 'black'
33737
+ }
33738
+ },
33739
+ symbol: {
33740
+ style: {
33741
+ fill: 'black'
33742
+ }
33743
+ },
33744
+ text: {
33745
+ style: {
33746
+ fontSize: 12,
33747
+ fill: '#606773'
33748
+ }
33749
+ }
33732
33750
  }
33733
33751
  };
33734
33752
  res[is3d ? 'transform3d' : 'transform'] = {
@@ -33907,27 +33925,27 @@
33907
33925
  }
33908
33926
  return spec;
33909
33927
  }
33910
- function functionTransform(spec, VChart) {
33911
- if (!spec) {
33912
- return spec;
33928
+ function functionTransform(value, registry) {
33929
+ var _a;
33930
+ if (!value) {
33931
+ return value;
33932
+ }
33933
+ if (isString$1(value)) {
33934
+ return (_a = registry.getFunction(value)) !== null && _a !== void 0 ? _a : value;
33913
33935
  }
33914
- if (isPlainObject$3(spec)) {
33936
+ if (isPlainObject$3(value)) {
33915
33937
  const result = {};
33916
- for (const key in spec) {
33917
- if (Object.prototype.hasOwnProperty.call(spec, key)) {
33918
- if (isString$1(spec[key]) && VChart.getFunction(spec[key])) {
33919
- result[key] = VChart.getFunction(spec[key]);
33920
- continue;
33921
- }
33922
- result[key] = functionTransform(spec[key], VChart);
33938
+ for (const key in value) {
33939
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
33940
+ result[key] = functionTransform(value[key], registry);
33923
33941
  }
33924
33942
  }
33925
33943
  return result;
33926
33944
  }
33927
- if (isArray$1(spec)) {
33928
- return spec.map((s) => functionTransform(s, VChart));
33945
+ if (isArray$1(value)) {
33946
+ return value.map(item => functionTransform(item, registry));
33929
33947
  }
33930
- return spec;
33948
+ return value;
33931
33949
  }
33932
33950
  function transformFunctionAttribute(att, ...args) {
33933
33951
  if (isFunction$1(att)) {
@@ -47815,6 +47833,7 @@
47815
47833
  }
47816
47834
  let theme = this._currentTheme;
47817
47835
  keys.forEach((key, index) => {
47836
+ var _a;
47818
47837
  if (index === 1 && (keys[0] === 'series' || keys[0] === 'component')) {
47819
47838
  const buildInTheme = keys[0] === 'series' ? Factory.getSeriesBuiltInTheme(key) : Factory.getComponentBuiltInTheme(key);
47820
47839
  theme = theme ? mergeSpec({}, buildInTheme, theme[key]) : buildInTheme;
@@ -47826,6 +47845,9 @@
47826
47845
  theme = preprocessTheme({
47827
47846
  [key]: theme
47828
47847
  }, this._currentTheme.colorScheme, this._currentTheme.token)[key];
47848
+ if ((_a = this.getFunctionList()) === null || _a === void 0 ? void 0 : _a.length) {
47849
+ theme = functionTransform(theme, this);
47850
+ }
47829
47851
  }
47830
47852
  });
47831
47853
  this._cachedProcessedTheme[cacheKey] = theme;
@@ -47897,7 +47919,7 @@
47897
47919
  this._compiler.updateLayoutTag();
47898
47920
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
47899
47921
  this._initDataSet(this._option.dataSet);
47900
- this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
47922
+ this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
47901
47923
  this._bindResizeEvent();
47902
47924
  this._bindViewEvent();
47903
47925
  this._initChartPlugin();
@@ -48584,7 +48606,7 @@
48584
48606
  resize = true;
48585
48607
  }
48586
48608
  const lasAutoSize = this._autoSize;
48587
- this._autoSize = isTrueBrowser(this._option.mode) ? (_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true : false;
48609
+ this._autoSize = isTrueBrowser(this._option.mode) ? ((_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true) : false;
48588
48610
  if (this._autoSize !== lasAutoSize) {
48589
48611
  resize = true;
48590
48612
  }
@@ -55722,6 +55744,9 @@
55722
55744
  }
55723
55745
  else {
55724
55746
  this._component.setAttributes(attrs);
55747
+ if (this._product && this._component.parent !== this._product) {
55748
+ this._product.appendChild(this._component);
55749
+ }
55725
55750
  }
55726
55751
  if (this._component) {
55727
55752
  this._component.context = this._getCommonContext();
@@ -56463,6 +56488,9 @@
56463
56488
  });
56464
56489
  }
56465
56490
  };
56491
+ this._clearContinuousBarBandwidthCache = () => {
56492
+ this._continuousBarBandwidthCache = undefined;
56493
+ };
56466
56494
  this._transformLayoutPosition = (pos) => {
56467
56495
  let { x, y } = pos;
56468
56496
  if (isValidNumber$1(x)) {
@@ -56753,16 +56781,99 @@
56753
56781
  const getScale = (depth = 0) => {
56754
56782
  return this._scales[depth];
56755
56783
  };
56784
+ const getBandwidth = (depth = 0) => {
56785
+ return this._getContinuousBarBandwidth(depth);
56786
+ };
56756
56787
  return {
56757
56788
  isContinuous: isContinuous(this._scale.type),
56758
56789
  dataToPosition: this.dataToPosition.bind(this),
56759
56790
  getScale,
56791
+ getBandwidth,
56760
56792
  getAxisType: () => this.type,
56761
56793
  getAxisId: () => this.id,
56762
56794
  isInverse: () => this._inverse === true,
56763
56795
  getSpec: () => this._spec
56764
56796
  };
56765
56797
  }
56798
+ _getContinuousBarBandwidth(depth = 0) {
56799
+ if (depth !== 0 || !isContinuous(this._scale.type)) {
56800
+ return undefined;
56801
+ }
56802
+ const scale = this._scales[0];
56803
+ const domain = scale.domain();
56804
+ const range = scale.range();
56805
+ const domainStart = +(domain === null || domain === void 0 ? void 0 : domain[0]);
56806
+ const domainEnd = +(domain === null || domain === void 0 ? void 0 : domain[domain.length - 1]);
56807
+ const rangeStart = +(range === null || range === void 0 ? void 0 : range[0]);
56808
+ const rangeEnd = +(range === null || range === void 0 ? void 0 : range[range.length - 1]);
56809
+ if (!Number.isFinite(domainStart) ||
56810
+ !Number.isFinite(domainEnd) ||
56811
+ !Number.isFinite(rangeStart) ||
56812
+ !Number.isFinite(rangeEnd) ||
56813
+ domainStart === domainEnd) {
56814
+ return undefined;
56815
+ }
56816
+ const cache = this._continuousBarBandwidthCache;
56817
+ if (cache &&
56818
+ cache.scale === scale &&
56819
+ cache.domainStart === domainStart &&
56820
+ cache.domainEnd === domainEnd &&
56821
+ cache.rangeStart === rangeStart &&
56822
+ cache.rangeEnd === rangeEnd) {
56823
+ return cache.bandWidth;
56824
+ }
56825
+ const valueSet = new Set();
56826
+ const orient = this.getOrient();
56827
+ eachSeries(this._regions, s => {
56828
+ var _a, _b, _c, _d;
56829
+ if (s.type !== exports.SeriesTypeEnum.bar) {
56830
+ return;
56831
+ }
56832
+ const barSeries = s;
56833
+ const field = isXAxis(orient) && barSeries.direction === "vertical"
56834
+ ? barSeries.fieldX[0]
56835
+ : isYAxis(orient) && barSeries.direction === "horizontal"
56836
+ ? barSeries.fieldY[0]
56837
+ : undefined;
56838
+ const values = (field ? (_d = (_c = (_b = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s)) === null || _b === void 0 ? void 0 : _b.latestData) === null || _c === void 0 ? void 0 : _c[field]) === null || _d === void 0 ? void 0 : _d.values : undefined);
56839
+ values === null || values === void 0 ? void 0 : values.forEach(value => {
56840
+ const numericValue = +value;
56841
+ if (Number.isFinite(numericValue)) {
56842
+ valueSet.add(numericValue);
56843
+ }
56844
+ });
56845
+ }, {
56846
+ userId: this._seriesUserId,
56847
+ specIndex: this._seriesIndex
56848
+ });
56849
+ const values = Array.from(valueSet).sort((a, b) => a - b);
56850
+ if (values.length < 2) {
56851
+ return undefined;
56852
+ }
56853
+ let minStep = Infinity;
56854
+ let lastValue = values[0];
56855
+ for (let i = 1; i < values.length; i++) {
56856
+ const value = values[i];
56857
+ const step = value - lastValue;
56858
+ if (step > 0 && step < minStep) {
56859
+ minStep = step;
56860
+ }
56861
+ lastValue = value;
56862
+ }
56863
+ const bandWidth = minStep < Infinity ? Math.abs(((rangeEnd - rangeStart) / (domainEnd - domainStart)) * minStep) : undefined;
56864
+ if (!Number.isFinite(bandWidth)) {
56865
+ return undefined;
56866
+ }
56867
+ this._continuousBarBandwidthCache = {
56868
+ scale,
56869
+ domainStart,
56870
+ domainEnd,
56871
+ rangeStart,
56872
+ rangeEnd,
56873
+ bandWidth
56874
+ };
56875
+ return bandWidth;
56876
+ }
56766
56877
  afterCompile() {
56767
56878
  var _a;
56768
56879
  const product = (_a = this._axisMark) === null || _a === void 0 ? void 0 : _a.getProduct();
@@ -57024,6 +57135,13 @@
57024
57135
  }
57025
57136
  initEvent() {
57026
57137
  super.initEvent();
57138
+ eachSeries(this._regions, s => {
57139
+ var _a, _b;
57140
+ (_b = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s)) === null || _b === void 0 ? void 0 : _b.target.addListener('change', this._clearContinuousBarBandwidthCache);
57141
+ }, {
57142
+ userId: this._seriesUserId,
57143
+ specIndex: this._seriesIndex
57144
+ });
57027
57145
  if (this._specVisible) {
57028
57146
  this.event.on(exports.ChartEvent.layoutEnd, this._updateAxisLayout);
57029
57147
  this.event.on(exports.ChartEvent.layoutEnd, this._fixAxisOnZero);
@@ -74351,6 +74469,27 @@
74351
74469
  const policy = super._getSpecUpdatePolicy();
74352
74470
  return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), BAR_SERIES_COMPILE_ONLY_KEYS) });
74353
74471
  }
74472
+ getStatisticFields() {
74473
+ var _a;
74474
+ const fields = super.getStatisticFields();
74475
+ const positionAxisHelper = this.direction === "horizontal" ? this.getYAxisHelper() : this.getXAxisHelper();
74476
+ const positionFields = this.direction === "horizontal" ? this._fieldY : this._fieldX;
74477
+ const positionScale = (_a = positionAxisHelper === null || positionAxisHelper === void 0 ? void 0 : positionAxisHelper.getScale) === null || _a === void 0 ? void 0 : _a.call(positionAxisHelper, 0);
74478
+ if (positionScale && isContinuous(positionScale.type)) {
74479
+ positionFields.forEach(field => {
74480
+ const fieldStatistics = fields.find(entry => entry.key === field);
74481
+ if (fieldStatistics) {
74482
+ if (!fieldStatistics.operations.includes('values')) {
74483
+ fieldStatistics.operations.push('values');
74484
+ }
74485
+ }
74486
+ else {
74487
+ fields.push({ key: field, operations: ['values'] });
74488
+ }
74489
+ });
74490
+ }
74491
+ return fields;
74492
+ }
74354
74493
  initMark() {
74355
74494
  this._initBarBackgroundMark();
74356
74495
  this._barMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), { name: this._barMarkName, type: this._barMarkType }), {
@@ -74787,14 +74926,19 @@
74787
74926
  this._barMark.setAnimationConfig(animationConfig((_b = Factory.getAnimationInKey('bar')) === null || _b === void 0 ? void 0 : _b(barAnimationParams, appearPreset), userAnimationConfig(this._barMarkName, this._spec, this._markAttributeContext), animationParams));
74788
74927
  }
74789
74928
  _getBarWidth(axisHelper, scaleDepth) {
74790
- var _a, _b;
74929
+ var _a;
74791
74930
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
74792
74931
  const depth = isNil$1(scaleDepth) ? depthFromSpec : Math.min(depthFromSpec, scaleDepth);
74793
- const bandWidth = (_b = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1)) !== null && _b !== void 0 ? _b : DefaultBandWidth$2;
74794
74932
  const hasBarWidth = isValid$1(this._spec.barWidth) && depth === depthFromSpec;
74933
+ const useFixedWidth = hasBarWidth &&
74934
+ typeof this._spec.barWidth === 'number' &&
74935
+ typeof this._spec.barMinWidth !== 'string' &&
74936
+ typeof this._spec.barMaxWidth !== 'string';
74937
+ const axisBandWidth = useFixedWidth ? undefined : (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
74938
+ const bandWidth = axisBandWidth !== null && axisBandWidth !== void 0 ? axisBandWidth : DefaultBandWidth$2;
74795
74939
  const hasBarMinWidth = isValid$1(this._spec.barMinWidth);
74796
74940
  const hasBarMaxWidth = isValid$1(this._spec.barMaxWidth);
74797
- let width = bandWidth;
74941
+ let width = axisHelper.isContinuous && !isNil$1(axisBandWidth) && !hasBarWidth ? bandWidth * 0.5 : bandWidth;
74798
74942
  if (hasBarWidth) {
74799
74943
  width = getActualNumValue(this._spec.barWidth, bandWidth);
74800
74944
  }
@@ -74807,7 +74951,7 @@
74807
74951
  return width;
74808
74952
  }
74809
74953
  _getPosition(direction, datum, scaleDepth, mark) {
74810
- var _a, _b, _c, _d, _e;
74954
+ var _a, _b, _c, _d, _e, _f;
74811
74955
  let axisHelper;
74812
74956
  let sizeAttribute;
74813
74957
  let dataToPosition;
@@ -74852,7 +74996,7 @@
74852
74996
  totalWidth += totalWidth + (groupCount - 1) * gap;
74853
74997
  }
74854
74998
  }
74855
- const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
74999
+ const center = scale.scale(datum[groupFields[0]]) + ((_f = axisHelper.getBandwidth(0)) !== null && _f !== void 0 ? _f : bandWidth) / 2;
74856
75000
  return center - totalWidth / 2 + offSet;
74857
75001
  }
74858
75002
  const continuous = isContinuous(scale.type || 'band');