@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.es.js
CHANGED
|
@@ -9500,7 +9500,7 @@ class SyncHook extends Hook {
|
|
|
9500
9500
|
|
|
9501
9501
|
const EnvContribution = Symbol.for("EnvContribution");
|
|
9502
9502
|
const VGlobal = Symbol.for("VGlobal");
|
|
9503
|
-
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui
|
|
9503
|
+
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";
|
|
9504
9504
|
|
|
9505
9505
|
const container = new Container();
|
|
9506
9506
|
|
|
@@ -11241,7 +11241,7 @@ const DefaultTextStyle = {
|
|
|
11241
11241
|
textAlign: "left",
|
|
11242
11242
|
textBaseline: "alphabetic",
|
|
11243
11243
|
fontSize: 16,
|
|
11244
|
-
fontFamily: "PingFang SC,Microsoft Yahei,system-ui
|
|
11244
|
+
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",
|
|
11245
11245
|
fontWeight: "",
|
|
11246
11246
|
ellipsis: "…",
|
|
11247
11247
|
fontVariant: "",
|
|
@@ -16309,7 +16309,7 @@ class Graphic extends Node {
|
|
|
16309
16309
|
}
|
|
16310
16310
|
}]), noAnimateAttrs && this.setAttributesAndPreventAnimate(noAnimateAttrs, !1, {
|
|
16311
16311
|
type: AttributeUpdateType.STATE
|
|
16312
|
-
});
|
|
16312
|
+
}), this.finalAttribute && Object.assign(this.finalAttribute, attrs);
|
|
16313
16313
|
} else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
|
|
16314
16314
|
type: AttributeUpdateType.STATE
|
|
16315
16315
|
}), this.finalAttribute && Object.assign(this.finalAttribute, attrs);
|
|
@@ -16335,7 +16335,7 @@ class Graphic extends Node {
|
|
|
16335
16335
|
getNormalAttribute(key) {
|
|
16336
16336
|
var _a, _b;
|
|
16337
16337
|
const value = this.attribute[key];
|
|
16338
|
-
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];
|
|
16338
|
+
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];
|
|
16339
16339
|
}
|
|
16340
16340
|
clearStates(hasAnimation) {
|
|
16341
16341
|
this.hasState() && this.normalAttrs ? (this.currentStates = [], this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [], this.normalAttrs = null;
|
|
@@ -33185,7 +33185,7 @@ class ArcSegment extends Segment {
|
|
|
33185
33185
|
|
|
33186
33186
|
var AXIS_ELEMENT_NAME;
|
|
33187
33187
|
!function (AXIS_ELEMENT_NAME) {
|
|
33188
|
-
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";
|
|
33188
|
+
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";
|
|
33189
33189
|
}(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
|
|
33190
33190
|
var AxisStateValue;
|
|
33191
33191
|
!function (AxisStateValue) {
|
|
@@ -33222,6 +33222,26 @@ const DEFAULT_AXIS_THEME = {
|
|
|
33222
33222
|
fillOpacity: 1
|
|
33223
33223
|
}
|
|
33224
33224
|
},
|
|
33225
|
+
labelHoverOnAxis: {
|
|
33226
|
+
visible: !1,
|
|
33227
|
+
space: 7,
|
|
33228
|
+
padding: 2,
|
|
33229
|
+
position: 0,
|
|
33230
|
+
autoRotate: !1,
|
|
33231
|
+
textStyle: {
|
|
33232
|
+
fontSize: 12,
|
|
33233
|
+
fill: "red",
|
|
33234
|
+
fontWeight: "normal",
|
|
33235
|
+
fillOpacity: 1
|
|
33236
|
+
},
|
|
33237
|
+
background: {
|
|
33238
|
+
visible: !0,
|
|
33239
|
+
style: {
|
|
33240
|
+
cornerRadius: 2,
|
|
33241
|
+
fill: "black"
|
|
33242
|
+
}
|
|
33243
|
+
}
|
|
33244
|
+
},
|
|
33225
33245
|
tick: {
|
|
33226
33246
|
visible: !0,
|
|
33227
33247
|
inside: !1,
|
|
@@ -40387,7 +40407,17 @@ var __rest$b = undefined && undefined.__rest || function (s, e) {
|
|
|
40387
40407
|
loadLineAxisComponent();
|
|
40388
40408
|
class LineAxis extends AxisBase {
|
|
40389
40409
|
constructor(attributes, options) {
|
|
40390
|
-
|
|
40410
|
+
var _a;
|
|
40411
|
+
if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) {
|
|
40412
|
+
const {
|
|
40413
|
+
padding = 2
|
|
40414
|
+
} = attributes.labelHoverOnAxis,
|
|
40415
|
+
parsedPadding = normalizePadding(padding),
|
|
40416
|
+
toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3],
|
|
40417
|
+
space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding;
|
|
40418
|
+
attributes.labelHoverOnAxis.space = space;
|
|
40419
|
+
}
|
|
40420
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null;
|
|
40391
40421
|
}
|
|
40392
40422
|
_renderInner(container) {
|
|
40393
40423
|
var _a;
|
|
@@ -40449,6 +40479,15 @@ class LineAxis extends AxisBase {
|
|
|
40449
40479
|
}, panel.style));
|
|
40450
40480
|
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);
|
|
40451
40481
|
}
|
|
40482
|
+
const {
|
|
40483
|
+
labelHoverOnAxis: labelHoverOnAxis
|
|
40484
|
+
} = this.attribute;
|
|
40485
|
+
labelHoverOnAxis && labelHoverOnAxis.visible && this.renderLabelHoverOnAxis();
|
|
40486
|
+
}
|
|
40487
|
+
renderLabelHoverOnAxis() {
|
|
40488
|
+
const hoverOnLabelAttributes = this.getLabelHoverOnAxisAttribute(),
|
|
40489
|
+
hoverOnLabel = new Tag(Object.assign({}, hoverOnLabelAttributes));
|
|
40490
|
+
hoverOnLabel.name = AXIS_ELEMENT_NAME.title, hoverOnLabel.id = this._getNodeId("hover-on-label"), this.labelHoverOnAxisGroup = hoverOnLabel, this.axisContainer.add(hoverOnLabel);
|
|
40452
40491
|
}
|
|
40453
40492
|
renderLine(container) {
|
|
40454
40493
|
const {
|
|
@@ -40589,6 +40628,66 @@ class LineAxis extends AxisBase {
|
|
|
40589
40628
|
visible: !0
|
|
40590
40629
|
}, background.style)), attrs;
|
|
40591
40630
|
}
|
|
40631
|
+
getLabelHoverOnAxisAttribute() {
|
|
40632
|
+
var _a, _b;
|
|
40633
|
+
const {
|
|
40634
|
+
orient: orient
|
|
40635
|
+
} = this.attribute,
|
|
40636
|
+
_c = this.attribute.labelHoverOnAxis,
|
|
40637
|
+
{
|
|
40638
|
+
position = 0,
|
|
40639
|
+
space = 4,
|
|
40640
|
+
autoRotate = !0,
|
|
40641
|
+
textStyle = {},
|
|
40642
|
+
background = {},
|
|
40643
|
+
formatMethod: formatMethod,
|
|
40644
|
+
text: textContent = "",
|
|
40645
|
+
maxWidth: maxWidth
|
|
40646
|
+
} = _c,
|
|
40647
|
+
restAttrs = __rest$b(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]),
|
|
40648
|
+
point = this.getTickCoord(0);
|
|
40649
|
+
"bottom" === orient || "top" === orient ? point.x = position : point.y = position;
|
|
40650
|
+
let tickLength = 0;
|
|
40651
|
+
(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));
|
|
40652
|
+
const offset = tickLength + 0 + space,
|
|
40653
|
+
labelPoint = this.getVerticalCoord(point, offset, !1),
|
|
40654
|
+
vector = this.getVerticalVector(offset, !1, {
|
|
40655
|
+
x: 0,
|
|
40656
|
+
y: 0
|
|
40657
|
+
});
|
|
40658
|
+
let textBaseline,
|
|
40659
|
+
{
|
|
40660
|
+
angle: angle
|
|
40661
|
+
} = restAttrs,
|
|
40662
|
+
textAlign = "center";
|
|
40663
|
+
if (isNil$1(angle) && autoRotate) {
|
|
40664
|
+
const axisVector = this.getRelativeVector();
|
|
40665
|
+
angle = angleTo(axisVector, [1, 0], !0);
|
|
40666
|
+
const {
|
|
40667
|
+
verticalFactor = 1
|
|
40668
|
+
} = this.attribute;
|
|
40669
|
+
textBaseline = 1 === -1 * verticalFactor ? "bottom" : "top";
|
|
40670
|
+
} else {
|
|
40671
|
+
const {
|
|
40672
|
+
textAlign: textAlign2,
|
|
40673
|
+
textBaseline: textBaseline2
|
|
40674
|
+
} = this.getLabelAlign(vector, !1, textStyle.angle);
|
|
40675
|
+
textAlign = textAlign2, textBaseline = textBaseline2;
|
|
40676
|
+
}
|
|
40677
|
+
const maxTagWidth = maxWidth,
|
|
40678
|
+
text = formatMethod ? formatMethod(textContent) : textContent,
|
|
40679
|
+
attrs = Object.assign(Object.assign(Object.assign({}, labelPoint), restAttrs), {
|
|
40680
|
+
maxWidth: maxTagWidth,
|
|
40681
|
+
textStyle: Object.assign({
|
|
40682
|
+
textAlign: textAlign,
|
|
40683
|
+
textBaseline: textBaseline
|
|
40684
|
+
}, textStyle),
|
|
40685
|
+
text: text
|
|
40686
|
+
});
|
|
40687
|
+
return attrs.angle = angle, background && background.visible && (attrs.panel = Object.assign(Object.assign({
|
|
40688
|
+
visible: !0
|
|
40689
|
+
}, restAttrs.panel), background.style)), attrs;
|
|
40690
|
+
}
|
|
40592
40691
|
getTextBaseline(vector, inside) {
|
|
40593
40692
|
let base = "middle";
|
|
40594
40693
|
const {
|
|
@@ -40779,6 +40878,40 @@ class LineAxis extends AxisBase {
|
|
|
40779
40878
|
}
|
|
40780
40879
|
return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength;
|
|
40781
40880
|
}
|
|
40881
|
+
showLabelHoverOnAxis(position, text, adjustPosition = !0) {
|
|
40882
|
+
if (this.attribute.labelHoverOnAxis) {
|
|
40883
|
+
const preContainerBounds = this.axisContainer.AABBBounds,
|
|
40884
|
+
preWidth = preContainerBounds.width(),
|
|
40885
|
+
preHeight = preContainerBounds.height(),
|
|
40886
|
+
preX1 = preContainerBounds.x1,
|
|
40887
|
+
preY1 = preContainerBounds.y1,
|
|
40888
|
+
preX2 = preContainerBounds.x2,
|
|
40889
|
+
preY2 = preContainerBounds.y2;
|
|
40890
|
+
if (this.labelHoverOnAxisGroup) {
|
|
40891
|
+
const {
|
|
40892
|
+
formatMethod: formatMethod
|
|
40893
|
+
} = this.attribute.labelHoverOnAxis,
|
|
40894
|
+
textStr = formatMethod ? formatMethod(text) : text;
|
|
40895
|
+
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({
|
|
40896
|
+
y: position
|
|
40897
|
+
}) : this.labelHoverOnAxisGroup.setAttributes({
|
|
40898
|
+
x: position
|
|
40899
|
+
});
|
|
40900
|
+
} else this.attribute.labelHoverOnAxis.visible = !0, this.attribute.labelHoverOnAxis.position = position, this.attribute.labelHoverOnAxis.text = text, this.renderLabelHoverOnAxis();
|
|
40901
|
+
if (adjustPosition) {
|
|
40902
|
+
const afterContainerBounds = this.axisContainer.AABBBounds,
|
|
40903
|
+
diffWidth = afterContainerBounds.width() - preWidth,
|
|
40904
|
+
diffHeight = afterContainerBounds.height() - preHeight;
|
|
40905
|
+
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));
|
|
40906
|
+
}
|
|
40907
|
+
}
|
|
40908
|
+
}
|
|
40909
|
+
hideLabelHoverOnAxis() {
|
|
40910
|
+
this.attribute.labelHoverOnAxis && this.labelHoverOnAxisGroup && this.labelHoverOnAxisGroup.setAttributes({
|
|
40911
|
+
visible: !1,
|
|
40912
|
+
visibleAll: !1
|
|
40913
|
+
});
|
|
40914
|
+
}
|
|
40782
40915
|
release() {
|
|
40783
40916
|
super.release(), this._breaks = null;
|
|
40784
40917
|
}
|
|
@@ -52324,7 +52457,7 @@ function isTokenKey(obj) {
|
|
|
52324
52457
|
}
|
|
52325
52458
|
|
|
52326
52459
|
const token = {
|
|
52327
|
-
fontFamily:
|
|
52460
|
+
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`,
|
|
52328
52461
|
fontSize: 14,
|
|
52329
52462
|
l1FontSize: 32,
|
|
52330
52463
|
l1LineHeight: '150%',
|
|
@@ -57908,7 +58041,7 @@ class BaseMark extends GrammarItem {
|
|
|
57908
58041
|
}
|
|
57909
58042
|
}
|
|
57910
58043
|
};
|
|
57911
|
-
this._setStateOfGraphic = (g) => {
|
|
58044
|
+
this._setStateOfGraphic = (g, hasAnimation) => {
|
|
57912
58045
|
g.clearStates();
|
|
57913
58046
|
g.stateProxy = null;
|
|
57914
58047
|
if (g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update) {
|
|
@@ -57916,7 +58049,7 @@ class BaseMark extends GrammarItem {
|
|
|
57916
58049
|
var _a;
|
|
57917
58050
|
return this._runEncoderOfGraphic((_a = this._encoderOfState) === null || _a === void 0 ? void 0 : _a[stateName], g);
|
|
57918
58051
|
};
|
|
57919
|
-
g.context.states && g.useStates(g.context.states);
|
|
58052
|
+
g.context.states && g.useStates(g.context.states, hasAnimation);
|
|
57920
58053
|
}
|
|
57921
58054
|
};
|
|
57922
58055
|
this.name = name;
|
|
@@ -58669,7 +58802,7 @@ class BaseMark extends GrammarItem {
|
|
|
58669
58802
|
g.setFinalAttributes(finalAttrs);
|
|
58670
58803
|
}
|
|
58671
58804
|
}
|
|
58672
|
-
this._setStateOfGraphic(g);
|
|
58805
|
+
this._setStateOfGraphic(g, hasStateAnimation);
|
|
58673
58806
|
this._setGraphicFromMarkConfig(g);
|
|
58674
58807
|
});
|
|
58675
58808
|
}
|
|
@@ -61394,7 +61527,7 @@ const lookup = (data, opt) => {
|
|
|
61394
61527
|
});
|
|
61395
61528
|
};
|
|
61396
61529
|
|
|
61397
|
-
const version = "2.0.10-alpha.
|
|
61530
|
+
const version = "2.0.10-alpha.1";
|
|
61398
61531
|
|
|
61399
61532
|
const addVChartProperty = (data, op) => {
|
|
61400
61533
|
const context = op.beforeCall();
|
|
@@ -66080,7 +66213,7 @@ class AxisComponent extends BaseComponent {
|
|
|
66080
66213
|
_getGridAttributes() {
|
|
66081
66214
|
const spec = this._spec;
|
|
66082
66215
|
return {
|
|
66083
|
-
alternateColor:
|
|
66216
|
+
alternateColor: spec.grid.alternateColor,
|
|
66084
66217
|
alignWithLabel: spec.grid.alignWithLabel,
|
|
66085
66218
|
style: isFunction$1(spec.grid.style)
|
|
66086
66219
|
? (datum, index) => {
|
|
@@ -66094,9 +66227,7 @@ class AxisComponent extends BaseComponent {
|
|
|
66094
66227
|
: {
|
|
66095
66228
|
type: 'line',
|
|
66096
66229
|
visible: spec.subGrid.visible,
|
|
66097
|
-
alternateColor:
|
|
66098
|
-
? spec.subGrid.alternateColor()
|
|
66099
|
-
: spec.subGrid.alternateColor,
|
|
66230
|
+
alternateColor: spec.subGrid.alternateColor,
|
|
66100
66231
|
style: transformToGraphic(spec.subGrid.style)
|
|
66101
66232
|
}
|
|
66102
66233
|
};
|
|
@@ -76415,6 +76546,7 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76415
76546
|
constructor() {
|
|
76416
76547
|
super(...arguments);
|
|
76417
76548
|
this.type = SeriesTypeEnum.boxPlot;
|
|
76549
|
+
this._bandPosition = 0;
|
|
76418
76550
|
}
|
|
76419
76551
|
getMinField() {
|
|
76420
76552
|
return this._minField;
|
|
@@ -76447,7 +76579,7 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76447
76579
|
return this._outliersStyle;
|
|
76448
76580
|
}
|
|
76449
76581
|
setAttrFromSpec() {
|
|
76450
|
-
var _a, _b, _c, _d, _e;
|
|
76582
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
76451
76583
|
super.setAttrFromSpec();
|
|
76452
76584
|
const boxPlotStyle = (_b = (_a = this._spec.boxPlot) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
76453
76585
|
this._minField = this._spec.minField;
|
|
@@ -76464,7 +76596,7 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76464
76596
|
this._strokeColor = boxPlotStyle.stroke;
|
|
76465
76597
|
this._shaftFillOpacity =
|
|
76466
76598
|
this._shaftShape === 'bar' ? (_e = boxPlotStyle.shaftFillOpacity) !== null && _e !== void 0 ? _e : DEFAULT_SHAFT_FILL_OPACITY : undefined;
|
|
76467
|
-
this._outliersStyle = this._spec.outliersStyle;
|
|
76599
|
+
this._outliersStyle = ((_f = this._spec.outliersStyle) !== null && _f !== void 0 ? _f : (_g = this._spec.outlier) === null || _g === void 0 ? void 0 : _g.style);
|
|
76468
76600
|
}
|
|
76469
76601
|
initMark() {
|
|
76470
76602
|
this._boxPlotMark = this._createMark(BoxPlotSeries.mark.boxPlot, {
|
|
@@ -76486,24 +76618,37 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76486
76618
|
if (boxPlotMark) {
|
|
76487
76619
|
const commonBoxplotStyles = {
|
|
76488
76620
|
lineWidth: this._lineWidth,
|
|
76489
|
-
fill: (_a = this._boxFillColor) !== null && _a !== void 0 ? _a : (this._shaftShape
|
|
76621
|
+
fill: (_a = this._boxFillColor) !== null && _a !== void 0 ? _a : (this._shaftShape !== 'line' ? this.getColorAttribute() : DEFAULT_FILL_COLOR),
|
|
76490
76622
|
minMaxFillOpacity: this._shaftFillOpacity,
|
|
76491
|
-
stroke: (_b = this._strokeColor) !== null && _b !== void 0 ? _b : (this._shaftShape
|
|
76623
|
+
stroke: (_b = this._strokeColor) !== null && _b !== void 0 ? _b : (this._shaftShape !== 'line' ? DEFAULT_STROKE_COLOR : this.getColorAttribute())
|
|
76492
76624
|
};
|
|
76493
76625
|
boxPlotMark.setGlyphConfig({
|
|
76494
76626
|
direction: this._direction,
|
|
76495
76627
|
shaftShape: this._shaftShape
|
|
76496
76628
|
});
|
|
76497
76629
|
const boxPlotMarkStyles = this._direction === "horizontal"
|
|
76498
|
-
?
|
|
76499
|
-
|
|
76630
|
+
? {
|
|
76631
|
+
y: (datum) => this._getPosition(this.direction, datum),
|
|
76632
|
+
boxHeight: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76633
|
+
ruleHeight: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76634
|
+
q1q3Height: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76635
|
+
minMaxHeight: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); }
|
|
76636
|
+
}
|
|
76637
|
+
: {
|
|
76638
|
+
x: (datum) => this._getPosition(this.direction, datum),
|
|
76639
|
+
boxWidth: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76640
|
+
ruleWidth: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76641
|
+
q1q3Width: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
|
|
76642
|
+
minMaxWidth: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); }
|
|
76643
|
+
};
|
|
76644
|
+
this.setMarkStyle(boxPlotMark, commonBoxplotStyles, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
|
|
76645
|
+
this.setMarkStyle(boxPlotMark, boxPlotMarkStyles, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Built_In);
|
|
76500
76646
|
}
|
|
76501
76647
|
const outlierMark = this._outlierMark;
|
|
76502
76648
|
if (outlierMark) {
|
|
76503
76649
|
this.setMarkStyle(outlierMark, {
|
|
76504
76650
|
fill: (_d = (_c = this._outliersStyle) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : this.getColorAttribute(),
|
|
76505
|
-
size: isNumber$1((_e = this._outliersStyle) === null || _e === void 0 ? void 0 : _e.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
|
|
76506
|
-
symbolType: 'circle'
|
|
76651
|
+
size: isNumber$1((_e = this._outliersStyle) === null || _e === void 0 ? void 0 : _e.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
|
|
76507
76652
|
}, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
|
|
76508
76653
|
}
|
|
76509
76654
|
}
|
|
@@ -76538,13 +76683,13 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76538
76683
|
const scale = (_b = axisHelper === null || axisHelper === void 0 ? void 0 : axisHelper.getScale) === null || _b === void 0 ? void 0 : _b.call(axisHelper, 0);
|
|
76539
76684
|
const outlierMarkPositionChannel = this._direction === "horizontal"
|
|
76540
76685
|
? {
|
|
76541
|
-
y: this.
|
|
76686
|
+
y: (datum) => this._getPosition(this.direction, datum),
|
|
76542
76687
|
x: (datum) => valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, BOX_PLOT_OUTLIER_VALUE_FIELD), {
|
|
76543
76688
|
bandPosition: this._bandPosition
|
|
76544
76689
|
}), scale)
|
|
76545
76690
|
}
|
|
76546
76691
|
: {
|
|
76547
|
-
x: this.
|
|
76692
|
+
x: (datum) => this._getPosition(this.direction, datum),
|
|
76548
76693
|
y: (datum) => valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, BOX_PLOT_OUTLIER_VALUE_FIELD), {
|
|
76549
76694
|
bandPosition: this._bandPosition
|
|
76550
76695
|
}), scale)
|
|
@@ -76590,16 +76735,73 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76590
76735
|
this.initBoxPlotMarkStyle();
|
|
76591
76736
|
}
|
|
76592
76737
|
_getMarkWidth() {
|
|
76738
|
+
var _a;
|
|
76593
76739
|
if (this._autoBoxWidth) {
|
|
76594
76740
|
return this._autoBoxWidth;
|
|
76595
76741
|
}
|
|
76596
76742
|
const bandAxisHelper = this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper;
|
|
76597
|
-
const
|
|
76598
|
-
const
|
|
76599
|
-
|
|
76600
|
-
this.
|
|
76743
|
+
const depthFromSpec = this._groups ? this._groups.fields.length : 1;
|
|
76744
|
+
const bandWidth = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1);
|
|
76745
|
+
let width = bandWidth;
|
|
76746
|
+
if (isValid$1(this._spec.boxWidth)) {
|
|
76747
|
+
width = getActualNumValue(this._spec.boxWidth, bandWidth);
|
|
76748
|
+
}
|
|
76749
|
+
if (isValid$1(this._spec.boxMinWidth)) {
|
|
76750
|
+
width = Math.max(width, getActualNumValue(this._spec.boxMinWidth, bandWidth));
|
|
76751
|
+
}
|
|
76752
|
+
if (isValid$1(this._spec.boxMaxWidth)) {
|
|
76753
|
+
width = Math.min(width, getActualNumValue(this._spec.boxMaxWidth, bandWidth));
|
|
76754
|
+
}
|
|
76755
|
+
this._autoBoxWidth = width;
|
|
76601
76756
|
return this._autoBoxWidth;
|
|
76602
76757
|
}
|
|
76758
|
+
_getPosition(direction, datum) {
|
|
76759
|
+
var _a, _b, _c, _d;
|
|
76760
|
+
let axisHelper;
|
|
76761
|
+
let sizeAttribute;
|
|
76762
|
+
let dataToPosition;
|
|
76763
|
+
if (direction === "horizontal") {
|
|
76764
|
+
axisHelper = this.getYAxisHelper();
|
|
76765
|
+
sizeAttribute = 'boxHeight';
|
|
76766
|
+
dataToPosition = this.dataToPositionY.bind(this);
|
|
76767
|
+
}
|
|
76768
|
+
else {
|
|
76769
|
+
axisHelper = this.getXAxisHelper();
|
|
76770
|
+
sizeAttribute = 'boxWidth';
|
|
76771
|
+
dataToPosition = this.dataToPositionX.bind(this);
|
|
76772
|
+
}
|
|
76773
|
+
const scale = axisHelper.getScale(0);
|
|
76774
|
+
const depthFromSpec = this._groups ? this._groups.fields.length : 1;
|
|
76775
|
+
const depth = depthFromSpec;
|
|
76776
|
+
const bandWidth = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
|
|
76777
|
+
const size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
|
|
76778
|
+
if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
|
|
76779
|
+
const groupFields = this._groups.fields;
|
|
76780
|
+
const boxGapInGroup = array(this._spec.boxGapInGroup);
|
|
76781
|
+
let totalWidth = 0;
|
|
76782
|
+
let offSet = 0;
|
|
76783
|
+
for (let index = groupFields.length - 1; index >= 1; index--) {
|
|
76784
|
+
const groupField = groupFields[index];
|
|
76785
|
+
const groupValues = (_c = (_b = axisHelper.getScale(index)) === null || _b === void 0 ? void 0 : _b.domain()) !== null && _c !== void 0 ? _c : [];
|
|
76786
|
+
const groupCount = groupValues.length;
|
|
76787
|
+
const gap = getActualNumValue((_d = boxGapInGroup[index - 1]) !== null && _d !== void 0 ? _d : last(boxGapInGroup), bandWidth);
|
|
76788
|
+
const i = groupValues.indexOf(datum[groupField]);
|
|
76789
|
+
if (index === groupFields.length - 1) {
|
|
76790
|
+
totalWidth += groupCount * size + (groupCount - 1) * gap;
|
|
76791
|
+
offSet += i * (size + gap);
|
|
76792
|
+
}
|
|
76793
|
+
else {
|
|
76794
|
+
offSet += i * (totalWidth + gap);
|
|
76795
|
+
totalWidth += totalWidth + (groupCount - 1) * gap;
|
|
76796
|
+
}
|
|
76797
|
+
}
|
|
76798
|
+
const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
|
|
76799
|
+
return center - totalWidth / 2 + offSet + size / 2;
|
|
76800
|
+
}
|
|
76801
|
+
const continuous = isContinuous(scale.type || 'band');
|
|
76802
|
+
const pos = dataToPosition(datum);
|
|
76803
|
+
return pos + bandWidth * 0.5 + (continuous ? -bandWidth / 2 : 0);
|
|
76804
|
+
}
|
|
76603
76805
|
onLayoutEnd() {
|
|
76604
76806
|
super.onLayoutEnd();
|
|
76605
76807
|
this._autoBoxWidth = null;
|
|
@@ -76608,10 +76810,10 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76608
76810
|
const newConfig = merge$1({}, config);
|
|
76609
76811
|
['appear', 'enter', 'update', 'exit', 'disappear'].forEach(state => {
|
|
76610
76812
|
if (newConfig[state] && newConfig[state].type === 'scaleIn') {
|
|
76611
|
-
newConfig[state].type = this._shaftShape === '
|
|
76813
|
+
newConfig[state].type = this._shaftShape === 'bar' ? 'barBoxplotScaleIn' : 'boxplotScaleIn';
|
|
76612
76814
|
}
|
|
76613
76815
|
else if (newConfig[state] && newConfig[state].type === 'scaleOut') {
|
|
76614
|
-
newConfig[state].type = this._shaftShape === '
|
|
76816
|
+
newConfig[state].type = this._shaftShape === 'bar' ? 'barBoxplotScaleOut' : 'boxplotScaleOut';
|
|
76615
76817
|
}
|
|
76616
76818
|
});
|
|
76617
76819
|
return newConfig;
|
|
@@ -93830,13 +94032,18 @@ class BoxPlotChartSpecTransformer extends CartesianChartSpecTransformer {
|
|
|
93830
94032
|
const dataFields = [spec.maxField, spec.medianField, spec.q1Field, spec.q3Field, spec.minField, spec.outliersField];
|
|
93831
94033
|
const seriesSpec = super._getDefaultSeriesSpec(spec, [
|
|
93832
94034
|
'boxPlot',
|
|
94035
|
+
'outlier',
|
|
93833
94036
|
'minField',
|
|
93834
94037
|
'maxField',
|
|
93835
94038
|
'q1Field',
|
|
93836
94039
|
'medianField',
|
|
93837
94040
|
'q3Field',
|
|
93838
94041
|
'outliersField',
|
|
93839
|
-
'outliersStyle'
|
|
94042
|
+
'outliersStyle',
|
|
94043
|
+
'boxWidth',
|
|
94044
|
+
'boxMaxWidth',
|
|
94045
|
+
'boxMinWidth',
|
|
94046
|
+
'boxGapInGroup'
|
|
93840
94047
|
]);
|
|
93841
94048
|
seriesSpec.direction = (_a = spec.direction) !== null && _a !== void 0 ? _a : "vertical";
|
|
93842
94049
|
seriesSpec[seriesSpec.direction === "horizontal" ? 'xField' : 'yField'] = dataFields;
|