@visactor/vchart 2.0.22-alpha.2 → 2.0.22-alpha.4

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 (40) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +44 -106
  3. package/build/index.js +44 -106
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/index.js +1 -2
  7. package/cjs/compile/state-manager.js +2 -1
  8. package/cjs/constant/gradient.js +2 -1
  9. package/cjs/constant/scroll-bar.js +1 -2
  10. package/cjs/constant/sunburst.js +1 -1
  11. package/cjs/constant/waterfall.js +1 -1
  12. package/cjs/constant/word-cloud.js +1 -1
  13. package/cjs/core/index.js +1 -1
  14. package/cjs/core/instance-manager.js +1 -1
  15. package/cjs/core/interface.js +1 -1
  16. package/cjs/core/util.js +1 -1
  17. package/cjs/core/vchart.js +3 -2
  18. package/cjs/core/vchart.js.map +1 -1
  19. package/cjs/data/initialize.js +1 -1
  20. package/cjs/data/register.js +1 -1
  21. package/cjs/series/box-plot/box-plot.js +7 -7
  22. package/cjs/series/box-plot/box-plot.js.map +1 -1
  23. package/esm/animation/index.js +1 -2
  24. package/esm/compile/state-manager.js +2 -1
  25. package/esm/constant/gradient.js +2 -1
  26. package/esm/constant/scroll-bar.js +1 -2
  27. package/esm/constant/sunburst.js +1 -1
  28. package/esm/constant/waterfall.js +1 -1
  29. package/esm/constant/word-cloud.js +1 -1
  30. package/esm/core/index.js +1 -1
  31. package/esm/core/instance-manager.js +1 -1
  32. package/esm/core/interface.js +1 -1
  33. package/esm/core/util.js +1 -1
  34. package/esm/core/vchart.js +3 -2
  35. package/esm/core/vchart.js.map +1 -1
  36. package/esm/data/initialize.js +1 -1
  37. package/esm/data/register.js +1 -1
  38. package/esm/series/box-plot/box-plot.js +6 -6
  39. package/esm/series/box-plot/box-plot.js.map +1 -1
  40. package/package.json +9 -9
package/build/index.es.js CHANGED
@@ -11430,9 +11430,7 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
11430
11430
  background: null,
11431
11431
  autoAnimateTexture: !1,
11432
11432
  textureRatio: 1,
11433
- textureOptions: {
11434
- alignToGraphic: !0
11435
- },
11433
+ textureOptions: null,
11436
11434
  backgroundOpacity: 1,
11437
11435
  backgroundCornerRadius: 0,
11438
11436
  texture: null,
@@ -16067,7 +16065,6 @@ const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "ancho
16067
16065
  const tempConstantXYKey = ["x", "y"],
16068
16066
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
16069
16067
  tempConstantAngleKey = ["angle"],
16070
- builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
16071
16068
  point = new Point();
16072
16069
  const NOWORK_ANIMATE_ATTR = {
16073
16070
  strokeSeg: 1,
@@ -16124,7 +16121,7 @@ class Graphic extends Node {
16124
16121
  }
16125
16122
  constructor(params = {}) {
16126
16123
  var _a;
16127
- super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
16124
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
16128
16125
  }
16129
16126
  getGraphicService() {
16130
16127
  var _a, _b;
@@ -16313,7 +16310,7 @@ class Graphic extends Node {
16313
16310
  });
16314
16311
  }
16315
16312
  setAttributes(params, forceUpdateTag = !1, context) {
16316
- params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
16313
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
16317
16314
  }
16318
16315
  _setAttributes(params, forceUpdateTag = !1, context) {
16319
16316
  const keys = Object.keys(params);
@@ -16328,7 +16325,7 @@ class Graphic extends Node {
16328
16325
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
16329
16326
  [key]: value
16330
16327
  }, this.attribute, key, context);
16331
- params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
16328
+ params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
16332
16329
  }
16333
16330
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
16334
16331
  for (let i = 0; i < k.length; i++) {
@@ -16347,7 +16344,7 @@ class Graphic extends Node {
16347
16344
  const context = {
16348
16345
  type: AttributeUpdateType.INIT
16349
16346
  };
16350
- params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
16347
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
16351
16348
  }
16352
16349
  translate(x, y) {
16353
16350
  var _a, _b;
@@ -16738,9 +16735,6 @@ class Graphic extends Node {
16738
16735
  function backgroundNotImage(image) {
16739
16736
  return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
16740
16737
  }
16741
- function isExternalTexture(texture) {
16742
- return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
16743
- }
16744
16738
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
16745
16739
 
16746
16740
  var GroupUpdateAABBBoundsMode;
@@ -20505,43 +20499,38 @@ class DefaultBaseTextureRenderContribution {
20505
20499
  texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
20506
20500
  }
20507
20501
  drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
20508
- var _a, _b, _c, _d, _e, _f;
20502
+ var _a;
20509
20503
  const {
20510
20504
  textureRatio = graphicAttribute.textureRatio,
20511
20505
  textureOptions = null
20512
20506
  } = graphic.attribute;
20513
- let pattern = null;
20514
- const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
20515
- patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
20516
- if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
20517
- if ("string" == typeof texture) switch (texture) {
20518
- case "circle":
20519
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20520
- break;
20521
- case "diamond":
20522
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20523
- break;
20524
- case "rect":
20525
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20526
- break;
20527
- case "vertical-line":
20528
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20529
- break;
20530
- case "horizontal-line":
20531
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20532
- break;
20533
- case "bias-lr":
20534
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20535
- break;
20536
- case "bias-rl":
20537
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20538
- break;
20539
- case "grid":
20540
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20541
- }
20542
- pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
20507
+ let pattern = this.textureMap.get(texture);
20508
+ if (!pattern) switch (texture) {
20509
+ case "circle":
20510
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20511
+ break;
20512
+ case "diamond":
20513
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20514
+ break;
20515
+ case "rect":
20516
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20517
+ break;
20518
+ case "vertical-line":
20519
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20520
+ break;
20521
+ case "horizontal-line":
20522
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20523
+ break;
20524
+ case "bias-lr":
20525
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20526
+ break;
20527
+ case "bias-rl":
20528
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20529
+ break;
20530
+ case "grid":
20531
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20543
20532
  }
20544
- if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
20533
+ if (textureOptions && textureOptions.dynamicTexture) {
20545
20534
  const {
20546
20535
  gridConfig = {},
20547
20536
  useNewCanvas: useNewCanvas
@@ -20586,24 +20575,10 @@ class DefaultBaseTextureRenderContribution {
20586
20575
  for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
20587
20576
  const _x = x + cellSize / 2 + j * cellSize,
20588
20577
  _y = y + cellSize / 2 + i * cellSize;
20589
- null === (_b = textureOptions.beforeDynamicTexture) || void 0 === _b || _b.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
20578
+ null === (_a = textureOptions.beforeDynamicTexture) || void 0 === _a || _a.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
20590
20579
  }
20591
20580
  useNewCanvas && (originalContext.globalAlpha = 1, originalContext.drawImage(newCanvas.nativeCanvas, 0, 0, newCanvas.nativeCanvas.width, newCanvas.nativeCanvas.height, b.x1, b.y1, b.width() * originalContext.dpr, b.height() * originalContext.dpr)), originalContext.restore();
20592
- } else if (pattern) {
20593
- if (pattern.setTransform) {
20594
- const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
20595
- alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
20596
- alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
20597
- let translateX = 0,
20598
- translateY = 0;
20599
- if (alignToGraphic) {
20600
- const m = context.currentMatrix;
20601
- translateX = (null !== (_e = null == m ? void 0 : m.e) && void 0 !== _e ? _e : 0) + x + alignOffsetX, translateY = (null !== (_f = null == m ? void 0 : m.f) && void 0 !== _f ? _f : 0) + y + alignOffsetY;
20602
- } else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
20603
- pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
20604
- }
20605
- context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
20606
- } else if ("wave" === texture) {
20581
+ } else if (pattern) context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();else if ("wave" === texture) {
20607
20582
  context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
20608
20583
  const b = graphic.AABBBounds;
20609
20584
  drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
@@ -20611,45 +20586,6 @@ class DefaultBaseTextureRenderContribution {
20611
20586
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
20612
20587
  }
20613
20588
  }
20614
- getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
20615
- return "string" != typeof texture ? texturePadding > 0 || textureRadius > 0 ? null : texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
20616
- }
20617
- createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
20618
- var _a;
20619
- const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
20620
- data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
20621
- if (!data) return null;
20622
- if (texturePadding > 0 || textureRadius > 0) {
20623
- const w = data.naturalWidth || data.width,
20624
- h = data.naturalHeight || data.height;
20625
- if (w > 0 && h > 0) {
20626
- const tileW = w + 2 * texturePadding,
20627
- tileH = h + 2 * texturePadding,
20628
- canvas = canvasAllocate.allocate({
20629
- width: tileW,
20630
- height: tileH,
20631
- dpr: context.dpr
20632
- }),
20633
- ctx = canvas.getContext("2d");
20634
- if (ctx) {
20635
- if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
20636
- const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
20637
- x0 = texturePadding,
20638
- y0 = texturePadding,
20639
- x1 = x0 + w,
20640
- y1 = y0 + h;
20641
- ctx.beginPath(), ctx.moveTo(x0 + r, y0), ctx.lineTo(x1 - r, y0), ctx.quadraticCurveTo(x1, y0, x1, y0 + r), ctx.lineTo(x1, y1 - r), ctx.quadraticCurveTo(x1, y1, x1 - r, y1), ctx.lineTo(x0 + r, y1), ctx.quadraticCurveTo(x0, y1, x0, y1 - r), ctx.lineTo(x0, y0 + r), ctx.quadraticCurveTo(x0, y0, x0 + r, y0), ctx.closePath(), ctx.clip();
20642
- }
20643
- ctx.drawImage(data, texturePadding, texturePadding, w, h);
20644
- const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
20645
- return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), canvasAllocate.free(canvas), pattern;
20646
- }
20647
- canvasAllocate.free(canvas);
20648
- }
20649
- }
20650
- const pattern = context.createPattern(data, "repeat");
20651
- return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
20652
- }
20653
20589
  }
20654
20590
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
20655
20591
 
@@ -62119,8 +62055,9 @@ class VChart {
62119
62055
  ]);
62120
62056
  }
62121
62057
  _reSetRenderState() {
62058
+ var _a, _b;
62122
62059
  this._renderState = RenderStateEnum.render;
62123
- this.getStage().eventSystem.resumeTriggerEvent();
62060
+ (_b = (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.eventSystem) === null || _b === void 0 ? void 0 : _b.resumeTriggerEvent();
62124
62061
  }
62125
62062
  }
62126
62063
  VChart.InstanceManager = InstanceManager;
@@ -77606,13 +77543,13 @@ class BoxPlotSeries extends CartesianSeries {
77606
77543
  this.initBoxPlotMarkStyle();
77607
77544
  }
77608
77545
  _getMarkWidth() {
77609
- var _a;
77546
+ var _a, _b;
77610
77547
  if (this._autoBoxWidth) {
77611
77548
  return this._autoBoxWidth;
77612
77549
  }
77613
77550
  const bandAxisHelper = this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper;
77614
77551
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
77615
- const bandWidth = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1);
77552
+ const bandWidth = (_b = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1)) !== null && _b !== void 0 ? _b : Math.max(this._boxWidth, this._shaftWidth);
77616
77553
  let width = bandWidth;
77617
77554
  if (isValid$1(this._spec.boxWidth)) {
77618
77555
  width = getActualNumValue(this._spec.boxWidth, bandWidth);
@@ -77627,7 +77564,7 @@ class BoxPlotSeries extends CartesianSeries {
77627
77564
  return this._autoBoxWidth;
77628
77565
  }
77629
77566
  _getPosition(direction, datum) {
77630
- var _a, _b, _c, _d;
77567
+ var _a, _b, _c, _d, _e, _f;
77631
77568
  let axisHelper;
77632
77569
  let sizeAttribute;
77633
77570
  let dataToPosition;
@@ -77644,7 +77581,7 @@ class BoxPlotSeries extends CartesianSeries {
77644
77581
  const scale = axisHelper.getScale(0);
77645
77582
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
77646
77583
  const depth = depthFromSpec;
77647
- const bandWidth = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
77584
+ const bandWidth = (_b = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1)) !== null && _b !== void 0 ? _b : Math.max(this._boxWidth, this._shaftWidth);
77648
77585
  const size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
77649
77586
  if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
77650
77587
  const groupFields = this._groups.fields;
@@ -77653,9 +77590,9 @@ class BoxPlotSeries extends CartesianSeries {
77653
77590
  let offSet = 0;
77654
77591
  for (let index = groupFields.length - 1; index >= 1; index--) {
77655
77592
  const groupField = groupFields[index];
77656
- const groupValues = (_c = (_b = axisHelper.getScale(index)) === null || _b === void 0 ? void 0 : _b.domain()) !== null && _c !== void 0 ? _c : [];
77593
+ const groupValues = (_d = (_c = axisHelper.getScale(index)) === null || _c === void 0 ? void 0 : _c.domain()) !== null && _d !== void 0 ? _d : [];
77657
77594
  const groupCount = groupValues.length;
77658
- const gap = getActualNumValue((_d = boxGapInGroup[index - 1]) !== null && _d !== void 0 ? _d : last(boxGapInGroup), bandWidth);
77595
+ const gap = getActualNumValue((_e = boxGapInGroup[index - 1]) !== null && _e !== void 0 ? _e : last(boxGapInGroup), bandWidth);
77659
77596
  const i = groupValues.indexOf(datum[groupField]);
77660
77597
  if (index === groupFields.length - 1) {
77661
77598
  totalWidth += groupCount * size + (groupCount - 1) * gap;
@@ -77666,7 +77603,8 @@ class BoxPlotSeries extends CartesianSeries {
77666
77603
  totalWidth += totalWidth + (groupCount - 1) * gap;
77667
77604
  }
77668
77605
  }
77669
- const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
77606
+ const center = scale.scale(datum[groupFields[0]]) +
77607
+ ((_f = axisHelper.getBandwidth(0)) !== null && _f !== void 0 ? _f : Math.max(this._boxWidth, this._shaftWidth)) / 2;
77670
77608
  return center - totalWidth / 2 + offSet + size / 2;
77671
77609
  }
77672
77610
  const continuous = isContinuous(scale.type || 'band');
package/build/index.js CHANGED
@@ -11436,9 +11436,7 @@
11436
11436
  background: null,
11437
11437
  autoAnimateTexture: !1,
11438
11438
  textureRatio: 1,
11439
- textureOptions: {
11440
- alignToGraphic: !0
11441
- },
11439
+ textureOptions: null,
11442
11440
  backgroundOpacity: 1,
11443
11441
  backgroundCornerRadius: 0,
11444
11442
  texture: null,
@@ -16073,7 +16071,6 @@
16073
16071
  const tempConstantXYKey = ["x", "y"],
16074
16072
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
16075
16073
  tempConstantAngleKey = ["angle"],
16076
- builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
16077
16074
  point = new Point();
16078
16075
  const NOWORK_ANIMATE_ATTR = {
16079
16076
  strokeSeg: 1,
@@ -16130,7 +16127,7 @@
16130
16127
  }
16131
16128
  constructor(params = {}) {
16132
16129
  var _a;
16133
- super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
16130
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
16134
16131
  }
16135
16132
  getGraphicService() {
16136
16133
  var _a, _b;
@@ -16319,7 +16316,7 @@
16319
16316
  });
16320
16317
  }
16321
16318
  setAttributes(params, forceUpdateTag = !1, context) {
16322
- params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
16319
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
16323
16320
  }
16324
16321
  _setAttributes(params, forceUpdateTag = !1, context) {
16325
16322
  const keys = Object.keys(params);
@@ -16334,7 +16331,7 @@
16334
16331
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
16335
16332
  [key]: value
16336
16333
  }, this.attribute, key, context);
16337
- params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
16334
+ params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
16338
16335
  }
16339
16336
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
16340
16337
  for (let i = 0; i < k.length; i++) {
@@ -16353,7 +16350,7 @@
16353
16350
  const context = {
16354
16351
  type: AttributeUpdateType.INIT
16355
16352
  };
16356
- params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
16353
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
16357
16354
  }
16358
16355
  translate(x, y) {
16359
16356
  var _a, _b;
@@ -16744,9 +16741,6 @@
16744
16741
  function backgroundNotImage(image) {
16745
16742
  return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
16746
16743
  }
16747
- function isExternalTexture(texture) {
16748
- return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
16749
- }
16750
16744
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
16751
16745
 
16752
16746
  var GroupUpdateAABBBoundsMode;
@@ -20511,43 +20505,38 @@
20511
20505
  texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
20512
20506
  }
20513
20507
  drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
20514
- var _a, _b, _c, _d, _e, _f;
20508
+ var _a;
20515
20509
  const {
20516
20510
  textureRatio = graphicAttribute.textureRatio,
20517
20511
  textureOptions = null
20518
20512
  } = graphic.attribute;
20519
- let pattern = null;
20520
- const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
20521
- patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
20522
- if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
20523
- if ("string" == typeof texture) switch (texture) {
20524
- case "circle":
20525
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20526
- break;
20527
- case "diamond":
20528
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20529
- break;
20530
- case "rect":
20531
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20532
- break;
20533
- case "vertical-line":
20534
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20535
- break;
20536
- case "horizontal-line":
20537
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20538
- break;
20539
- case "bias-lr":
20540
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20541
- break;
20542
- case "bias-rl":
20543
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20544
- break;
20545
- case "grid":
20546
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20547
- }
20548
- pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
20513
+ let pattern = this.textureMap.get(texture);
20514
+ if (!pattern) switch (texture) {
20515
+ case "circle":
20516
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20517
+ break;
20518
+ case "diamond":
20519
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20520
+ break;
20521
+ case "rect":
20522
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20523
+ break;
20524
+ case "vertical-line":
20525
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20526
+ break;
20527
+ case "horizontal-line":
20528
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20529
+ break;
20530
+ case "bias-lr":
20531
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20532
+ break;
20533
+ case "bias-rl":
20534
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20535
+ break;
20536
+ case "grid":
20537
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20549
20538
  }
20550
- if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
20539
+ if (textureOptions && textureOptions.dynamicTexture) {
20551
20540
  const {
20552
20541
  gridConfig = {},
20553
20542
  useNewCanvas: useNewCanvas
@@ -20592,24 +20581,10 @@
20592
20581
  for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
20593
20582
  const _x = x + cellSize / 2 + j * cellSize,
20594
20583
  _y = y + cellSize / 2 + i * cellSize;
20595
- null === (_b = textureOptions.beforeDynamicTexture) || void 0 === _b || _b.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
20584
+ null === (_a = textureOptions.beforeDynamicTexture) || void 0 === _a || _a.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
20596
20585
  }
20597
20586
  useNewCanvas && (originalContext.globalAlpha = 1, originalContext.drawImage(newCanvas.nativeCanvas, 0, 0, newCanvas.nativeCanvas.width, newCanvas.nativeCanvas.height, b.x1, b.y1, b.width() * originalContext.dpr, b.height() * originalContext.dpr)), originalContext.restore();
20598
- } else if (pattern) {
20599
- if (pattern.setTransform) {
20600
- const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
20601
- alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
20602
- alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
20603
- let translateX = 0,
20604
- translateY = 0;
20605
- if (alignToGraphic) {
20606
- const m = context.currentMatrix;
20607
- translateX = (null !== (_e = null == m ? void 0 : m.e) && void 0 !== _e ? _e : 0) + x + alignOffsetX, translateY = (null !== (_f = null == m ? void 0 : m.f) && void 0 !== _f ? _f : 0) + y + alignOffsetY;
20608
- } else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
20609
- pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
20610
- }
20611
- context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
20612
- } else if ("wave" === texture) {
20587
+ } else if (pattern) context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();else if ("wave" === texture) {
20613
20588
  context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
20614
20589
  const b = graphic.AABBBounds;
20615
20590
  drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
@@ -20617,45 +20592,6 @@
20617
20592
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
20618
20593
  }
20619
20594
  }
20620
- getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
20621
- return "string" != typeof texture ? texturePadding > 0 || textureRadius > 0 ? null : texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
20622
- }
20623
- createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
20624
- var _a;
20625
- const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
20626
- data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
20627
- if (!data) return null;
20628
- if (texturePadding > 0 || textureRadius > 0) {
20629
- const w = data.naturalWidth || data.width,
20630
- h = data.naturalHeight || data.height;
20631
- if (w > 0 && h > 0) {
20632
- const tileW = w + 2 * texturePadding,
20633
- tileH = h + 2 * texturePadding,
20634
- canvas = canvasAllocate.allocate({
20635
- width: tileW,
20636
- height: tileH,
20637
- dpr: context.dpr
20638
- }),
20639
- ctx = canvas.getContext("2d");
20640
- if (ctx) {
20641
- if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
20642
- const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
20643
- x0 = texturePadding,
20644
- y0 = texturePadding,
20645
- x1 = x0 + w,
20646
- y1 = y0 + h;
20647
- ctx.beginPath(), ctx.moveTo(x0 + r, y0), ctx.lineTo(x1 - r, y0), ctx.quadraticCurveTo(x1, y0, x1, y0 + r), ctx.lineTo(x1, y1 - r), ctx.quadraticCurveTo(x1, y1, x1 - r, y1), ctx.lineTo(x0 + r, y1), ctx.quadraticCurveTo(x0, y1, x0, y1 - r), ctx.lineTo(x0, y0 + r), ctx.quadraticCurveTo(x0, y0, x0 + r, y0), ctx.closePath(), ctx.clip();
20648
- }
20649
- ctx.drawImage(data, texturePadding, texturePadding, w, h);
20650
- const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
20651
- return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), canvasAllocate.free(canvas), pattern;
20652
- }
20653
- canvasAllocate.free(canvas);
20654
- }
20655
- }
20656
- const pattern = context.createPattern(data, "repeat");
20657
- return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
20658
- }
20659
20595
  }
20660
20596
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
20661
20597
 
@@ -62125,8 +62061,9 @@
62125
62061
  ]);
62126
62062
  }
62127
62063
  _reSetRenderState() {
62064
+ var _a, _b;
62128
62065
  this._renderState = RenderStateEnum.render;
62129
- this.getStage().eventSystem.resumeTriggerEvent();
62066
+ (_b = (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.eventSystem) === null || _b === void 0 ? void 0 : _b.resumeTriggerEvent();
62130
62067
  }
62131
62068
  }
62132
62069
  VChart.InstanceManager = InstanceManager;
@@ -77612,13 +77549,13 @@
77612
77549
  this.initBoxPlotMarkStyle();
77613
77550
  }
77614
77551
  _getMarkWidth() {
77615
- var _a;
77552
+ var _a, _b;
77616
77553
  if (this._autoBoxWidth) {
77617
77554
  return this._autoBoxWidth;
77618
77555
  }
77619
77556
  const bandAxisHelper = this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper;
77620
77557
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
77621
- const bandWidth = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1);
77558
+ const bandWidth = (_b = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1)) !== null && _b !== void 0 ? _b : Math.max(this._boxWidth, this._shaftWidth);
77622
77559
  let width = bandWidth;
77623
77560
  if (isValid$1(this._spec.boxWidth)) {
77624
77561
  width = getActualNumValue(this._spec.boxWidth, bandWidth);
@@ -77633,7 +77570,7 @@
77633
77570
  return this._autoBoxWidth;
77634
77571
  }
77635
77572
  _getPosition(direction, datum) {
77636
- var _a, _b, _c, _d;
77573
+ var _a, _b, _c, _d, _e, _f;
77637
77574
  let axisHelper;
77638
77575
  let sizeAttribute;
77639
77576
  let dataToPosition;
@@ -77650,7 +77587,7 @@
77650
77587
  const scale = axisHelper.getScale(0);
77651
77588
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
77652
77589
  const depth = depthFromSpec;
77653
- const bandWidth = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
77590
+ const bandWidth = (_b = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1)) !== null && _b !== void 0 ? _b : Math.max(this._boxWidth, this._shaftWidth);
77654
77591
  const size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
77655
77592
  if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
77656
77593
  const groupFields = this._groups.fields;
@@ -77659,9 +77596,9 @@
77659
77596
  let offSet = 0;
77660
77597
  for (let index = groupFields.length - 1; index >= 1; index--) {
77661
77598
  const groupField = groupFields[index];
77662
- const groupValues = (_c = (_b = axisHelper.getScale(index)) === null || _b === void 0 ? void 0 : _b.domain()) !== null && _c !== void 0 ? _c : [];
77599
+ const groupValues = (_d = (_c = axisHelper.getScale(index)) === null || _c === void 0 ? void 0 : _c.domain()) !== null && _d !== void 0 ? _d : [];
77663
77600
  const groupCount = groupValues.length;
77664
- const gap = getActualNumValue((_d = boxGapInGroup[index - 1]) !== null && _d !== void 0 ? _d : last(boxGapInGroup), bandWidth);
77601
+ const gap = getActualNumValue((_e = boxGapInGroup[index - 1]) !== null && _e !== void 0 ? _e : last(boxGapInGroup), bandWidth);
77665
77602
  const i = groupValues.indexOf(datum[groupField]);
77666
77603
  if (index === groupFields.length - 1) {
77667
77604
  totalWidth += groupCount * size + (groupCount - 1) * gap;
@@ -77672,7 +77609,8 @@
77672
77609
  totalWidth += totalWidth + (groupCount - 1) * gap;
77673
77610
  }
77674
77611
  }
77675
- const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
77612
+ const center = scale.scale(datum[groupFields[0]]) +
77613
+ ((_f = axisHelper.getBandwidth(0)) !== null && _f !== void 0 ? _f : Math.max(this._boxWidth, this._shaftWidth)) / 2;
77676
77614
  return center - totalWidth / 2 + offSet + size / 2;
77677
77615
  }
77678
77616
  const continuous = isContinuous(scale.type || 'band');