@visactor/vchart 2.0.10-alpha.0 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +265 -33
  3. package/build/index.js +265 -33
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart.d.ts +2 -0
  7. package/cjs/chart/base/base-chart.js +16 -2
  8. package/cjs/chart/base/base-chart.js.map +1 -1
  9. package/cjs/chart/box-plot/box-plot-transformer.js +1 -1
  10. package/cjs/chart/box-plot/box-plot-transformer.js.map +1 -1
  11. package/cjs/chart/interface/chart.d.ts +2 -0
  12. package/cjs/chart/interface/chart.js.map +1 -1
  13. package/cjs/component/axis/base-axis.js +2 -2
  14. package/cjs/component/axis/base-axis.js.map +1 -1
  15. package/cjs/core/index.d.ts +1 -1
  16. package/cjs/core/index.js +1 -1
  17. package/cjs/core/index.js.map +1 -1
  18. package/cjs/core/vchart.d.ts +2 -0
  19. package/cjs/core/vchart.js +4 -0
  20. package/cjs/core/vchart.js.map +1 -1
  21. package/cjs/mark/base/base-mark.d.ts +1 -1
  22. package/cjs/mark/base/base-mark.js +3 -3
  23. package/cjs/mark/base/base-mark.js.map +1 -1
  24. package/cjs/series/box-plot/box-plot.d.ts +3 -1
  25. package/cjs/series/box-plot/box-plot.js +54 -29
  26. package/cjs/series/box-plot/box-plot.js.map +1 -1
  27. package/cjs/series/box-plot/interface.d.ts +7 -2
  28. package/cjs/series/box-plot/interface.js.map +1 -1
  29. package/cjs/theme/token/builtin/default.js +1 -1
  30. package/cjs/theme/token/builtin/default.js.map +1 -1
  31. package/cjs/typings/visual.d.ts +3 -3
  32. package/cjs/typings/visual.js.map +1 -1
  33. package/esm/chart/base/base-chart.d.ts +2 -0
  34. package/esm/chart/base/base-chart.js +15 -2
  35. package/esm/chart/base/base-chart.js.map +1 -1
  36. package/esm/chart/box-plot/box-plot-transformer.js +1 -1
  37. package/esm/chart/box-plot/box-plot-transformer.js.map +1 -1
  38. package/esm/chart/interface/chart.d.ts +2 -0
  39. package/esm/chart/interface/chart.js.map +1 -1
  40. package/esm/component/axis/base-axis.js +2 -2
  41. package/esm/component/axis/base-axis.js.map +1 -1
  42. package/esm/core/index.d.ts +1 -1
  43. package/esm/core/index.js +1 -1
  44. package/esm/core/index.js.map +1 -1
  45. package/esm/core/vchart.d.ts +2 -0
  46. package/esm/core/vchart.js +4 -0
  47. package/esm/core/vchart.js.map +1 -1
  48. package/esm/mark/base/base-mark.d.ts +1 -1
  49. package/esm/mark/base/base-mark.js +3 -3
  50. package/esm/mark/base/base-mark.js.map +1 -1
  51. package/esm/series/box-plot/box-plot.d.ts +3 -1
  52. package/esm/series/box-plot/box-plot.js +56 -29
  53. package/esm/series/box-plot/box-plot.js.map +1 -1
  54. package/esm/series/box-plot/interface.d.ts +7 -2
  55. package/esm/series/box-plot/interface.js.map +1 -1
  56. package/esm/theme/token/builtin/default.js +1 -1
  57. package/esm/theme/token/builtin/default.js.map +1 -1
  58. package/esm/typings/visual.d.ts +3 -3
  59. package/esm/typings/visual.js.map +1 -1
  60. package/package.json +7 -7
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,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
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,-apple-system,segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",
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
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, LineAxis.defaultAttributes, attributes), options);
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: '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',
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
  }
@@ -61085,6 +61218,10 @@ class VChart {
61085
61218
  var _a;
61086
61219
  return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
61087
61220
  }
61221
+ showCrosshair(cb) {
61222
+ var _a;
61223
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
61224
+ }
61088
61225
  stopAnimation() {
61089
61226
  var _a;
61090
61227
  (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.stopAnimation(true);
@@ -61394,7 +61531,7 @@ const lookup = (data, opt) => {
61394
61531
  });
61395
61532
  };
61396
61533
 
61397
- const version = "2.0.10-alpha.0";
61534
+ const version = "2.0.10";
61398
61535
 
61399
61536
  const addVChartProperty = (data, op) => {
61400
61537
  const context = op.beforeCall();
@@ -66080,7 +66217,7 @@ class AxisComponent extends BaseComponent {
66080
66217
  _getGridAttributes() {
66081
66218
  const spec = this._spec;
66082
66219
  return {
66083
- alternateColor: isFunction$1(spec.grid.alternateColor) ? spec.grid.alternateColor() : spec.grid.alternateColor,
66220
+ alternateColor: spec.grid.alternateColor,
66084
66221
  alignWithLabel: spec.grid.alignWithLabel,
66085
66222
  style: isFunction$1(spec.grid.style)
66086
66223
  ? (datum, index) => {
@@ -66094,9 +66231,7 @@ class AxisComponent extends BaseComponent {
66094
66231
  : {
66095
66232
  type: 'line',
66096
66233
  visible: spec.subGrid.visible,
66097
- alternateColor: isFunction$1(spec.subGrid.alternateColor)
66098
- ? spec.subGrid.alternateColor()
66099
- : spec.subGrid.alternateColor,
66234
+ alternateColor: spec.subGrid.alternateColor,
66100
66235
  style: transformToGraphic(spec.subGrid.style)
66101
66236
  }
66102
66237
  };
@@ -70145,10 +70280,12 @@ class BaseChart extends CompilableBase {
70145
70280
  }
70146
70281
  });
70147
70282
  const isUnableValue = isNil$1(value) || !dimensionInfo || dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && isNil$1(d.index));
70283
+ const isUnableTooltip = isUnableValue ||
70284
+ dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && d.data.every(_data => _data.datum.length === 0));
70148
70285
  if (opt.tooltip !== false) {
70149
70286
  const tooltip = this.getComponentsByType(ComponentTypeEnum.tooltip)[0];
70150
70287
  if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.getVisible()) {
70151
- if (isUnableValue) {
70288
+ if (isUnableValue || isUnableTooltip) {
70152
70289
  (_b = (_a = tooltip).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a);
70153
70290
  }
70154
70291
  else {
@@ -70178,6 +70315,25 @@ class BaseChart extends CompilableBase {
70178
70315
  }
70179
70316
  }
70180
70317
  }
70318
+ showCrosshair(cb) {
70319
+ var _a;
70320
+ const crosshair = (_a = this.getComponentsByType(ComponentTypeEnum.cartesianCrosshair)[0]) !== null && _a !== void 0 ? _a : this.getComponentsByType(ComponentTypeEnum.polarCrosshair)[0];
70321
+ if (!crosshair) {
70322
+ return;
70323
+ }
70324
+ const axes = this.getComponentsByKey('axes');
70325
+ const dimInfo = [];
70326
+ axes.forEach(axis => {
70327
+ const value = cb(axis);
70328
+ if (value !== false) {
70329
+ dimInfo.push({
70330
+ axis,
70331
+ value
70332
+ });
70333
+ }
70334
+ });
70335
+ crosshair.showCrosshair(dimInfo);
70336
+ }
70181
70337
  getColorScheme() {
70182
70338
  var _a, _b;
70183
70339
  return (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a, 'colorScheme');
@@ -76415,6 +76571,7 @@ class BoxPlotSeries extends CartesianSeries {
76415
76571
  constructor() {
76416
76572
  super(...arguments);
76417
76573
  this.type = SeriesTypeEnum.boxPlot;
76574
+ this._bandPosition = 0;
76418
76575
  }
76419
76576
  getMinField() {
76420
76577
  return this._minField;
@@ -76447,7 +76604,7 @@ class BoxPlotSeries extends CartesianSeries {
76447
76604
  return this._outliersStyle;
76448
76605
  }
76449
76606
  setAttrFromSpec() {
76450
- var _a, _b, _c, _d, _e;
76607
+ var _a, _b, _c, _d, _e, _f, _g;
76451
76608
  super.setAttrFromSpec();
76452
76609
  const boxPlotStyle = (_b = (_a = this._spec.boxPlot) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
76453
76610
  this._minField = this._spec.minField;
@@ -76464,7 +76621,7 @@ class BoxPlotSeries extends CartesianSeries {
76464
76621
  this._strokeColor = boxPlotStyle.stroke;
76465
76622
  this._shaftFillOpacity =
76466
76623
  this._shaftShape === 'bar' ? (_e = boxPlotStyle.shaftFillOpacity) !== null && _e !== void 0 ? _e : DEFAULT_SHAFT_FILL_OPACITY : undefined;
76467
- this._outliersStyle = this._spec.outliersStyle;
76624
+ this._outliersStyle = ((_f = this._spec.outliersStyle) !== null && _f !== void 0 ? _f : (_g = this._spec.outlier) === null || _g === void 0 ? void 0 : _g.style);
76468
76625
  }
76469
76626
  initMark() {
76470
76627
  this._boxPlotMark = this._createMark(BoxPlotSeries.mark.boxPlot, {
@@ -76486,24 +76643,37 @@ class BoxPlotSeries extends CartesianSeries {
76486
76643
  if (boxPlotMark) {
76487
76644
  const commonBoxplotStyles = {
76488
76645
  lineWidth: this._lineWidth,
76489
- fill: (_a = this._boxFillColor) !== null && _a !== void 0 ? _a : (this._shaftShape === 'line' ? DEFAULT_FILL_COLOR : this.getColorAttribute()),
76646
+ fill: (_a = this._boxFillColor) !== null && _a !== void 0 ? _a : (this._shaftShape !== 'line' ? this.getColorAttribute() : DEFAULT_FILL_COLOR),
76490
76647
  minMaxFillOpacity: this._shaftFillOpacity,
76491
- stroke: (_b = this._strokeColor) !== null && _b !== void 0 ? _b : (this._shaftShape === 'line' ? this.getColorAttribute() : DEFAULT_STROKE_COLOR)
76648
+ stroke: (_b = this._strokeColor) !== null && _b !== void 0 ? _b : (this._shaftShape !== 'line' ? DEFAULT_STROKE_COLOR : this.getColorAttribute())
76492
76649
  };
76493
76650
  boxPlotMark.setGlyphConfig({
76494
76651
  direction: this._direction,
76495
76652
  shaftShape: this._shaftShape
76496
76653
  });
76497
76654
  const boxPlotMarkStyles = this._direction === "horizontal"
76498
- ? Object.assign(Object.assign({ y: this.dataToPositionY.bind(this) }, commonBoxplotStyles), { boxHeight: () => { var _a; return (_a = this._boxWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth(); }, ruleHeight: () => { var _a; return (_a = this._shaftWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth(); }, q1q3Height: () => { var _a; return (_a = this._boxWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth(); }, minMaxHeight: () => { var _a; return (_a = this._shaftWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth(); } }) : Object.assign(Object.assign({ x: this.dataToPositionX.bind(this) }, commonBoxplotStyles), { boxWidth: () => { var _a; return (_a = this._boxWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth(); }, ruleWidth: () => { var _a; return (_a = this._shaftWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth(); }, q1q3Width: () => { var _a; return (_a = this._boxWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth(); }, minMaxWidth: () => { var _a; return (_a = this._shaftWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth(); } });
76499
- this.setMarkStyle(boxPlotMark, boxPlotMarkStyles, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
76655
+ ? {
76656
+ y: (datum) => this._getPosition(this.direction, datum),
76657
+ boxHeight: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
76658
+ ruleHeight: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
76659
+ q1q3Height: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
76660
+ minMaxHeight: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); }
76661
+ }
76662
+ : {
76663
+ x: (datum) => this._getPosition(this.direction, datum),
76664
+ boxWidth: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
76665
+ ruleWidth: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
76666
+ q1q3Width: () => { var _a; return getActualNumValue((_a = this._boxWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); },
76667
+ minMaxWidth: () => { var _a; return getActualNumValue((_a = this._shaftWidth) !== null && _a !== void 0 ? _a : '100%', this._getMarkWidth()); }
76668
+ };
76669
+ this.setMarkStyle(boxPlotMark, commonBoxplotStyles, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
76670
+ this.setMarkStyle(boxPlotMark, boxPlotMarkStyles, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Built_In);
76500
76671
  }
76501
76672
  const outlierMark = this._outlierMark;
76502
76673
  if (outlierMark) {
76503
76674
  this.setMarkStyle(outlierMark, {
76504
76675
  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'
76676
+ size: isNumber$1((_e = this._outliersStyle) === null || _e === void 0 ? void 0 : _e.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
76507
76677
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
76508
76678
  }
76509
76679
  }
@@ -76538,13 +76708,13 @@ class BoxPlotSeries extends CartesianSeries {
76538
76708
  const scale = (_b = axisHelper === null || axisHelper === void 0 ? void 0 : axisHelper.getScale) === null || _b === void 0 ? void 0 : _b.call(axisHelper, 0);
76539
76709
  const outlierMarkPositionChannel = this._direction === "horizontal"
76540
76710
  ? {
76541
- y: this.dataToPositionY.bind(this),
76711
+ y: (datum) => this._getPosition(this.direction, datum),
76542
76712
  x: (datum) => valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, BOX_PLOT_OUTLIER_VALUE_FIELD), {
76543
76713
  bandPosition: this._bandPosition
76544
76714
  }), scale)
76545
76715
  }
76546
76716
  : {
76547
- x: this.dataToPositionX.bind(this),
76717
+ x: (datum) => this._getPosition(this.direction, datum),
76548
76718
  y: (datum) => valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, BOX_PLOT_OUTLIER_VALUE_FIELD), {
76549
76719
  bandPosition: this._bandPosition
76550
76720
  }), scale)
@@ -76590,16 +76760,73 @@ class BoxPlotSeries extends CartesianSeries {
76590
76760
  this.initBoxPlotMarkStyle();
76591
76761
  }
76592
76762
  _getMarkWidth() {
76763
+ var _a;
76593
76764
  if (this._autoBoxWidth) {
76594
76765
  return this._autoBoxWidth;
76595
76766
  }
76596
76767
  const bandAxisHelper = this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper;
76597
- const xField = this._direction === "horizontal" ? this._fieldY : this._fieldX;
76598
- const innerBandWidth = bandAxisHelper.getBandwidth(xField.length - 1);
76599
- const autoBoxWidth = innerBandWidth / xField.length;
76600
- this._autoBoxWidth = autoBoxWidth;
76768
+ const depthFromSpec = this._groups ? this._groups.fields.length : 1;
76769
+ const bandWidth = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1);
76770
+ let width = bandWidth;
76771
+ if (isValid$1(this._spec.boxWidth)) {
76772
+ width = getActualNumValue(this._spec.boxWidth, bandWidth);
76773
+ }
76774
+ if (isValid$1(this._spec.boxMinWidth)) {
76775
+ width = Math.max(width, getActualNumValue(this._spec.boxMinWidth, bandWidth));
76776
+ }
76777
+ if (isValid$1(this._spec.boxMaxWidth)) {
76778
+ width = Math.min(width, getActualNumValue(this._spec.boxMaxWidth, bandWidth));
76779
+ }
76780
+ this._autoBoxWidth = width;
76601
76781
  return this._autoBoxWidth;
76602
76782
  }
76783
+ _getPosition(direction, datum) {
76784
+ var _a, _b, _c, _d;
76785
+ let axisHelper;
76786
+ let sizeAttribute;
76787
+ let dataToPosition;
76788
+ if (direction === "horizontal") {
76789
+ axisHelper = this.getYAxisHelper();
76790
+ sizeAttribute = 'boxHeight';
76791
+ dataToPosition = this.dataToPositionY.bind(this);
76792
+ }
76793
+ else {
76794
+ axisHelper = this.getXAxisHelper();
76795
+ sizeAttribute = 'boxWidth';
76796
+ dataToPosition = this.dataToPositionX.bind(this);
76797
+ }
76798
+ const scale = axisHelper.getScale(0);
76799
+ const depthFromSpec = this._groups ? this._groups.fields.length : 1;
76800
+ const depth = depthFromSpec;
76801
+ const bandWidth = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
76802
+ const size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
76803
+ if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
76804
+ const groupFields = this._groups.fields;
76805
+ const boxGapInGroup = array(this._spec.boxGapInGroup);
76806
+ let totalWidth = 0;
76807
+ let offSet = 0;
76808
+ for (let index = groupFields.length - 1; index >= 1; index--) {
76809
+ const groupField = groupFields[index];
76810
+ const groupValues = (_c = (_b = axisHelper.getScale(index)) === null || _b === void 0 ? void 0 : _b.domain()) !== null && _c !== void 0 ? _c : [];
76811
+ const groupCount = groupValues.length;
76812
+ const gap = getActualNumValue((_d = boxGapInGroup[index - 1]) !== null && _d !== void 0 ? _d : last(boxGapInGroup), bandWidth);
76813
+ const i = groupValues.indexOf(datum[groupField]);
76814
+ if (index === groupFields.length - 1) {
76815
+ totalWidth += groupCount * size + (groupCount - 1) * gap;
76816
+ offSet += i * (size + gap);
76817
+ }
76818
+ else {
76819
+ offSet += i * (totalWidth + gap);
76820
+ totalWidth += totalWidth + (groupCount - 1) * gap;
76821
+ }
76822
+ }
76823
+ const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
76824
+ return center - totalWidth / 2 + offSet + size / 2;
76825
+ }
76826
+ const continuous = isContinuous(scale.type || 'band');
76827
+ const pos = dataToPosition(datum);
76828
+ return pos + bandWidth * 0.5 + (continuous ? -bandWidth / 2 : 0);
76829
+ }
76603
76830
  onLayoutEnd() {
76604
76831
  super.onLayoutEnd();
76605
76832
  this._autoBoxWidth = null;
@@ -76608,10 +76835,10 @@ class BoxPlotSeries extends CartesianSeries {
76608
76835
  const newConfig = merge$1({}, config);
76609
76836
  ['appear', 'enter', 'update', 'exit', 'disappear'].forEach(state => {
76610
76837
  if (newConfig[state] && newConfig[state].type === 'scaleIn') {
76611
- newConfig[state].type = this._shaftShape === 'line' ? 'boxplotScaleIn' : 'barBoxplotScaleIn';
76838
+ newConfig[state].type = this._shaftShape === 'bar' ? 'barBoxplotScaleIn' : 'boxplotScaleIn';
76612
76839
  }
76613
76840
  else if (newConfig[state] && newConfig[state].type === 'scaleOut') {
76614
- newConfig[state].type = this._shaftShape === 'line' ? 'boxplotScaleOut' : 'barBoxplotScaleOut';
76841
+ newConfig[state].type = this._shaftShape === 'bar' ? 'barBoxplotScaleOut' : 'boxplotScaleOut';
76615
76842
  }
76616
76843
  });
76617
76844
  return newConfig;
@@ -93830,13 +94057,18 @@ class BoxPlotChartSpecTransformer extends CartesianChartSpecTransformer {
93830
94057
  const dataFields = [spec.maxField, spec.medianField, spec.q1Field, spec.q3Field, spec.minField, spec.outliersField];
93831
94058
  const seriesSpec = super._getDefaultSeriesSpec(spec, [
93832
94059
  'boxPlot',
94060
+ 'outlier',
93833
94061
  'minField',
93834
94062
  'maxField',
93835
94063
  'q1Field',
93836
94064
  'medianField',
93837
94065
  'q3Field',
93838
94066
  'outliersField',
93839
- 'outliersStyle'
94067
+ 'outliersStyle',
94068
+ 'boxWidth',
94069
+ 'boxMaxWidth',
94070
+ 'boxMinWidth',
94071
+ 'boxGapInGroup'
93840
94072
  ]);
93841
94073
  seriesSpec.direction = (_a = spec.direction) !== null && _a !== void 0 ? _a : "vertical";
93842
94074
  seriesSpec[seriesSpec.direction === "horizontal" ? 'xField' : 'yField'] = dataFields;