@visactor/vchart 2.0.10-alpha.0 → 2.0.10-alpha.1
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 +239 -32
- package/build/index.js +239 -32
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/box-plot/box-plot-transformer.js +1 -1
- package/cjs/chart/box-plot/box-plot-transformer.js.map +1 -1
- package/cjs/component/axis/base-axis.js +2 -2
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +1 -1
- package/cjs/mark/base/base-mark.js +3 -3
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/series/box-plot/box-plot.d.ts +3 -1
- package/cjs/series/box-plot/box-plot.js +54 -29
- package/cjs/series/box-plot/box-plot.js.map +1 -1
- package/cjs/series/box-plot/interface.d.ts +7 -2
- package/cjs/series/box-plot/interface.js.map +1 -1
- package/cjs/theme/token/builtin/default.js +1 -1
- package/cjs/theme/token/builtin/default.js.map +1 -1
- package/cjs/typings/visual.d.ts +3 -3
- package/cjs/typings/visual.js.map +1 -1
- package/esm/chart/box-plot/box-plot-transformer.js +1 -1
- package/esm/chart/box-plot/box-plot-transformer.js.map +1 -1
- package/esm/component/axis/base-axis.js +2 -2
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +1 -1
- package/esm/mark/base/base-mark.js +3 -3
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/series/box-plot/box-plot.d.ts +3 -1
- package/esm/series/box-plot/box-plot.js +56 -29
- package/esm/series/box-plot/box-plot.js.map +1 -1
- package/esm/series/box-plot/interface.d.ts +7 -2
- package/esm/series/box-plot/interface.js.map +1 -1
- package/esm/theme/token/builtin/default.js +1 -1
- package/esm/theme/token/builtin/default.js.map +1 -1
- package/esm/typings/visual.d.ts +3 -3
- package/esm/typings/visual.js.map +1 -1
- package/package.json +8 -8
package/build/index.js
CHANGED
|
@@ -9506,7 +9506,7 @@
|
|
|
9506
9506
|
|
|
9507
9507
|
const EnvContribution = Symbol.for("EnvContribution");
|
|
9508
9508
|
const VGlobal = Symbol.for("VGlobal");
|
|
9509
|
-
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui
|
|
9509
|
+
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
9510
9510
|
|
|
9511
9511
|
const container = new Container();
|
|
9512
9512
|
|
|
@@ -11247,7 +11247,7 @@
|
|
|
11247
11247
|
textAlign: "left",
|
|
11248
11248
|
textBaseline: "alphabetic",
|
|
11249
11249
|
fontSize: 16,
|
|
11250
|
-
fontFamily: "PingFang SC,Microsoft Yahei,system-ui
|
|
11250
|
+
fontFamily: "PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",
|
|
11251
11251
|
fontWeight: "",
|
|
11252
11252
|
ellipsis: "…",
|
|
11253
11253
|
fontVariant: "",
|
|
@@ -16315,7 +16315,7 @@
|
|
|
16315
16315
|
}
|
|
16316
16316
|
}]), noAnimateAttrs && this.setAttributesAndPreventAnimate(noAnimateAttrs, !1, {
|
|
16317
16317
|
type: AttributeUpdateType.STATE
|
|
16318
|
-
});
|
|
16318
|
+
}), this.finalAttribute && Object.assign(this.finalAttribute, attrs);
|
|
16319
16319
|
} else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
|
|
16320
16320
|
type: AttributeUpdateType.STATE
|
|
16321
16321
|
}), this.finalAttribute && Object.assign(this.finalAttribute, attrs);
|
|
@@ -16341,7 +16341,7 @@
|
|
|
16341
16341
|
getNormalAttribute(key) {
|
|
16342
16342
|
var _a, _b;
|
|
16343
16343
|
const value = this.attribute[key];
|
|
16344
|
-
return this.animates ? null === (_a = this.finalAttribute) || void 0 === _a ? void 0 : _a[key] : null != value ? value : null === (_b = this.finalAttribute) || void 0 === _b ? void 0 : _b[key];
|
|
16344
|
+
return this.animates && this.animates.size ? null === (_a = this.finalAttribute) || void 0 === _a ? void 0 : _a[key] : null != value ? value : null === (_b = this.finalAttribute) || void 0 === _b ? void 0 : _b[key];
|
|
16345
16345
|
}
|
|
16346
16346
|
clearStates(hasAnimation) {
|
|
16347
16347
|
this.hasState() && this.normalAttrs ? (this.currentStates = [], this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [], this.normalAttrs = null;
|
|
@@ -33191,7 +33191,7 @@
|
|
|
33191
33191
|
|
|
33192
33192
|
var AXIS_ELEMENT_NAME;
|
|
33193
33193
|
!function (AXIS_ELEMENT_NAME) {
|
|
33194
|
-
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
33194
|
+
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.labelHoverOnAxis = "axis-label-hover-on-axis", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
33195
33195
|
}(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
|
|
33196
33196
|
var AxisStateValue;
|
|
33197
33197
|
!function (AxisStateValue) {
|
|
@@ -33228,6 +33228,26 @@
|
|
|
33228
33228
|
fillOpacity: 1
|
|
33229
33229
|
}
|
|
33230
33230
|
},
|
|
33231
|
+
labelHoverOnAxis: {
|
|
33232
|
+
visible: !1,
|
|
33233
|
+
space: 7,
|
|
33234
|
+
padding: 2,
|
|
33235
|
+
position: 0,
|
|
33236
|
+
autoRotate: !1,
|
|
33237
|
+
textStyle: {
|
|
33238
|
+
fontSize: 12,
|
|
33239
|
+
fill: "red",
|
|
33240
|
+
fontWeight: "normal",
|
|
33241
|
+
fillOpacity: 1
|
|
33242
|
+
},
|
|
33243
|
+
background: {
|
|
33244
|
+
visible: !0,
|
|
33245
|
+
style: {
|
|
33246
|
+
cornerRadius: 2,
|
|
33247
|
+
fill: "black"
|
|
33248
|
+
}
|
|
33249
|
+
}
|
|
33250
|
+
},
|
|
33231
33251
|
tick: {
|
|
33232
33252
|
visible: !0,
|
|
33233
33253
|
inside: !1,
|
|
@@ -40393,7 +40413,17 @@
|
|
|
40393
40413
|
loadLineAxisComponent();
|
|
40394
40414
|
class LineAxis extends AxisBase {
|
|
40395
40415
|
constructor(attributes, options) {
|
|
40396
|
-
|
|
40416
|
+
var _a;
|
|
40417
|
+
if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) {
|
|
40418
|
+
const {
|
|
40419
|
+
padding = 2
|
|
40420
|
+
} = attributes.labelHoverOnAxis,
|
|
40421
|
+
parsedPadding = normalizePadding(padding),
|
|
40422
|
+
toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3],
|
|
40423
|
+
space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding;
|
|
40424
|
+
attributes.labelHoverOnAxis.space = space;
|
|
40425
|
+
}
|
|
40426
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null;
|
|
40397
40427
|
}
|
|
40398
40428
|
_renderInner(container) {
|
|
40399
40429
|
var _a;
|
|
@@ -40455,6 +40485,15 @@
|
|
|
40455
40485
|
}, panel.style));
|
|
40456
40486
|
bgRect.name = AXIS_ELEMENT_NAME.background, bgRect.id = this._getNodeId("background"), bgRect.states = merge$1({}, DEFAULT_STATES$1, null !== (_a = panel.state) && void 0 !== _a ? _a : {}), axisContainer.insertBefore(bgRect, axisContainer.firstChild);
|
|
40457
40487
|
}
|
|
40488
|
+
const {
|
|
40489
|
+
labelHoverOnAxis: labelHoverOnAxis
|
|
40490
|
+
} = this.attribute;
|
|
40491
|
+
labelHoverOnAxis && labelHoverOnAxis.visible && this.renderLabelHoverOnAxis();
|
|
40492
|
+
}
|
|
40493
|
+
renderLabelHoverOnAxis() {
|
|
40494
|
+
const hoverOnLabelAttributes = this.getLabelHoverOnAxisAttribute(),
|
|
40495
|
+
hoverOnLabel = new Tag(Object.assign({}, hoverOnLabelAttributes));
|
|
40496
|
+
hoverOnLabel.name = AXIS_ELEMENT_NAME.title, hoverOnLabel.id = this._getNodeId("hover-on-label"), this.labelHoverOnAxisGroup = hoverOnLabel, this.axisContainer.add(hoverOnLabel);
|
|
40458
40497
|
}
|
|
40459
40498
|
renderLine(container) {
|
|
40460
40499
|
const {
|
|
@@ -40595,6 +40634,66 @@
|
|
|
40595
40634
|
visible: !0
|
|
40596
40635
|
}, background.style)), attrs;
|
|
40597
40636
|
}
|
|
40637
|
+
getLabelHoverOnAxisAttribute() {
|
|
40638
|
+
var _a, _b;
|
|
40639
|
+
const {
|
|
40640
|
+
orient: orient
|
|
40641
|
+
} = this.attribute,
|
|
40642
|
+
_c = this.attribute.labelHoverOnAxis,
|
|
40643
|
+
{
|
|
40644
|
+
position = 0,
|
|
40645
|
+
space = 4,
|
|
40646
|
+
autoRotate = !0,
|
|
40647
|
+
textStyle = {},
|
|
40648
|
+
background = {},
|
|
40649
|
+
formatMethod: formatMethod,
|
|
40650
|
+
text: textContent = "",
|
|
40651
|
+
maxWidth: maxWidth
|
|
40652
|
+
} = _c,
|
|
40653
|
+
restAttrs = __rest$b(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]),
|
|
40654
|
+
point = this.getTickCoord(0);
|
|
40655
|
+
"bottom" === orient || "top" === orient ? point.x = position : point.y = position;
|
|
40656
|
+
let tickLength = 0;
|
|
40657
|
+
(null === (_a = this.attribute.tick) || void 0 === _a ? void 0 : _a.visible) && !1 === this.attribute.tick.inside && (tickLength = this.attribute.tick.length || 4), (null === (_b = this.attribute.subTick) || void 0 === _b ? void 0 : _b.visible) && !1 === this.attribute.subTick.inside && (tickLength = Math.max(tickLength, this.attribute.subTick.length || 2));
|
|
40658
|
+
const offset = tickLength + 0 + space,
|
|
40659
|
+
labelPoint = this.getVerticalCoord(point, offset, !1),
|
|
40660
|
+
vector = this.getVerticalVector(offset, !1, {
|
|
40661
|
+
x: 0,
|
|
40662
|
+
y: 0
|
|
40663
|
+
});
|
|
40664
|
+
let textBaseline,
|
|
40665
|
+
{
|
|
40666
|
+
angle: angle
|
|
40667
|
+
} = restAttrs,
|
|
40668
|
+
textAlign = "center";
|
|
40669
|
+
if (isNil$1(angle) && autoRotate) {
|
|
40670
|
+
const axisVector = this.getRelativeVector();
|
|
40671
|
+
angle = angleTo(axisVector, [1, 0], !0);
|
|
40672
|
+
const {
|
|
40673
|
+
verticalFactor = 1
|
|
40674
|
+
} = this.attribute;
|
|
40675
|
+
textBaseline = 1 === -1 * verticalFactor ? "bottom" : "top";
|
|
40676
|
+
} else {
|
|
40677
|
+
const {
|
|
40678
|
+
textAlign: textAlign2,
|
|
40679
|
+
textBaseline: textBaseline2
|
|
40680
|
+
} = this.getLabelAlign(vector, !1, textStyle.angle);
|
|
40681
|
+
textAlign = textAlign2, textBaseline = textBaseline2;
|
|
40682
|
+
}
|
|
40683
|
+
const maxTagWidth = maxWidth,
|
|
40684
|
+
text = formatMethod ? formatMethod(textContent) : textContent,
|
|
40685
|
+
attrs = Object.assign(Object.assign(Object.assign({}, labelPoint), restAttrs), {
|
|
40686
|
+
maxWidth: maxTagWidth,
|
|
40687
|
+
textStyle: Object.assign({
|
|
40688
|
+
textAlign: textAlign,
|
|
40689
|
+
textBaseline: textBaseline
|
|
40690
|
+
}, textStyle),
|
|
40691
|
+
text: text
|
|
40692
|
+
});
|
|
40693
|
+
return attrs.angle = angle, background && background.visible && (attrs.panel = Object.assign(Object.assign({
|
|
40694
|
+
visible: !0
|
|
40695
|
+
}, restAttrs.panel), background.style)), attrs;
|
|
40696
|
+
}
|
|
40598
40697
|
getTextBaseline(vector, inside) {
|
|
40599
40698
|
let base = "middle";
|
|
40600
40699
|
const {
|
|
@@ -40785,6 +40884,40 @@
|
|
|
40785
40884
|
}
|
|
40786
40885
|
return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength;
|
|
40787
40886
|
}
|
|
40887
|
+
showLabelHoverOnAxis(position, text, adjustPosition = !0) {
|
|
40888
|
+
if (this.attribute.labelHoverOnAxis) {
|
|
40889
|
+
const preContainerBounds = this.axisContainer.AABBBounds,
|
|
40890
|
+
preWidth = preContainerBounds.width(),
|
|
40891
|
+
preHeight = preContainerBounds.height(),
|
|
40892
|
+
preX1 = preContainerBounds.x1,
|
|
40893
|
+
preY1 = preContainerBounds.y1,
|
|
40894
|
+
preX2 = preContainerBounds.x2,
|
|
40895
|
+
preY2 = preContainerBounds.y2;
|
|
40896
|
+
if (this.labelHoverOnAxisGroup) {
|
|
40897
|
+
const {
|
|
40898
|
+
formatMethod: formatMethod
|
|
40899
|
+
} = this.attribute.labelHoverOnAxis,
|
|
40900
|
+
textStr = formatMethod ? formatMethod(text) : text;
|
|
40901
|
+
this.labelHoverOnAxisGroup.setAttribute("text", textStr), this.labelHoverOnAxisGroup.setAttribute("visible", !0), this.labelHoverOnAxisGroup.setAttribute("visibleAll", !0), "left" === this.attribute.orient || "right" === this.attribute.orient ? this.labelHoverOnAxisGroup.setAttributes({
|
|
40902
|
+
y: position
|
|
40903
|
+
}) : this.labelHoverOnAxisGroup.setAttributes({
|
|
40904
|
+
x: position
|
|
40905
|
+
});
|
|
40906
|
+
} else this.attribute.labelHoverOnAxis.visible = !0, this.attribute.labelHoverOnAxis.position = position, this.attribute.labelHoverOnAxis.text = text, this.renderLabelHoverOnAxis();
|
|
40907
|
+
if (adjustPosition) {
|
|
40908
|
+
const afterContainerBounds = this.axisContainer.AABBBounds,
|
|
40909
|
+
diffWidth = afterContainerBounds.width() - preWidth,
|
|
40910
|
+
diffHeight = afterContainerBounds.height() - preHeight;
|
|
40911
|
+
diffWidth > 0 && ("top" === this.attribute.orient || "bottom" === this.attribute.orient) && (afterContainerBounds.x1 < preX1 ? this.showLabelHoverOnAxis(position + diffWidth, text, !1) : afterContainerBounds.x2 > preX2 && this.showLabelHoverOnAxis(position - diffWidth, text, !1)), diffHeight > 0 && ("left" === this.attribute.orient || "right" === this.attribute.orient) && (afterContainerBounds.y1 < preY1 ? this.showLabelHoverOnAxis(position + diffHeight, text, !1) : afterContainerBounds.y2 > preY2 && this.showLabelHoverOnAxis(position - diffHeight, text, !1));
|
|
40912
|
+
}
|
|
40913
|
+
}
|
|
40914
|
+
}
|
|
40915
|
+
hideLabelHoverOnAxis() {
|
|
40916
|
+
this.attribute.labelHoverOnAxis && this.labelHoverOnAxisGroup && this.labelHoverOnAxisGroup.setAttributes({
|
|
40917
|
+
visible: !1,
|
|
40918
|
+
visibleAll: !1
|
|
40919
|
+
});
|
|
40920
|
+
}
|
|
40788
40921
|
release() {
|
|
40789
40922
|
super.release(), this._breaks = null;
|
|
40790
40923
|
}
|
|
@@ -52330,7 +52463,7 @@
|
|
|
52330
52463
|
}
|
|
52331
52464
|
|
|
52332
52465
|
const token = {
|
|
52333
|
-
fontFamily:
|
|
52466
|
+
fontFamily: `PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol`,
|
|
52334
52467
|
fontSize: 14,
|
|
52335
52468
|
l1FontSize: 32,
|
|
52336
52469
|
l1LineHeight: '150%',
|
|
@@ -57914,7 +58047,7 @@
|
|
|
57914
58047
|
}
|
|
57915
58048
|
}
|
|
57916
58049
|
};
|
|
57917
|
-
this._setStateOfGraphic = (g) => {
|
|
58050
|
+
this._setStateOfGraphic = (g, hasAnimation) => {
|
|
57918
58051
|
g.clearStates();
|
|
57919
58052
|
g.stateProxy = null;
|
|
57920
58053
|
if (g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update) {
|
|
@@ -57922,7 +58055,7 @@
|
|
|
57922
58055
|
var _a;
|
|
57923
58056
|
return this._runEncoderOfGraphic((_a = this._encoderOfState) === null || _a === void 0 ? void 0 : _a[stateName], g);
|
|
57924
58057
|
};
|
|
57925
|
-
g.context.states && g.useStates(g.context.states);
|
|
58058
|
+
g.context.states && g.useStates(g.context.states, hasAnimation);
|
|
57926
58059
|
}
|
|
57927
58060
|
};
|
|
57928
58061
|
this.name = name;
|
|
@@ -58675,7 +58808,7 @@
|
|
|
58675
58808
|
g.setFinalAttributes(finalAttrs);
|
|
58676
58809
|
}
|
|
58677
58810
|
}
|
|
58678
|
-
this._setStateOfGraphic(g);
|
|
58811
|
+
this._setStateOfGraphic(g, hasStateAnimation);
|
|
58679
58812
|
this._setGraphicFromMarkConfig(g);
|
|
58680
58813
|
});
|
|
58681
58814
|
}
|
|
@@ -61400,7 +61533,7 @@
|
|
|
61400
61533
|
});
|
|
61401
61534
|
};
|
|
61402
61535
|
|
|
61403
|
-
const version = "2.0.10-alpha.
|
|
61536
|
+
const version = "2.0.10-alpha.1";
|
|
61404
61537
|
|
|
61405
61538
|
const addVChartProperty = (data, op) => {
|
|
61406
61539
|
const context = op.beforeCall();
|
|
@@ -66086,7 +66219,7 @@
|
|
|
66086
66219
|
_getGridAttributes() {
|
|
66087
66220
|
const spec = this._spec;
|
|
66088
66221
|
return {
|
|
66089
|
-
alternateColor:
|
|
66222
|
+
alternateColor: spec.grid.alternateColor,
|
|
66090
66223
|
alignWithLabel: spec.grid.alignWithLabel,
|
|
66091
66224
|
style: isFunction$1(spec.grid.style)
|
|
66092
66225
|
? (datum, index) => {
|
|
@@ -66100,9 +66233,7 @@
|
|
|
66100
66233
|
: {
|
|
66101
66234
|
type: 'line',
|
|
66102
66235
|
visible: spec.subGrid.visible,
|
|
66103
|
-
alternateColor:
|
|
66104
|
-
? spec.subGrid.alternateColor()
|
|
66105
|
-
: spec.subGrid.alternateColor,
|
|
66236
|
+
alternateColor: spec.subGrid.alternateColor,
|
|
66106
66237
|
style: transformToGraphic(spec.subGrid.style)
|
|
66107
66238
|
}
|
|
66108
66239
|
};
|
|
@@ -76421,6 +76552,7 @@
|
|
|
76421
76552
|
constructor() {
|
|
76422
76553
|
super(...arguments);
|
|
76423
76554
|
this.type = exports.SeriesTypeEnum.boxPlot;
|
|
76555
|
+
this._bandPosition = 0;
|
|
76424
76556
|
}
|
|
76425
76557
|
getMinField() {
|
|
76426
76558
|
return this._minField;
|
|
@@ -76453,7 +76585,7 @@
|
|
|
76453
76585
|
return this._outliersStyle;
|
|
76454
76586
|
}
|
|
76455
76587
|
setAttrFromSpec() {
|
|
76456
|
-
var _a, _b, _c, _d, _e;
|
|
76588
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
76457
76589
|
super.setAttrFromSpec();
|
|
76458
76590
|
const boxPlotStyle = (_b = (_a = this._spec.boxPlot) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
76459
76591
|
this._minField = this._spec.minField;
|
|
@@ -76470,7 +76602,7 @@
|
|
|
76470
76602
|
this._strokeColor = boxPlotStyle.stroke;
|
|
76471
76603
|
this._shaftFillOpacity =
|
|
76472
76604
|
this._shaftShape === 'bar' ? (_e = boxPlotStyle.shaftFillOpacity) !== null && _e !== void 0 ? _e : DEFAULT_SHAFT_FILL_OPACITY : undefined;
|
|
76473
|
-
this._outliersStyle = this._spec.outliersStyle;
|
|
76605
|
+
this._outliersStyle = ((_f = this._spec.outliersStyle) !== null && _f !== void 0 ? _f : (_g = this._spec.outlier) === null || _g === void 0 ? void 0 : _g.style);
|
|
76474
76606
|
}
|
|
76475
76607
|
initMark() {
|
|
76476
76608
|
this._boxPlotMark = this._createMark(BoxPlotSeries.mark.boxPlot, {
|
|
@@ -76492,24 +76624,37 @@
|
|
|
76492
76624
|
if (boxPlotMark) {
|
|
76493
76625
|
const commonBoxplotStyles = {
|
|
76494
76626
|
lineWidth: this._lineWidth,
|
|
76495
|
-
fill: (_a = this._boxFillColor) !== null && _a !== void 0 ? _a : (this._shaftShape
|
|
76627
|
+
fill: (_a = this._boxFillColor) !== null && _a !== void 0 ? _a : (this._shaftShape !== 'line' ? this.getColorAttribute() : DEFAULT_FILL_COLOR),
|
|
76496
76628
|
minMaxFillOpacity: this._shaftFillOpacity,
|
|
76497
|
-
stroke: (_b = this._strokeColor) !== null && _b !== void 0 ? _b : (this._shaftShape
|
|
76629
|
+
stroke: (_b = this._strokeColor) !== null && _b !== void 0 ? _b : (this._shaftShape !== 'line' ? DEFAULT_STROKE_COLOR : this.getColorAttribute())
|
|
76498
76630
|
};
|
|
76499
76631
|
boxPlotMark.setGlyphConfig({
|
|
76500
76632
|
direction: this._direction,
|
|
76501
76633
|
shaftShape: this._shaftShape
|
|
76502
76634
|
});
|
|
76503
76635
|
const boxPlotMarkStyles = this._direction === "horizontal"
|
|
76504
|
-
?
|
|
76505
|
-
|
|
76636
|
+
? {
|
|
76637
|
+
y: (datum) => this._getPosition(this.direction, datum),
|
|
76638
|
+
boxHeight: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76639
|
+
ruleHeight: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76640
|
+
q1q3Height: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76641
|
+
minMaxHeight: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); }
|
|
76642
|
+
}
|
|
76643
|
+
: {
|
|
76644
|
+
x: (datum) => this._getPosition(this.direction, datum),
|
|
76645
|
+
boxWidth: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76646
|
+
ruleWidth: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76647
|
+
q1q3Width: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76648
|
+
minMaxWidth: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); }
|
|
76649
|
+
};
|
|
76650
|
+
this.setMarkStyle(boxPlotMark, commonBoxplotStyles, exports.STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
|
|
76651
|
+
this.setMarkStyle(boxPlotMark, boxPlotMarkStyles, exports.STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Built_In);
|
|
76506
76652
|
}
|
|
76507
76653
|
const outlierMark = this._outlierMark;
|
|
76508
76654
|
if (outlierMark) {
|
|
76509
76655
|
this.setMarkStyle(outlierMark, {
|
|
76510
76656
|
fill: (_d = (_c = this._outliersStyle) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : this.getColorAttribute(),
|
|
76511
|
-
size: isNumber$1((_e = this._outliersStyle) === null || _e === void 0 ? void 0 : _e.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
|
|
76512
|
-
symbolType: 'circle'
|
|
76657
|
+
size: isNumber$1((_e = this._outliersStyle) === null || _e === void 0 ? void 0 : _e.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
|
|
76513
76658
|
}, exports.STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
|
|
76514
76659
|
}
|
|
76515
76660
|
}
|
|
@@ -76544,13 +76689,13 @@
|
|
|
76544
76689
|
const scale = (_b = axisHelper === null || axisHelper === void 0 ? void 0 : axisHelper.getScale) === null || _b === void 0 ? void 0 : _b.call(axisHelper, 0);
|
|
76545
76690
|
const outlierMarkPositionChannel = this._direction === "horizontal"
|
|
76546
76691
|
? {
|
|
76547
|
-
y: this.
|
|
76692
|
+
y: (datum) => this._getPosition(this.direction, datum),
|
|
76548
76693
|
x: (datum) => valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, BOX_PLOT_OUTLIER_VALUE_FIELD), {
|
|
76549
76694
|
bandPosition: this._bandPosition
|
|
76550
76695
|
}), scale)
|
|
76551
76696
|
}
|
|
76552
76697
|
: {
|
|
76553
|
-
x: this.
|
|
76698
|
+
x: (datum) => this._getPosition(this.direction, datum),
|
|
76554
76699
|
y: (datum) => valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, BOX_PLOT_OUTLIER_VALUE_FIELD), {
|
|
76555
76700
|
bandPosition: this._bandPosition
|
|
76556
76701
|
}), scale)
|
|
@@ -76596,16 +76741,73 @@
|
|
|
76596
76741
|
this.initBoxPlotMarkStyle();
|
|
76597
76742
|
}
|
|
76598
76743
|
_getMarkWidth() {
|
|
76744
|
+
var _a;
|
|
76599
76745
|
if (this._autoBoxWidth) {
|
|
76600
76746
|
return this._autoBoxWidth;
|
|
76601
76747
|
}
|
|
76602
76748
|
const bandAxisHelper = this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper;
|
|
76603
|
-
const
|
|
76604
|
-
const
|
|
76605
|
-
|
|
76606
|
-
this.
|
|
76749
|
+
const depthFromSpec = this._groups ? this._groups.fields.length : 1;
|
|
76750
|
+
const bandWidth = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1);
|
|
76751
|
+
let width = bandWidth;
|
|
76752
|
+
if (isValid$1(this._spec.boxWidth)) {
|
|
76753
|
+
width = getActualNumValue(this._spec.boxWidth, bandWidth);
|
|
76754
|
+
}
|
|
76755
|
+
if (isValid$1(this._spec.boxMinWidth)) {
|
|
76756
|
+
width = Math.max(width, getActualNumValue(this._spec.boxMinWidth, bandWidth));
|
|
76757
|
+
}
|
|
76758
|
+
if (isValid$1(this._spec.boxMaxWidth)) {
|
|
76759
|
+
width = Math.min(width, getActualNumValue(this._spec.boxMaxWidth, bandWidth));
|
|
76760
|
+
}
|
|
76761
|
+
this._autoBoxWidth = width;
|
|
76607
76762
|
return this._autoBoxWidth;
|
|
76608
76763
|
}
|
|
76764
|
+
_getPosition(direction, datum) {
|
|
76765
|
+
var _a, _b, _c, _d;
|
|
76766
|
+
let axisHelper;
|
|
76767
|
+
let sizeAttribute;
|
|
76768
|
+
let dataToPosition;
|
|
76769
|
+
if (direction === "horizontal") {
|
|
76770
|
+
axisHelper = this.getYAxisHelper();
|
|
76771
|
+
sizeAttribute = 'boxHeight';
|
|
76772
|
+
dataToPosition = this.dataToPositionY.bind(this);
|
|
76773
|
+
}
|
|
76774
|
+
else {
|
|
76775
|
+
axisHelper = this.getXAxisHelper();
|
|
76776
|
+
sizeAttribute = 'boxWidth';
|
|
76777
|
+
dataToPosition = this.dataToPositionX.bind(this);
|
|
76778
|
+
}
|
|
76779
|
+
const scale = axisHelper.getScale(0);
|
|
76780
|
+
const depthFromSpec = this._groups ? this._groups.fields.length : 1;
|
|
76781
|
+
const depth = depthFromSpec;
|
|
76782
|
+
const bandWidth = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
|
|
76783
|
+
const size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
|
|
76784
|
+
if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
|
|
76785
|
+
const groupFields = this._groups.fields;
|
|
76786
|
+
const boxGapInGroup = array(this._spec.boxGapInGroup);
|
|
76787
|
+
let totalWidth = 0;
|
|
76788
|
+
let offSet = 0;
|
|
76789
|
+
for (let index = groupFields.length - 1; index >= 1; index--) {
|
|
76790
|
+
const groupField = groupFields[index];
|
|
76791
|
+
const groupValues = (_c = (_b = axisHelper.getScale(index)) === null || _b === void 0 ? void 0 : _b.domain()) !== null && _c !== void 0 ? _c : [];
|
|
76792
|
+
const groupCount = groupValues.length;
|
|
76793
|
+
const gap = getActualNumValue((_d = boxGapInGroup[index - 1]) !== null && _d !== void 0 ? _d : last(boxGapInGroup), bandWidth);
|
|
76794
|
+
const i = groupValues.indexOf(datum[groupField]);
|
|
76795
|
+
if (index === groupFields.length - 1) {
|
|
76796
|
+
totalWidth += groupCount * size + (groupCount - 1) * gap;
|
|
76797
|
+
offSet += i * (size + gap);
|
|
76798
|
+
}
|
|
76799
|
+
else {
|
|
76800
|
+
offSet += i * (totalWidth + gap);
|
|
76801
|
+
totalWidth += totalWidth + (groupCount - 1) * gap;
|
|
76802
|
+
}
|
|
76803
|
+
}
|
|
76804
|
+
const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
|
|
76805
|
+
return center - totalWidth / 2 + offSet + size / 2;
|
|
76806
|
+
}
|
|
76807
|
+
const continuous = isContinuous(scale.type || 'band');
|
|
76808
|
+
const pos = dataToPosition(datum);
|
|
76809
|
+
return pos + bandWidth * 0.5 + (continuous ? -bandWidth / 2 : 0);
|
|
76810
|
+
}
|
|
76609
76811
|
onLayoutEnd() {
|
|
76610
76812
|
super.onLayoutEnd();
|
|
76611
76813
|
this._autoBoxWidth = null;
|
|
@@ -76614,10 +76816,10 @@
|
|
|
76614
76816
|
const newConfig = merge$1({}, config);
|
|
76615
76817
|
['appear', 'enter', 'update', 'exit', 'disappear'].forEach(state => {
|
|
76616
76818
|
if (newConfig[state] && newConfig[state].type === 'scaleIn') {
|
|
76617
|
-
newConfig[state].type = this._shaftShape === '
|
|
76819
|
+
newConfig[state].type = this._shaftShape === 'bar' ? 'barBoxplotScaleIn' : 'boxplotScaleIn';
|
|
76618
76820
|
}
|
|
76619
76821
|
else if (newConfig[state] && newConfig[state].type === 'scaleOut') {
|
|
76620
|
-
newConfig[state].type = this._shaftShape === '
|
|
76822
|
+
newConfig[state].type = this._shaftShape === 'bar' ? 'barBoxplotScaleOut' : 'boxplotScaleOut';
|
|
76621
76823
|
}
|
|
76622
76824
|
});
|
|
76623
76825
|
return newConfig;
|
|
@@ -93836,13 +94038,18 @@
|
|
|
93836
94038
|
const dataFields = [spec.maxField, spec.medianField, spec.q1Field, spec.q3Field, spec.minField, spec.outliersField];
|
|
93837
94039
|
const seriesSpec = super._getDefaultSeriesSpec(spec, [
|
|
93838
94040
|
'boxPlot',
|
|
94041
|
+
'outlier',
|
|
93839
94042
|
'minField',
|
|
93840
94043
|
'maxField',
|
|
93841
94044
|
'q1Field',
|
|
93842
94045
|
'medianField',
|
|
93843
94046
|
'q3Field',
|
|
93844
94047
|
'outliersField',
|
|
93845
|
-
'outliersStyle'
|
|
94048
|
+
'outliersStyle',
|
|
94049
|
+
'boxWidth',
|
|
94050
|
+
'boxMaxWidth',
|
|
94051
|
+
'boxMinWidth',
|
|
94052
|
+
'boxGapInGroup'
|
|
93846
94053
|
]);
|
|
93847
94054
|
seriesSpec.direction = (_a = spec.direction) !== null && _a !== void 0 ? _a : "vertical";
|
|
93848
94055
|
seriesSpec[seriesSpec.direction === "horizontal" ? 'xField' : 'yField'] = dataFields;
|