@visactor/vchart 2.0.22-alpha.2 → 2.0.22-alpha.3
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.
- package/build/es5/index.js +1 -1
- package/build/index.es.js +42 -105
- package/build/index.js +42 -105
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/index.js +1 -2
- package/cjs/compile/state-manager.js +2 -1
- package/cjs/constant/gradient.js +2 -1
- package/cjs/constant/scroll-bar.js +1 -2
- package/cjs/constant/sunburst.js +1 -1
- package/cjs/constant/waterfall.js +1 -1
- package/cjs/constant/word-cloud.js +1 -1
- package/cjs/core/interface.js +1 -1
- package/cjs/core/util.js +1 -1
- package/cjs/core/vchart.js +1 -1
- package/cjs/series/box-plot/box-plot.js +7 -7
- package/cjs/series/box-plot/box-plot.js.map +1 -1
- package/esm/animation/index.js +1 -2
- package/esm/compile/state-manager.js +2 -1
- package/esm/constant/gradient.js +2 -1
- package/esm/constant/scroll-bar.js +1 -2
- package/esm/constant/sunburst.js +1 -1
- package/esm/constant/waterfall.js +1 -1
- package/esm/constant/word-cloud.js +1 -1
- package/esm/core/interface.js +1 -1
- package/esm/core/util.js +1 -1
- package/esm/core/vchart.js +1 -1
- package/esm/series/box-plot/box-plot.js +6 -6
- package/esm/series/box-plot/box-plot.js.map +1 -1
- 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
|
|
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
|
|
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) : "
|
|
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
|
|
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
|
|
20502
|
+
var _a;
|
|
20509
20503
|
const {
|
|
20510
20504
|
textureRatio = graphicAttribute.textureRatio,
|
|
20511
20505
|
textureOptions = null
|
|
20512
20506
|
} = graphic.attribute;
|
|
20513
|
-
let pattern =
|
|
20514
|
-
|
|
20515
|
-
|
|
20516
|
-
|
|
20517
|
-
|
|
20518
|
-
|
|
20519
|
-
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
|
|
20523
|
-
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
|
|
20527
|
-
|
|
20528
|
-
|
|
20529
|
-
|
|
20530
|
-
|
|
20531
|
-
|
|
20532
|
-
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
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 (
|
|
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 === (
|
|
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
|
|
|
@@ -77606,13 +77542,13 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
77606
77542
|
this.initBoxPlotMarkStyle();
|
|
77607
77543
|
}
|
|
77608
77544
|
_getMarkWidth() {
|
|
77609
|
-
var _a;
|
|
77545
|
+
var _a, _b;
|
|
77610
77546
|
if (this._autoBoxWidth) {
|
|
77611
77547
|
return this._autoBoxWidth;
|
|
77612
77548
|
}
|
|
77613
77549
|
const bandAxisHelper = this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper;
|
|
77614
77550
|
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);
|
|
77551
|
+
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
77552
|
let width = bandWidth;
|
|
77617
77553
|
if (isValid$1(this._spec.boxWidth)) {
|
|
77618
77554
|
width = getActualNumValue(this._spec.boxWidth, bandWidth);
|
|
@@ -77627,7 +77563,7 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
77627
77563
|
return this._autoBoxWidth;
|
|
77628
77564
|
}
|
|
77629
77565
|
_getPosition(direction, datum) {
|
|
77630
|
-
var _a, _b, _c, _d;
|
|
77566
|
+
var _a, _b, _c, _d, _e, _f;
|
|
77631
77567
|
let axisHelper;
|
|
77632
77568
|
let sizeAttribute;
|
|
77633
77569
|
let dataToPosition;
|
|
@@ -77644,7 +77580,7 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
77644
77580
|
const scale = axisHelper.getScale(0);
|
|
77645
77581
|
const depthFromSpec = this._groups ? this._groups.fields.length : 1;
|
|
77646
77582
|
const depth = depthFromSpec;
|
|
77647
|
-
const bandWidth = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
|
|
77583
|
+
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
77584
|
const size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
|
|
77649
77585
|
if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
|
|
77650
77586
|
const groupFields = this._groups.fields;
|
|
@@ -77653,9 +77589,9 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
77653
77589
|
let offSet = 0;
|
|
77654
77590
|
for (let index = groupFields.length - 1; index >= 1; index--) {
|
|
77655
77591
|
const groupField = groupFields[index];
|
|
77656
|
-
const groupValues = (
|
|
77592
|
+
const groupValues = (_d = (_c = axisHelper.getScale(index)) === null || _c === void 0 ? void 0 : _c.domain()) !== null && _d !== void 0 ? _d : [];
|
|
77657
77593
|
const groupCount = groupValues.length;
|
|
77658
|
-
const gap = getActualNumValue((
|
|
77594
|
+
const gap = getActualNumValue((_e = boxGapInGroup[index - 1]) !== null && _e !== void 0 ? _e : last(boxGapInGroup), bandWidth);
|
|
77659
77595
|
const i = groupValues.indexOf(datum[groupField]);
|
|
77660
77596
|
if (index === groupFields.length - 1) {
|
|
77661
77597
|
totalWidth += groupCount * size + (groupCount - 1) * gap;
|
|
@@ -77666,7 +77602,8 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
77666
77602
|
totalWidth += totalWidth + (groupCount - 1) * gap;
|
|
77667
77603
|
}
|
|
77668
77604
|
}
|
|
77669
|
-
const center = scale.scale(datum[groupFields[0]]) +
|
|
77605
|
+
const center = scale.scale(datum[groupFields[0]]) +
|
|
77606
|
+
((_f = axisHelper.getBandwidth(0)) !== null && _f !== void 0 ? _f : Math.max(this._boxWidth, this._shaftWidth)) / 2;
|
|
77670
77607
|
return center - totalWidth / 2 + offSet + size / 2;
|
|
77671
77608
|
}
|
|
77672
77609
|
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
|
|
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
|
|
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) : "
|
|
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
|
|
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
|
|
20508
|
+
var _a;
|
|
20515
20509
|
const {
|
|
20516
20510
|
textureRatio = graphicAttribute.textureRatio,
|
|
20517
20511
|
textureOptions = null
|
|
20518
20512
|
} = graphic.attribute;
|
|
20519
|
-
let pattern =
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
|
|
20523
|
-
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
|
|
20527
|
-
|
|
20528
|
-
|
|
20529
|
-
|
|
20530
|
-
|
|
20531
|
-
|
|
20532
|
-
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
20538
|
-
|
|
20539
|
-
|
|
20540
|
-
|
|
20541
|
-
|
|
20542
|
-
|
|
20543
|
-
|
|
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 (
|
|
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 === (
|
|
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
|
|
|
@@ -77612,13 +77548,13 @@
|
|
|
77612
77548
|
this.initBoxPlotMarkStyle();
|
|
77613
77549
|
}
|
|
77614
77550
|
_getMarkWidth() {
|
|
77615
|
-
var _a;
|
|
77551
|
+
var _a, _b;
|
|
77616
77552
|
if (this._autoBoxWidth) {
|
|
77617
77553
|
return this._autoBoxWidth;
|
|
77618
77554
|
}
|
|
77619
77555
|
const bandAxisHelper = this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper;
|
|
77620
77556
|
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);
|
|
77557
|
+
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
77558
|
let width = bandWidth;
|
|
77623
77559
|
if (isValid$1(this._spec.boxWidth)) {
|
|
77624
77560
|
width = getActualNumValue(this._spec.boxWidth, bandWidth);
|
|
@@ -77633,7 +77569,7 @@
|
|
|
77633
77569
|
return this._autoBoxWidth;
|
|
77634
77570
|
}
|
|
77635
77571
|
_getPosition(direction, datum) {
|
|
77636
|
-
var _a, _b, _c, _d;
|
|
77572
|
+
var _a, _b, _c, _d, _e, _f;
|
|
77637
77573
|
let axisHelper;
|
|
77638
77574
|
let sizeAttribute;
|
|
77639
77575
|
let dataToPosition;
|
|
@@ -77650,7 +77586,7 @@
|
|
|
77650
77586
|
const scale = axisHelper.getScale(0);
|
|
77651
77587
|
const depthFromSpec = this._groups ? this._groups.fields.length : 1;
|
|
77652
77588
|
const depth = depthFromSpec;
|
|
77653
|
-
const bandWidth = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
|
|
77589
|
+
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
77590
|
const size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
|
|
77655
77591
|
if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
|
|
77656
77592
|
const groupFields = this._groups.fields;
|
|
@@ -77659,9 +77595,9 @@
|
|
|
77659
77595
|
let offSet = 0;
|
|
77660
77596
|
for (let index = groupFields.length - 1; index >= 1; index--) {
|
|
77661
77597
|
const groupField = groupFields[index];
|
|
77662
|
-
const groupValues = (
|
|
77598
|
+
const groupValues = (_d = (_c = axisHelper.getScale(index)) === null || _c === void 0 ? void 0 : _c.domain()) !== null && _d !== void 0 ? _d : [];
|
|
77663
77599
|
const groupCount = groupValues.length;
|
|
77664
|
-
const gap = getActualNumValue((
|
|
77600
|
+
const gap = getActualNumValue((_e = boxGapInGroup[index - 1]) !== null && _e !== void 0 ? _e : last(boxGapInGroup), bandWidth);
|
|
77665
77601
|
const i = groupValues.indexOf(datum[groupField]);
|
|
77666
77602
|
if (index === groupFields.length - 1) {
|
|
77667
77603
|
totalWidth += groupCount * size + (groupCount - 1) * gap;
|
|
@@ -77672,7 +77608,8 @@
|
|
|
77672
77608
|
totalWidth += totalWidth + (groupCount - 1) * gap;
|
|
77673
77609
|
}
|
|
77674
77610
|
}
|
|
77675
|
-
const center = scale.scale(datum[groupFields[0]]) +
|
|
77611
|
+
const center = scale.scale(datum[groupFields[0]]) +
|
|
77612
|
+
((_f = axisHelper.getBandwidth(0)) !== null && _f !== void 0 ? _f : Math.max(this._boxWidth, this._shaftWidth)) / 2;
|
|
77676
77613
|
return center - totalWidth / 2 + offSet + size / 2;
|
|
77677
77614
|
}
|
|
77678
77615
|
const continuous = isContinuous(scale.type || 'band');
|