@visactor/vchart 1.6.3 → 1.6.5

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 (45) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +593 -334
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/component/axis/cartesian/axis.d.ts +3 -0
  6. package/cjs/component/axis/cartesian/axis.js +12 -5
  7. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  8. package/cjs/component/data-zoom/data-filter-base-component.js +4 -3
  9. package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
  10. package/cjs/component/data-zoom/data-zoom/data-zoom.js +9 -5
  11. package/cjs/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  12. package/cjs/component/tooltip/handler/dom/util.js.map +1 -1
  13. package/cjs/core/index.d.ts +1 -1
  14. package/cjs/core/index.js +1 -1
  15. package/cjs/core/index.js.map +1 -1
  16. package/cjs/data/transforms/sankey.d.ts +3 -6
  17. package/cjs/data/transforms/sankey.js +40 -23
  18. package/cjs/data/transforms/sankey.js.map +1 -1
  19. package/cjs/event/events/dimension/base.d.ts +1 -0
  20. package/cjs/event/events/dimension/base.js +10 -6
  21. package/cjs/event/events/dimension/base.js.map +1 -1
  22. package/cjs/series/sankey/sankey.d.ts +6 -1
  23. package/cjs/series/sankey/sankey.js +48 -42
  24. package/cjs/series/sankey/sankey.js.map +1 -1
  25. package/esm/component/axis/cartesian/axis.d.ts +3 -0
  26. package/esm/component/axis/cartesian/axis.js +12 -5
  27. package/esm/component/axis/cartesian/axis.js.map +1 -1
  28. package/esm/component/data-zoom/data-filter-base-component.js +4 -3
  29. package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
  30. package/esm/component/data-zoom/data-zoom/data-zoom.js +9 -5
  31. package/esm/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  32. package/esm/component/tooltip/handler/dom/util.js.map +1 -1
  33. package/esm/core/index.d.ts +1 -1
  34. package/esm/core/index.js +1 -1
  35. package/esm/core/index.js.map +1 -1
  36. package/esm/data/transforms/sankey.d.ts +3 -6
  37. package/esm/data/transforms/sankey.js +36 -22
  38. package/esm/data/transforms/sankey.js.map +1 -1
  39. package/esm/event/events/dimension/base.d.ts +1 -0
  40. package/esm/event/events/dimension/base.js +10 -6
  41. package/esm/event/events/dimension/base.js.map +1 -1
  42. package/esm/series/sankey/sankey.d.ts +6 -1
  43. package/esm/series/sankey/sankey.js +49 -46
  44. package/esm/series/sankey/sankey.js.map +1 -1
  45. package/package.json +15 -15
package/build/index.js CHANGED
@@ -647,17 +647,17 @@
647
647
  function objectKeys(obj) {
648
648
  return Object.keys(obj);
649
649
  }
650
- function isEqual$1(a, b) {
650
+ function isEqual$1(a, b, options) {
651
651
  if (a === b) return !0;
652
652
  if (typeof a != typeof b) return !1;
653
653
  if (null == a || null == b) return !1;
654
654
  if (Number.isNaN(a) && Number.isNaN(b)) return !0;
655
655
  if (objToString(a) !== objToString(b)) return !1;
656
- if (isFunction$1(a)) return !1;
656
+ if (isFunction$1(a)) return !!(null == options ? void 0 : options.skipFunction);
657
657
  if ("object" != typeof a) return !1;
658
658
  if (isArray$1(a)) {
659
659
  if (a.length !== b.length) return !1;
660
- for (let i = a.length - 1; i >= 0; i--) if (!isEqual$1(a[i], b[i])) return !1;
660
+ for (let i = a.length - 1; i >= 0; i--) if (!isEqual$1(a[i], b[i], options)) return !1;
661
661
  return !0;
662
662
  }
663
663
  if (!isPlainObject$1(a)) return !1;
@@ -668,7 +668,7 @@
668
668
  for (let i = ka.length - 1; i >= 0; i--) if (ka[i] != kb[i]) return !1;
669
669
  for (let i = ka.length - 1; i >= 0; i--) {
670
670
  const key = ka[i];
671
- if (!isEqual$1(a[key], b[key])) return !1;
671
+ if (!isEqual$1(a[key], b[key], options)) return !1;
672
672
  }
673
673
  return !0;
674
674
  }
@@ -2063,9 +2063,15 @@
2063
2063
  baseline: baseline,
2064
2064
  textBaseline = null != baseline ? baseline : "middle",
2065
2065
  ellipsis: ellipsis,
2066
- limit: limit,
2067
- lineHeight = fontSize
2066
+ limit: limit
2068
2067
  } = this._userSpec;
2068
+ let {
2069
+ lineHeight = fontSize
2070
+ } = this._userSpec;
2071
+ if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
2072
+ const scale = Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100;
2073
+ lineHeight = fontSize * scale;
2074
+ }
2069
2075
  return {
2070
2076
  fontStyle: fontStyle,
2071
2077
  fontVariant: fontVariant,
@@ -2134,6 +2140,7 @@
2134
2140
  return this._measureReduce(text, this._measureWithNaiveCanvas.bind(this));
2135
2141
  }
2136
2142
  _measureWithNaiveCanvas(text) {
2143
+ var _a;
2137
2144
  if (!this.initContext()) return this._quickMeasureWithoutCanvas(text);
2138
2145
  const metrics = this._context.measureText(text),
2139
2146
  {
@@ -2142,7 +2149,7 @@
2142
2149
  } = this.textSpec;
2143
2150
  return {
2144
2151
  width: metrics.width,
2145
- height: null != lineHeight ? lineHeight : fontSize
2152
+ height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
2146
2153
  };
2147
2154
  }
2148
2155
  quickMeasure(text) {
@@ -2164,6 +2171,7 @@
2164
2171
  return this._measureReduce(text, this._quickMeasureWithoutCanvas.bind(this));
2165
2172
  }
2166
2173
  _quickMeasureWithoutCanvas(text) {
2174
+ var _a;
2167
2175
  const totalSize = {
2168
2176
  width: 0,
2169
2177
  height: 0
@@ -2177,9 +2185,10 @@
2177
2185
  size = ["F", "W"].includes(eastAsianCharacterInfo(char)) ? 1 : .53;
2178
2186
  totalSize.width += size * fontSize;
2179
2187
  }
2180
- return totalSize.height = null != lineHeight ? lineHeight : fontSize, totalSize;
2188
+ return totalSize.height = null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize, totalSize;
2181
2189
  }
2182
2190
  _measureReduce(text, processor) {
2191
+ var _a;
2183
2192
  const {
2184
2193
  fontSize: fontSize,
2185
2194
  lineHeight: lineHeight
@@ -2193,7 +2202,7 @@
2193
2202
  const textArr = text.filter(isValid$1).map(s => s.toString());
2194
2203
  return 0 === textArr.length ? defaultResult : 1 === textArr.length ? processor(textArr[0]) : {
2195
2204
  width: textArr.reduce((maxWidth, cur) => Math.max(maxWidth, processor(cur).width), 0),
2196
- height: textArr.length * ((null != lineHeight ? lineHeight : fontSize) + 1) + 1
2205
+ height: textArr.length * ((null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize) + 1) + 1
2197
2206
  };
2198
2207
  }
2199
2208
  return processor(text.toString());
@@ -13732,6 +13741,12 @@
13732
13741
  }
13733
13742
  RafBasedSTO.TimeOut = 1e3 / 60;
13734
13743
  const rafBasedSto = new RafBasedSTO();
13744
+ const calculateLineHeight = (lineHeight, fontSize) => {
13745
+ if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
13746
+ return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
13747
+ }
13748
+ return lineHeight;
13749
+ };
13735
13750
 
13736
13751
  class IncreaseCount extends ACustomAnimate {
13737
13752
  constructor(from, to, duration, easing, params) {
@@ -17029,14 +17044,13 @@
17029
17044
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
17030
17045
  }
17031
17046
  updateWrapAABBBounds(text) {
17032
- var _a, _b, _c;
17047
+ var _a, _b, _c, _d;
17033
17048
  const textTheme = getTheme$1(this).text,
17034
17049
  {
17035
17050
  fontFamily = textTheme.fontFamily,
17036
17051
  textAlign = textTheme.textAlign,
17037
17052
  textBaseline = textTheme.textBaseline,
17038
17053
  fontSize = textTheme.fontSize,
17039
- lineHeight = this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize,
17040
17054
  ellipsis = textTheme.ellipsis,
17041
17055
  maxLineWidth: maxLineWidth,
17042
17056
  stroke = textTheme.stroke,
@@ -17047,8 +17061,9 @@
17047
17061
  heightLimit = 0,
17048
17062
  lineClamp: lineClamp
17049
17063
  } = this.attribute,
17064
+ lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
17050
17065
  buf = ignoreBuf ? 0 : 2;
17051
- if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
17066
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
17052
17067
  const bbox = this.cache.layoutData.bbox;
17053
17068
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
17054
17069
  }
@@ -17078,7 +17093,7 @@
17078
17093
  if ("" !== str && "" === clip.str) {
17079
17094
  if (ellipsis) {
17080
17095
  const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
17081
- clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
17096
+ clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
17082
17097
  } else clip.str = "", clip.width = 0;
17083
17098
  needCut = !1;
17084
17099
  }
@@ -17161,9 +17176,8 @@
17161
17176
  } = attribute;
17162
17177
  if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
17163
17178
  const buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
17164
- {
17165
- lineHeight = null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf
17166
- } = attribute;
17179
+ textFontSize = attribute.fontSize || textTheme.fontSize,
17180
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
17167
17181
  if (!this.shouldUpdateShape() && this.cache) {
17168
17182
  width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
17169
17183
  const dx = textDrawOffsetX(textAlign, width),
@@ -17223,10 +17237,10 @@
17223
17237
  fontWeight = textTheme.fontWeight,
17224
17238
  fontFamily = textTheme.fontFamily,
17225
17239
  stroke = textTheme.stroke,
17226
- lineHeight = null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf,
17227
17240
  lineWidth = textTheme.lineWidth,
17228
17241
  verticalMode = textTheme.verticalMode
17229
- } = attribute;
17242
+ } = attribute,
17243
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
17230
17244
  let {
17231
17245
  textAlign = textTheme.textAlign,
17232
17246
  textBaseline = textTheme.textBaseline
@@ -17274,7 +17288,7 @@
17274
17288
  return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
17275
17289
  }
17276
17290
  updateHorizontalMultilineAABBBounds(text) {
17277
- var _a;
17291
+ var _a, _b;
17278
17292
  const textTheme = getTheme$1(this).text,
17279
17293
  attribute = this.attribute,
17280
17294
  {
@@ -17283,15 +17297,15 @@
17283
17297
  textBaseline = textTheme.textBaseline,
17284
17298
  fontSize = textTheme.fontSize,
17285
17299
  fontWeight = textTheme.fontWeight,
17286
- lineHeight = attribute.lineHeight || attribute.fontSize || textTheme.fontSize,
17287
17300
  ellipsis = textTheme.ellipsis,
17288
17301
  maxLineWidth: maxLineWidth,
17289
17302
  stroke = textTheme.stroke,
17290
17303
  lineWidth = textTheme.lineWidth,
17291
17304
  whiteSpace = textTheme.whiteSpace
17292
- } = attribute;
17305
+ } = attribute,
17306
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
17293
17307
  if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
17294
- if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
17308
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
17295
17309
  const bbox = this.cache.layoutData.bbox;
17296
17310
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
17297
17311
  }
@@ -17323,10 +17337,10 @@
17323
17337
  fontSize = textTheme.fontSize,
17324
17338
  fontWeight = textTheme.fontWeight,
17325
17339
  stroke = textTheme.stroke,
17326
- lineHeight = null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf,
17327
17340
  lineWidth = textTheme.lineWidth,
17328
17341
  verticalMode = textTheme.verticalMode
17329
- } = attribute;
17342
+ } = attribute,
17343
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
17330
17344
  let {
17331
17345
  textAlign = textTheme.textAlign,
17332
17346
  textBaseline = textTheme.textBaseline
@@ -17429,14 +17443,13 @@
17429
17443
  return isArray$1(text) ? !text.every(t => null == t || "" === t) : null != text && "" !== text;
17430
17444
  }
17431
17445
  updateMultilineAABBBounds(text) {
17432
- var _a, _b, _c;
17446
+ var _a, _b, _c, _d;
17433
17447
  const textTheme = getTheme$1(this).text,
17434
17448
  {
17435
17449
  fontFamily = textTheme.fontFamily,
17436
17450
  textAlign = textTheme.textAlign,
17437
17451
  textBaseline = textTheme.textBaseline,
17438
17452
  fontSize = textTheme.fontSize,
17439
- lineHeight = this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize,
17440
17453
  ellipsis = textTheme.ellipsis,
17441
17454
  maxLineWidth: maxLineWidth,
17442
17455
  stroke = textTheme.stroke,
@@ -17447,8 +17460,9 @@
17447
17460
  heightLimit = 0,
17448
17461
  lineClamp: lineClamp
17449
17462
  } = this.attribute,
17463
+ lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
17450
17464
  buf = ignoreBuf ? 0 : 2;
17451
- if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
17465
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
17452
17466
  const bbox = this.cache.layoutData.bbox;
17453
17467
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
17454
17468
  }
@@ -17478,7 +17492,7 @@
17478
17492
  if ("" !== str && "" === clip.str) {
17479
17493
  if (ellipsis) {
17480
17494
  const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
17481
- clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
17495
+ clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
17482
17496
  } else clip.str = "", clip.width = 0;
17483
17497
  needCut = !1;
17484
17498
  }
@@ -18014,6 +18028,13 @@
18014
18028
  builtinSymbols.forEach(symbol => {
18015
18029
  builtinSymbolsMap[symbol.type] = symbol;
18016
18030
  });
18031
+ const builtInSymbolStrMap = {
18032
+ arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
18033
+ arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
18034
+ rect: "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",
18035
+ rectRound: "M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",
18036
+ roundLine: "M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"
18037
+ };
18017
18038
 
18018
18039
  const SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size", ...GRAPHIC_UPDATE_TAG_KEY];
18019
18040
  let Symbol$1 = class Symbol extends Graphic {
@@ -18036,13 +18057,14 @@
18036
18057
  return isArray$1(size) ? 2 === size.length && size.every(this._validNumber) : this._validNumber(size);
18037
18058
  }
18038
18059
  doUpdateParsedPath() {
18039
- const symbolTheme = getTheme$1(this).symbol,
18040
- {
18060
+ const symbolTheme = getTheme$1(this).symbol;
18061
+ let {
18041
18062
  symbolType = symbolTheme.symbolType
18042
- } = this.attribute;
18043
- let path = builtinSymbolsMap[symbolType];
18063
+ } = this.attribute,
18064
+ path = builtinSymbolsMap[symbolType];
18044
18065
  if (path) return this._parsedPath = path, path;
18045
18066
  if (path = Symbol.userSymbolMap[symbolType], path) return this._parsedPath = path, path;
18067
+ symbolType = builtInSymbolStrMap[symbolType] || symbolType;
18046
18068
  if (!0 === isSvg(symbolType)) {
18047
18069
  const parser = new XMLParser(),
18048
18070
  {
@@ -18554,7 +18576,9 @@
18554
18576
 
18555
18577
  class Paragraph {
18556
18578
  constructor(text, newLine, character) {
18557
- this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic", "number" == typeof character.lineHeight ? this.lineHeight = character.lineHeight > this.fontSize ? character.lineHeight : this.fontSize : this.lineHeight = Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
18579
+ this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
18580
+ const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
18581
+ this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
18558
18582
  const {
18559
18583
  ascent: ascent,
18560
18584
  height: height,
@@ -21599,7 +21623,7 @@
21599
21623
  const t = textAlign;
21600
21624
  textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
21601
21625
  }
21602
- const lineHeight = null !== (_c = text.attribute.lineHeight) && void 0 !== _c ? _c : fontSize,
21626
+ const lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
21603
21627
  data = this.valid(text, textAttribute, fillCb, strokeCb);
21604
21628
  if (!data) return;
21605
21629
  const {
@@ -26436,6 +26460,13 @@
26436
26460
  getGraphicItem() {
26437
26461
  return this.graphicItem;
26438
26462
  }
26463
+ removeGraphicItem() {
26464
+ var _a, _b;
26465
+ this.graphicItem && (null === (_b = null === (_a = this.graphicItem.animates) || void 0 === _a ? void 0 : _a.forEach) || void 0 === _b || _b.call(_a, animate => animate.stop())), this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem[BridgeElementKey] = null, this.graphicItem = null);
26466
+ }
26467
+ resetGraphicItem() {
26468
+ this.graphicItem && (this.graphicItem = null);
26469
+ }
26439
26470
  getBounds() {
26440
26471
  var _a;
26441
26472
  return null === (_a = this.graphicItem) || void 0 === _a ? void 0 : _a.AABBBounds;
@@ -26645,8 +26676,7 @@
26645
26676
  this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem = null);
26646
26677
  }
26647
26678
  release() {
26648
- var _a, _b;
26649
- this.graphicItem && (null === (_b = null === (_a = this.graphicItem.animates) || void 0 === _a ? void 0 : _a.forEach) || void 0 === _b || _b.call(_a, animate => animate.stop())), this.mark = null, this.data = null, this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem[BridgeElementKey] = null, this.graphicItem = null), this.items = null;
26679
+ this.removeGraphicItem(), this.mark = null, this.data = null, this.items = null;
26650
26680
  }
26651
26681
  getItemAttribute(channel) {
26652
26682
  var _a, _b;
@@ -28045,6 +28075,48 @@
28045
28075
  to: {}
28046
28076
  };
28047
28077
  }
28078
+ function updateAnimation(prev, next, animationConfig) {
28079
+ if (!isArray$1(animationConfig)) {
28080
+ const {
28081
+ duration: duration,
28082
+ easing: easing,
28083
+ increaseEffect = !0
28084
+ } = animationConfig;
28085
+ return prev.animate().to(next.attribute, duration, easing), void (increaseEffect && playIncreaseCount(prev, next, duration, easing));
28086
+ }
28087
+ animationConfig.forEach((cfg, i) => {
28088
+ const {
28089
+ duration: duration,
28090
+ easing: easing,
28091
+ increaseEffect = !0,
28092
+ channel: channel
28093
+ } = cfg,
28094
+ {
28095
+ from: from,
28096
+ to: to
28097
+ } = update$1(prev, next, channel, cfg.options);
28098
+ isEmpty(to) || prev.animate().to(to, duration, easing), "text" in from && "text" in to && increaseEffect && playIncreaseCount(prev, next, duration, easing);
28099
+ });
28100
+ }
28101
+ const update$1 = (prev, next, channel, options) => {
28102
+ const from = Object.assign({}, prev.attribute),
28103
+ to = Object.assign({}, next.attribute);
28104
+ return array(null == options ? void 0 : options.excludeChannels).forEach(key => {
28105
+ delete to[key];
28106
+ }), Object.keys(to).forEach(key => {
28107
+ channel && !channel.includes(key) && delete to[key];
28108
+ }), {
28109
+ from: from,
28110
+ to: to
28111
+ };
28112
+ };
28113
+ function playIncreaseCount(prev, next, duration, easing) {
28114
+ prev.attribute.text !== next.attribute.text && isValidNumber$1(Number(prev.attribute.text) * Number(next.attribute.text)) && prev.animate().play(new IncreaseCount({
28115
+ text: prev.attribute.text
28116
+ }, {
28117
+ text: next.attribute.text
28118
+ }, duration, easing));
28119
+ }
28048
28120
  const DefaultLabelAnimation = {
28049
28121
  mode: "same-time",
28050
28122
  duration: 300,
@@ -28222,6 +28294,22 @@
28222
28294
  }
28223
28295
  return points;
28224
28296
  };
28297
+ function labelingLineOrArea(textBounds, graphicBounds) {
28298
+ let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "end";
28299
+ let offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
28300
+ if (!textBounds || !graphicBounds) return;
28301
+ const {
28302
+ x1: x1,
28303
+ x2: x2
28304
+ } = textBounds,
28305
+ width = Math.abs(x2 - x1),
28306
+ anchorX = graphicBounds.x1;
28307
+ let x = anchorX;
28308
+ return "end" === position ? x = anchorX + width / 2 + offset : "start" === position && (x = anchorX - width / 2 - offset), {
28309
+ x: x,
28310
+ y: graphicBounds.y1
28311
+ };
28312
+ }
28225
28313
 
28226
28314
  class LabelBase extends AbstractComponent {
28227
28315
  setBitmap(bitmap) {
@@ -28297,30 +28385,37 @@
28297
28385
  return this._bindEvent(text), this._setStatesOfText(text), text;
28298
28386
  }
28299
28387
  _prepare() {
28300
- var _a, _b, _c, _d;
28388
+ var _a, _b, _c, _d, _e;
28301
28389
  const currentBaseMarks = [];
28302
28390
  let baseMarks;
28303
28391
  if (baseMarks = isFunction$1(this.attribute.getBaseMarks) ? this.attribute.getBaseMarks() : getMarksByName(this.getRootNode(), this.attribute.baseMarkGroupName), baseMarks.forEach(mark => {
28304
28392
  "willRelease" !== mark.releaseStatus && currentBaseMarks.push(mark);
28305
- }), null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(), null === (_b = this._idToPoint) || void 0 === _b || _b.clear(), this._baseMarks = currentBaseMarks, this._isCollectionBase = "line" === (null === (_c = null == currentBaseMarks ? void 0 : currentBaseMarks[0]) || void 0 === _c ? void 0 : _c.type) || "area" === (null === (_d = null == currentBaseMarks ? void 0 : currentBaseMarks[0]) || void 0 === _d ? void 0 : _d.type), !currentBaseMarks || 0 === currentBaseMarks.length) return;
28393
+ }), null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(), null === (_b = this._idToPoint) || void 0 === _b || _b.clear(), this._baseMarks = currentBaseMarks, this._isCollectionBase = "line-data" === this.attribute.type, !currentBaseMarks || 0 === currentBaseMarks.length) return;
28306
28394
  const {
28307
28395
  data: data
28308
28396
  } = this.attribute;
28309
- if (data && 0 !== data.length) if (this._idToGraphic || (this._idToGraphic = new Map()), this._isCollectionBase) {
28310
- this._idToPoint || (this._idToPoint = new Map());
28311
- let cur = 0;
28312
- for (let i = 0; i < currentBaseMarks.length; i++) {
28313
- const baseMark = currentBaseMarks[i],
28314
- points = getPointsOfLineArea(baseMark);
28315
- if (null == points ? void 0 : points.length) for (let j = 0; j < points.length; j++) {
28316
- const textData = data[cur];
28317
- textData && points[j] && (isValid$1(textData.id) || (textData.id = `vrender-component-${this.name}-${cur}`), this._idToPoint.set(textData.id, points[j]), this._idToGraphic.set(textData.id, baseMark)), cur++;
28397
+ if (data && 0 !== data.length) {
28398
+ if (this._idToGraphic || (this._idToGraphic = new Map()), this._isCollectionBase) {
28399
+ this._idToPoint || (this._idToPoint = new Map());
28400
+ let cur = 0;
28401
+ for (let i = 0; i < currentBaseMarks.length; i++) {
28402
+ const baseMark = currentBaseMarks[i],
28403
+ points = getPointsOfLineArea(baseMark);
28404
+ if (null == points ? void 0 : points.length) for (let j = 0; j < points.length; j++) {
28405
+ const textData = data[cur];
28406
+ textData && points[j] && (isValid$1(textData.id) || (textData.id = `vrender-component-${this.name}-${cur}`), this._idToPoint.set(textData.id, points[j]), this._idToGraphic.set(textData.id, baseMark)), cur++;
28407
+ }
28318
28408
  }
28409
+ } else for (let i = 0; i < currentBaseMarks.length; i++) {
28410
+ const textData = data[i],
28411
+ baseMark = currentBaseMarks[i];
28412
+ textData && baseMark && (isValid$1(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`), this._idToGraphic.set(textData.id, baseMark));
28319
28413
  }
28320
- } else for (let i = 0; i < currentBaseMarks.length; i++) {
28321
- const textData = data[i],
28322
- baseMark = currentBaseMarks[i];
28323
- textData && baseMark && (isValid$1(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`), this._idToGraphic.set(textData.id, baseMark));
28414
+ !1 !== this.attribute.animation && (this._animationConfig = {
28415
+ enter: merge$1({}, DefaultLabelAnimation, this.attribute.animation, null !== (_c = this.attribute.animationEnter) && void 0 !== _c ? _c : {}),
28416
+ exit: merge$1({}, DefaultLabelAnimation, this.attribute.animation, null !== (_d = this.attribute.animationExit) && void 0 !== _d ? _d : {}),
28417
+ update: isArray$1(this.attribute.animationUpdate) ? this.attribute.animationUpdate : merge$1({}, DefaultLabelAnimation, this.attribute.animation, null !== (_e = this.attribute.animationUpdate) && void 0 !== _e ? _e : {})
28418
+ });
28324
28419
  }
28325
28420
  }
28326
28421
  getRelatedGrphic(item) {
@@ -28449,13 +28544,7 @@
28449
28544
  !1 === this._enableAnimation || !1 === this.attribute.animation ? this._renderWithOutAnimation(labels) : this._renderWithAnimation(labels);
28450
28545
  }
28451
28546
  _renderWithAnimation(labels) {
28452
- var _a, _b, _c, _d, _e;
28453
- const animationConfig = null !== (_a = this.attribute.animation) && void 0 !== _a ? _a : {},
28454
- mode = null !== (_b = animationConfig.mode) && void 0 !== _b ? _b : DefaultLabelAnimation.mode,
28455
- duration = null !== (_c = animationConfig.duration) && void 0 !== _c ? _c : DefaultLabelAnimation.duration,
28456
- easing = null !== (_d = animationConfig.easing) && void 0 !== _d ? _d : DefaultLabelAnimation.easing,
28457
- delay = null !== (_e = animationConfig.delay) && void 0 !== _e ? _e : 0,
28458
- currentTextMap = new Map(),
28547
+ const currentTextMap = new Map(),
28459
28548
  prevTextMap = this._graphicToText || new Map(),
28460
28549
  texts = [];
28461
28550
  labels.forEach((text, index) => {
@@ -28478,32 +28567,26 @@
28478
28567
  } = getAnimationAttributes(text.attribute, "fadeIn");
28479
28568
  this.add(text), labelLine && (this._setStatesOfLabelLine(labelLine), this.add(labelLine)), this._syncStateWithRelatedGraphic(relatedGraphic), relatedGraphic.once("animate-bind", a => {
28480
28569
  text.setAttributes(from);
28481
- const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {
28482
- mode: mode,
28483
- duration: duration,
28484
- easing: easing,
28485
- to: to,
28486
- delay: delay
28487
- });
28570
+ const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, this._animationConfig.enter);
28488
28571
  relatedGraphic.on("afterAttributeUpdate", listener);
28489
28572
  });
28490
28573
  }
28491
28574
  } else if ("update" === state) {
28492
28575
  const prevLabel = prevTextMap.get(textKey);
28493
28576
  prevTextMap.delete(textKey), currentTextMap.set(textKey, prevLabel);
28494
- const prevText = prevLabel.text;
28495
- prevText.animate().to(text.attribute, duration, easing), prevLabel.labelLine && prevLabel.labelLine.animate().to(merge$1({}, prevLabel.labelLine.attribute, {
28577
+ const prevText = prevLabel.text,
28578
+ {
28579
+ duration: duration,
28580
+ easing: easing
28581
+ } = this._animationConfig.update;
28582
+ updateAnimation(prevText, text, this._animationConfig.update), prevLabel.labelLine && prevLabel.labelLine.animate().to(merge$1({}, prevLabel.labelLine.attribute, {
28496
28583
  visible: null === (_f = null !== (_d = (null === (_b = null === (_a = text.attribute) || void 0 === _a ? void 0 : _a.line) || void 0 === _b ? void 0 : _b.visible) && (null === (_c = text.attribute) || void 0 === _c ? void 0 : _c.visible)) && void 0 !== _d ? _d : null === (_e = text.attribute) || void 0 === _e ? void 0 : _e.visible) || void 0 === _f || _f,
28497
28584
  points: null === (_g = text.attribute) || void 0 === _g ? void 0 : _g.points
28498
- }), duration, easing), !1 !== animationConfig.increaseEffect && prevText.attribute.text !== text.attribute.text && isValidNumber$1(Number(prevText.attribute.text) * Number(text.attribute.text)) && prevText.animate().play(new IncreaseCount({
28499
- text: prevText.attribute.text
28500
- }, {
28501
- text: text.attribute.text
28502
- }, duration, easing));
28585
+ }), duration, easing);
28503
28586
  }
28504
28587
  }), prevTextMap.forEach(label => {
28505
28588
  var _a;
28506
- null === (_a = label.text) || void 0 === _a || _a.animate().to(getAnimationAttributes(label.text.attribute, "fadeOut").to, duration, easing).onEnd(() => {
28589
+ null === (_a = label.text) || void 0 === _a || _a.animate().to(getAnimationAttributes(label.text.attribute, "fadeOut").to, this._animationConfig.exit.duration, this._animationConfig.exit.easing).onEnd(() => {
28507
28590
  this.removeChild(label.text), (null == label ? void 0 : label.labelLine) && this.removeChild(label.labelLine);
28508
28591
  });
28509
28592
  }), this._graphicToText = currentTextMap;
@@ -28535,12 +28618,11 @@
28535
28618
  _syncStateWithRelatedGraphic(relatedGraphic) {
28536
28619
  this.attribute.syncState && relatedGraphic.on("afterAttributeUpdate", this._handleRelatedGraphicSetState);
28537
28620
  }
28538
- _afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, _ref) {
28621
+ _afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, _ref) {
28539
28622
  let {
28540
28623
  mode: mode,
28541
28624
  duration: duration,
28542
28625
  easing: easing,
28543
- to: to,
28544
28626
  delay: delay
28545
28627
  } = _ref;
28546
28628
  const listener = event => {
@@ -28551,30 +28633,30 @@
28551
28633
  if (!detail) return {};
28552
28634
  if (!(detail && detail.type === AttributeUpdateType.ANIMATE_UPDATE && detail.animationState && "wait" !== (null === (_a = detail.animationState.step) || void 0 === _a ? void 0 : _a.type))) return {};
28553
28635
  if (detail.type === AttributeUpdateType.ANIMATE_END) return void text.setAttributes(to);
28554
- const onEnd = () => {
28636
+ const onStart = () => {
28555
28637
  relatedGraphic && (relatedGraphic.onAnimateBind = void 0, relatedGraphic.removeEventListener("afterAttributeUpdate", listener));
28556
28638
  };
28557
28639
  switch (mode) {
28558
28640
  case "after":
28559
28641
  detail.animationState.end && text.animate({
28560
- onEnd: onEnd
28642
+ onStart: onStart
28561
28643
  }).wait(delay).to(to, duration, easing);
28562
28644
  break;
28563
28645
  case "after-all":
28564
28646
  index === texts.length - 1 && detail.animationState.end && texts.forEach(t => {
28565
28647
  t.animate({
28566
- onEnd: onEnd
28648
+ onStart: onStart
28567
28649
  }).wait(delay).to(to, duration, easing);
28568
28650
  });
28569
28651
  break;
28570
28652
  default:
28571
28653
  if (this._isCollectionBase) {
28572
28654
  const point = this._idToPoint.get(text.attribute.id);
28573
- !point || text.animates && text.animates.has("label-animate") || !this._baseMarks[0].containsPoint(point.x, point.y, IContainPointMode.LOCAL, null === (_b = this.stage) || void 0 === _b ? void 0 : _b.pickerService) || text.animate({
28574
- onEnd: onEnd
28655
+ !point || text.animates && text.animates.has("label-animate") || !relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, null === (_b = this.stage) || void 0 === _b ? void 0 : _b.pickerService) || text.animate({
28656
+ onStart: onStart
28575
28657
  }).wait(delay).to(to, duration, easing);
28576
28658
  } else detail.animationState.isFirstFrameOfStep && text.animate({
28577
- onEnd: onEnd
28659
+ onStart: onStart
28578
28660
  }).wait(delay).to(to, duration, easing);
28579
28661
  }
28580
28662
  };
@@ -28771,6 +28853,45 @@
28771
28853
  pickable: !1
28772
28854
  };
28773
28855
 
28856
+ class LineLabel extends LabelBase {
28857
+ constructor(attributes) {
28858
+ super(merge$1({}, LineLabel.defaultAttributes, attributes)), this.name = "line-label";
28859
+ }
28860
+ getGraphicBounds(graphic) {
28861
+ let point = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28862
+ var _a;
28863
+ if ("line" !== graphic.type) return super.getGraphicBounds(graphic, point);
28864
+ const {
28865
+ position = "end"
28866
+ } = this.attribute,
28867
+ points = (null === (_a = null == graphic ? void 0 : graphic.attribute) || void 0 === _a ? void 0 : _a.points) || [point],
28868
+ index = "start" === position ? 0 : points.length - 1;
28869
+ return {
28870
+ x1: points[index].x,
28871
+ x2: points[index].x,
28872
+ y1: points[index].y,
28873
+ y2: points[index].y
28874
+ };
28875
+ }
28876
+ labeling(textBounds, graphicBounds) {
28877
+ let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "end";
28878
+ let offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
28879
+ return labelingLineOrArea(textBounds, graphicBounds, position, offset);
28880
+ }
28881
+ }
28882
+ LineLabel.defaultAttributes = {
28883
+ textStyle: {
28884
+ fontSize: 12,
28885
+ fill: "#000",
28886
+ textAlign: "center",
28887
+ textBaseline: "middle",
28888
+ boundsPadding: [-1, 0, -1, 0]
28889
+ },
28890
+ position: "end",
28891
+ offset: 6,
28892
+ pickable: !1
28893
+ };
28894
+
28774
28895
  class ArcInfo {
28775
28896
  constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle, innerRadius, outerRadius, circleCenter) {
28776
28897
  this.refDatum = refDatum, this.center = center, this.outerCenter = outerCenter, this.quadrant = quadrant, this.radian = radian, this.middleAngle = middleAngle, this.innerRadius = innerRadius, this.outerRadius = outerRadius, this.circleCenter = circleCenter, this.labelVisible = !0, this.labelLimit = 0;
@@ -29325,10 +29446,51 @@
29325
29446
  pickable: !1
29326
29447
  };
29327
29448
 
29449
+ class AreaLabel extends LabelBase {
29450
+ constructor(attributes) {
29451
+ super(merge$1({}, AreaLabel.defaultAttributes, attributes)), this.name = "line-label";
29452
+ }
29453
+ getGraphicBounds(graphic) {
29454
+ let point = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29455
+ var _a;
29456
+ if ("area" !== graphic.type) return super.getGraphicBounds(graphic, point);
29457
+ const {
29458
+ position = "end"
29459
+ } = this.attribute,
29460
+ points = (null === (_a = null == graphic ? void 0 : graphic.attribute) || void 0 === _a ? void 0 : _a.points) || [point],
29461
+ index = "start" === position ? 0 : points.length - 1;
29462
+ return {
29463
+ x1: points[index].x,
29464
+ x2: points[index].x,
29465
+ y1: points[index].y,
29466
+ y2: points[index].y
29467
+ };
29468
+ }
29469
+ labeling(textBounds, graphicBounds) {
29470
+ let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "end";
29471
+ let offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
29472
+ return labelingLineOrArea(textBounds, graphicBounds, position, offset);
29473
+ }
29474
+ }
29475
+ AreaLabel.defaultAttributes = {
29476
+ textStyle: {
29477
+ fontSize: 12,
29478
+ fill: "#000",
29479
+ textAlign: "center",
29480
+ textBaseline: "middle",
29481
+ boundsPadding: [-1, 0, -1, 0]
29482
+ },
29483
+ position: "end",
29484
+ offset: 6,
29485
+ pickable: !1
29486
+ };
29487
+
29328
29488
  const labelComponentMap = {
29329
29489
  rect: RectLabel,
29330
29490
  symbol: SymbolLabel,
29331
29491
  arc: ArcLabel,
29492
+ line: LineLabel,
29493
+ area: AreaLabel,
29332
29494
  "line-data": LineDataLabel
29333
29495
  };
29334
29496
  class DataLabel extends AbstractComponent {
@@ -29336,6 +29498,7 @@
29336
29498
  super(merge$1({}, DataLabel.defaultAttributes, attributes)), this.name = "data-label";
29337
29499
  }
29338
29500
  render() {
29501
+ var _a;
29339
29502
  const {
29340
29503
  dataLabels: dataLabels,
29341
29504
  size: size
@@ -29356,10 +29519,12 @@
29356
29519
  labelComponent = labelComponentMap[dataLabel.type] || LabelBase;
29357
29520
  if (labelComponent) {
29358
29521
  const {
29359
- baseMarkGroupName: baseMarkGroupName
29360
- } = dataLabel;
29361
- let component = this._componentMap.get(baseMarkGroupName);
29362
- component ? (component.setBitmapTool(tool), component.setBitmap(bitmap), component.setAttributes(dataLabel), currentComponentMap.set(baseMarkGroupName, component)) : (component = new labelComponent(dataLabel), component.setBitmap(bitmap), component.setBitmapTool(tool), this.add(component), currentComponentMap.set(baseMarkGroupName, component));
29522
+ baseMarkGroupName: baseMarkGroupName,
29523
+ type: type
29524
+ } = dataLabel,
29525
+ id = null !== (_a = dataLabel.id) && void 0 !== _a ? _a : `${baseMarkGroupName}-${type}-${i}`;
29526
+ let component = this._componentMap.get(id);
29527
+ component ? (component.setBitmapTool(tool), component.setBitmap(bitmap), component.setAttributes(dataLabel), currentComponentMap.set(id, component)) : (component = new labelComponent(dataLabel), component.setBitmap(bitmap), component.setBitmapTool(tool), this.add(component), currentComponentMap.set(id, component));
29363
29528
  }
29364
29529
  }
29365
29530
  prevComponentMap.forEach((cp, key) => {
@@ -31201,10 +31366,6 @@
31201
31366
  }
31202
31367
  mixin(CircleAxisGrid, CircleAxisMixin);
31203
31368
 
31204
- var DataZoomActiveTag;
31205
- !function (DataZoomActiveTag) {
31206
- DataZoomActiveTag.startHandler = "startHandler", DataZoomActiveTag.endHandler = "endHandler", DataZoomActiveTag.middleHandler = "middleHandler", DataZoomActiveTag.background = "background";
31207
- }(DataZoomActiveTag || (DataZoomActiveTag = {}));
31208
31369
  const DEFAULT_DATA_ZOOM_ATTRIBUTES = {
31209
31370
  orient: "bottom",
31210
31371
  showDetail: "auto",
@@ -31303,6 +31464,11 @@
31303
31464
  }
31304
31465
  };
31305
31466
 
31467
+ var DataZoomActiveTag;
31468
+ !function (DataZoomActiveTag) {
31469
+ DataZoomActiveTag.startHandler = "startHandler", DataZoomActiveTag.endHandler = "endHandler", DataZoomActiveTag.middleHandler = "middleHandler", DataZoomActiveTag.background = "background";
31470
+ }(DataZoomActiveTag || (DataZoomActiveTag = {}));
31471
+
31306
31472
  var __rest$1 = undefined && undefined.__rest || function (s, e) {
31307
31473
  var t = {};
31308
31474
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
@@ -31337,6 +31503,7 @@
31337
31503
  }, this._statePointToData = state => state, this._onHandlerPointerDown = (e, tag) => {
31338
31504
  e.stopPropagation(), "start" === tag ? (this._activeTag = DataZoomActiveTag.startHandler, this._activeItem = this._startHandler) : "end" === tag ? (this._activeTag = DataZoomActiveTag.endHandler, this._activeItem = this._endHandler) : "middleRect" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerRect) : "middleSymbol" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerSymbol) : "background" === tag && (this._activeTag = DataZoomActiveTag.background, this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this.eventPosToStagePos(e), this._activeCache.lastPos = this.eventPosToStagePos(e);
31339
31505
  }, this._onHandlerPointerMove = e => {
31506
+ var _a;
31340
31507
  e.stopPropagation();
31341
31508
  const {
31342
31509
  start: startAttr,
@@ -31354,7 +31521,7 @@
31354
31521
  start: start,
31355
31522
  end: end
31356
31523
  } = this.state;
31357
- this._activeState && (this._activeTag === DataZoomActiveTag.middleHandler ? this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis) : this._activeTag === DataZoomActiveTag.startHandler ? start + dis > end ? (start = end, end = start + dis, this._activeTag = DataZoomActiveTag.endHandler) : start += dis : this._activeTag === DataZoomActiveTag.endHandler && (end + dis < start ? (end = start, start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis), this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1), end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0), realTime && this._updateStateCallback && this._updateStateCallback(start, end), this._dispatchChangeEvent(start, end));
31524
+ this._activeState && (this._activeTag === DataZoomActiveTag.middleHandler ? this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis) : this._activeTag === DataZoomActiveTag.startHandler ? start + dis > end ? (start = end, end = start + dis, this._activeTag = DataZoomActiveTag.endHandler) : start += dis : this._activeTag === DataZoomActiveTag.endHandler && (end + dis < start ? (end = start, start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis), this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1), end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0), realTime && (null === (_a = this._updateStateCallback) || void 0 === _a || _a.call(this, start, end, this._activeTag)), this._dispatchChangeEvent(start, end));
31358
31525
  };
31359
31526
  const {
31360
31527
  start: start,
@@ -31423,6 +31590,7 @@
31423
31590
  };
31424
31591
  }
31425
31592
  _onHandlerPointerUp(e) {
31593
+ var _a;
31426
31594
  e.preventDefault();
31427
31595
  const {
31428
31596
  start: start,
@@ -31434,7 +31602,7 @@
31434
31602
  const pos = this.eventPosToStagePos(e);
31435
31603
  this.backgroundDragZoom(this._activeCache.startPos, pos);
31436
31604
  }
31437
- this._activeState = !1, brushSelect && this.renderDragMask(), realTime && start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0), this._updateStateCallback && this._updateStateCallback(this.state.start, this.state.end), this._dispatchChangeEvent(this.state.start, this.state.end));
31605
+ this._activeState = !1, brushSelect && this.renderDragMask(), realTime && start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0), null === (_a = this._updateStateCallback) || void 0 === _a || _a.call(this, this.state.start, this.state.end, this._activeTag), this._dispatchChangeEvent(this.state.start, this.state.end));
31438
31606
  }
31439
31607
  _onHandlerPointerEnter(e) {
31440
31608
  e.stopPropagation(), this._showText = !0, this.renderText();
@@ -31826,11 +31994,12 @@
31826
31994
  changeEvent.manager = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem.manager, this.dispatchEvent(changeEvent);
31827
31995
  }
31828
31996
  setStartAndEnd(start, end) {
31997
+ var _a;
31829
31998
  const {
31830
31999
  start: startAttr,
31831
32000
  end: endAttr
31832
32001
  } = this.attribute;
31833
- isValid$1(start) && isValid$1(end) && (start !== this.state.start || end !== this.state.end) && (this.state.start = start, this.state.end = end, startAttr === this.state.start && endAttr === this.state.end || (this.setStateAttr(start, end, !0), this._updateStateCallback && this._updateStateCallback(start, end), this._dispatchChangeEvent(start, end)));
32002
+ isValid$1(start) && isValid$1(end) && (start !== this.state.start || end !== this.state.end) && (this.state.start = start, this.state.end = end, startAttr === this.state.start && endAttr === this.state.end || (this.setStateAttr(start, end, !0), null === (_a = this._updateStateCallback) || void 0 === _a || _a.call(this, start, end, this._activeTag), this._dispatchChangeEvent(start, end)));
31834
32003
  }
31835
32004
  setPreviewData(data) {
31836
32005
  this._previewData = data;
@@ -32795,22 +32964,14 @@
32795
32964
  const target = e.target;
32796
32965
  if (null === (_a = null == target ? void 0 : target.name) || void 0 === _a ? void 0 : _a.startsWith(LEGEND_ELEMENT_NAME.item)) {
32797
32966
  const legendItem = target.delegate;
32798
- legendItem.hasState(LegendStateValue.selected) ? this._setLegendItemState(legendItem, LegendStateValue.selectedHover, e) : this._setLegendItemState(legendItem, LegendStateValue.unSelectedHover, e);
32799
- const focusButton = legendItem.getChildren()[0].find(node => node.name === LEGEND_ELEMENT_NAME.focus, !1);
32800
- focusButton && focusButton.setAttribute("visible", !0), this._dispatchEvent(LegendEvent.legendItemHover, legendItem, e);
32801
- }
32967
+ if (this._lastActiveItem) {
32968
+ if (this._lastActiveItem.id === legendItem.id) return;
32969
+ this._unHover(this._lastActiveItem, e);
32970
+ }
32971
+ this._hover(legendItem, e);
32972
+ } else this._lastActiveItem && (this._unHover(this._lastActiveItem, e), this._lastActiveItem = null);
32802
32973
  }, this._onUnHover = e => {
32803
- var _a;
32804
- const target = e.target;
32805
- if (null === (_a = null == target ? void 0 : target.name) || void 0 === _a ? void 0 : _a.startsWith(LEGEND_ELEMENT_NAME.item)) {
32806
- const legendItem = target.delegate;
32807
- let attributeUpdate = !1;
32808
- (legendItem.hasState(LegendStateValue.unSelectedHover) || legendItem.hasState(LegendStateValue.selectedHover)) && (attributeUpdate = !0), legendItem.removeState(LegendStateValue.unSelectedHover), legendItem.removeState(LegendStateValue.selectedHover), legendItem.getChildren()[0].getChildren().forEach(child => {
32809
- attributeUpdate || !child.hasState(LegendStateValue.unSelectedHover) && !child.hasState(LegendStateValue.selectedHover) || (attributeUpdate = !0), child.removeState(LegendStateValue.unSelectedHover), child.removeState(LegendStateValue.selectedHover);
32810
- });
32811
- const focusButton = legendItem.getChildren()[0].find(node => node.name === LEGEND_ELEMENT_NAME.focus, !1);
32812
- focusButton && focusButton.setAttribute("visible", !1), attributeUpdate && this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem, e), this._dispatchEvent(LegendEvent.legendItemUnHover, legendItem, e);
32813
- }
32974
+ this._lastActiveItem && (this._unHover(this._lastActiveItem, e), this._lastActiveItem = null);
32814
32975
  }, this._onClick = e => {
32815
32976
  var _a, _b, _c, _d, _e;
32816
32977
  const target = e.target;
@@ -32912,7 +33073,7 @@
32912
33073
  hover = !0,
32913
33074
  select = !0
32914
33075
  } = this.attribute;
32915
- hover && (this._itemsContainer.addEventListener("pointermove", this._onHover), this._itemsContainer.addEventListener("pointerout", this._onUnHover)), select && this._itemsContainer.addEventListener("pointerdown", this._onClick);
33076
+ hover && (this._itemsContainer.addEventListener("pointermove", this._onHover), this._itemsContainer.addEventListener("pointerleave", this._onUnHover)), select && this._itemsContainer.addEventListener("pointerdown", this._onClick);
32916
33077
  }
32917
33078
  _renderEachItem(item, isSelected, index, items) {
32918
33079
  const {
@@ -32942,7 +33103,7 @@
32942
33103
  }), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = createGroup(Object.assign({
32943
33104
  x: 0,
32944
33105
  y: 0
32945
- }, null == background ? void 0 : background.style)), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, null == background ? void 0 : background.state)), itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
33106
+ }, null == background ? void 0 : background.style)), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, null == background ? void 0 : background.state)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
32946
33107
  const innerGroup = createGroup({
32947
33108
  x: 0,
32948
33109
  y: 0,
@@ -33116,6 +33277,20 @@
33116
33277
  };
33117
33278
  return this._pager.addEventListener("toPrev", onPaging), this._pager.addEventListener("toNext", onPaging), !0;
33118
33279
  }
33280
+ _hover(legendItem, e) {
33281
+ this._lastActiveItem = legendItem;
33282
+ legendItem.hasState(LegendStateValue.selected) ? this._setLegendItemState(legendItem, LegendStateValue.selectedHover, e) : this._setLegendItemState(legendItem, LegendStateValue.unSelectedHover, e);
33283
+ const focusButton = legendItem.getChildren()[0].find(node => node.name === LEGEND_ELEMENT_NAME.focus, !1);
33284
+ focusButton && focusButton.setAttribute("visible", !0), this._dispatchEvent(LegendEvent.legendItemHover, legendItem, e);
33285
+ }
33286
+ _unHover(legendItem, e) {
33287
+ let attributeUpdate = !1;
33288
+ (legendItem.hasState(LegendStateValue.unSelectedHover) || legendItem.hasState(LegendStateValue.selectedHover)) && (attributeUpdate = !0), legendItem.removeState(LegendStateValue.unSelectedHover), legendItem.removeState(LegendStateValue.selectedHover), legendItem.getChildren()[0].getChildren().forEach(child => {
33289
+ attributeUpdate || !child.hasState(LegendStateValue.unSelectedHover) && !child.hasState(LegendStateValue.selectedHover) || (attributeUpdate = !0), child.removeState(LegendStateValue.unSelectedHover), child.removeState(LegendStateValue.selectedHover);
33290
+ });
33291
+ const focusButton = legendItem.getChildren()[0].find(node => node.name === LEGEND_ELEMENT_NAME.focus, !1);
33292
+ focusButton && focusButton.setAttribute("visible", !1), attributeUpdate && this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem, e), this._dispatchEvent(LegendEvent.legendItemUnHover, legendItem, e);
33293
+ }
33119
33294
  _setLegendItemState(legendItem, stateName, e) {
33120
33295
  let attributeUpdate = !1;
33121
33296
  legendItem.hasState(stateName) || (attributeUpdate = !0), legendItem.addState(stateName, true), legendItem.getChildren()[0].getChildren().forEach(child => {
@@ -33315,20 +33490,97 @@
33315
33490
  }
33316
33491
  }
33317
33492
 
33493
+ function identity(x) {
33494
+ return x;
33495
+ }
33496
+ const generatePow = exponent => x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
33497
+ const sqrt$1 = x => x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
33498
+ const square$1 = x => x < 0 ? -x * x : x * x;
33499
+ const logNegative = x => -Math.log(-x);
33500
+ const expNegative = x => -Math.exp(-x);
33501
+ const pow10 = x => isFinite(x) ? Math.pow(10, x) : x < 0 ? 0 : x;
33502
+ const powp = base => 10 === base ? pow10 : base === Math.E ? Math.exp : x => Math.pow(base, x);
33503
+ const logp = base => base === Math.E ? Math.log : 10 === base ? Math.log10 : 2 === base ? Math.log2 : (base = Math.log(base), x => Math.log(x) / base);
33504
+ const symlog = c => x => Math.sign(x) * Math.log1p(Math.abs(x / c));
33505
+ const symexp = c => x => Math.sign(x) * Math.expm1(Math.abs(x)) * c;
33506
+ function normalize(a, b) {
33507
+ if (a = Number(a), b = Number(b), b -= a) return x => (x - a) / b;
33508
+ const result = Number.isNaN(b) ? NaN : .5;
33509
+ return () => result;
33510
+ }
33511
+ function bimap(domain, range, interpolate) {
33512
+ const d0 = domain[0],
33513
+ d1 = domain[1],
33514
+ r0 = range[0],
33515
+ r1 = range[1];
33516
+ let d0Fuc, r0Fuc;
33517
+ return d1 < d0 ? (d0Fuc = normalize(d1, d0), r0Fuc = interpolate(r1, r0)) : (d0Fuc = normalize(d0, d1), r0Fuc = interpolate(r0, r1)), x => r0Fuc(d0Fuc(x));
33518
+ }
33519
+ function bandSpace$1(count, paddingInner, paddingOuter) {
33520
+ let space;
33521
+ return space = 1 === count ? count + 2 * paddingOuter : count - paddingInner + 2 * paddingOuter, count ? space > 0 ? space : 1 : 0;
33522
+ }
33523
+ function scaleWholeRangeSize$1(count, bandwidth, paddingInner, paddingOuter) {
33524
+ return bandSpace$1(count, paddingInner, paddingOuter) * (bandwidth / (1 - paddingInner));
33525
+ }
33526
+ function calculateBandwidthFromWholeRangeSize(count, wholeSize, paddingInner, paddingOuter, round) {
33527
+ const space = bandSpace$1(count, paddingInner, paddingOuter);
33528
+ let step = wholeSize / Math.max(1, space || 1);
33529
+ round && (step = Math.floor(step));
33530
+ let bandwidth = step * (1 - paddingInner);
33531
+ return round && (bandwidth = Math.round(bandwidth)), bandwidth;
33532
+ }
33533
+ function calculateWholeRangeFromRangeFactor(range, rangeFactor) {
33534
+ const k = (range[1] - range[0]) / (rangeFactor[1] - rangeFactor[0]),
33535
+ b = range[0] - k * rangeFactor[0];
33536
+ return [b, k + b];
33537
+ }
33538
+ function polymap(domain, range, interpolate) {
33539
+ const j = Math.min(domain.length, range.length) - 1,
33540
+ d = new Array(j),
33541
+ r = new Array(j);
33542
+ let i = -1;
33543
+ for (domain[j] < domain[0] && (domain = domain.slice().reverse(), range = range.slice().reverse()); ++i < j;) d[i] = normalize(domain[i], domain[i + 1]), r[i] = interpolate(range[i], range[i + 1]);
33544
+ return function (x) {
33545
+ const i = bisect(domain, x, 1, j) - 1;
33546
+ return r[i](d[i](x));
33547
+ };
33548
+ }
33549
+ const nice = (domain, options) => {
33550
+ const newDomain = domain.slice();
33551
+ let startIndex = 0,
33552
+ endIndex = newDomain.length - 1,
33553
+ x0 = newDomain[startIndex],
33554
+ x1 = newDomain[endIndex];
33555
+ return x1 < x0 && ([startIndex, endIndex] = [endIndex, startIndex], [x0, x1] = [x1, x0]), newDomain[startIndex] = options.floor(x0), newDomain[endIndex] = options.ceil(x1), newDomain;
33556
+ };
33557
+ const niceNumber = function (value) {
33558
+ let round = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
33559
+ const exponent = Math.floor(Math.log10(value)),
33560
+ fraction = value / Math.pow(10, exponent);
33561
+ let niceFraction;
33562
+ return niceFraction = round ? fraction < 1.5 ? 1 : fraction < 3 ? 2 : fraction < 7 ? 5 : 10 : fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10, niceFraction * Math.pow(10, exponent);
33563
+ };
33564
+ const restrictNumber = (value, domain) => {
33565
+ let min, max;
33566
+ return domain[0] < domain[1] ? (min = domain[0], max = domain[1]) : (min = domain[1], max = domain[0]), Math.min(Math.max(value, min), max);
33567
+ };
33568
+
33318
33569
  class BaseScale {
33570
+ constructor() {
33571
+ this._rangeFactorStart = null, this._rangeFactorEnd = null;
33572
+ }
33319
33573
  _calculateWholeRange(range) {
33320
- if (this._wholeRange) return this._wholeRange;
33321
- if (this._rangeFactor && 2 === range.length) {
33322
- const k = (range[1] - range[0]) / (this._rangeFactor[1] - this._rangeFactor[0]),
33323
- b = range[0] - k * this._rangeFactor[0],
33324
- r0 = b,
33325
- r1 = k + b;
33326
- return this._wholeRange = [r0, r1], this._wholeRange;
33327
- }
33328
- return range;
33574
+ return this._wholeRange ? this._wholeRange : isValid$1(this._rangeFactorStart) && isValid$1(this._rangeFactorEnd) && 2 === range.length ? (this._wholeRange = calculateWholeRangeFromRangeFactor(range, [this._rangeFactorStart, this._rangeFactorEnd]), this._wholeRange) : range;
33329
33575
  }
33330
33576
  rangeFactor(_, slience, clear) {
33331
- return _ ? (2 === _.length && _.every(r => r >= 0 && r <= 1) && (this._wholeRange = null, this._rangeFactor = 0 === _[0] && 1 === _[1] ? null : _), this) : clear ? (this._wholeRange = null, this._rangeFactor = null, this) : this._rangeFactor;
33577
+ return _ ? (2 === _.length && _.every(r => r >= 0 && r <= 1) && (this._wholeRange = null, 0 === _[0] && 1 === _[1] ? (this._rangeFactorStart = null, this._rangeFactorEnd = null) : (this._rangeFactorStart = _[0], this._rangeFactorEnd = _[1])), this) : clear ? (this._wholeRange = null, this._rangeFactorStart = null, this._rangeFactorEnd = null, this) : isValid$1(this._rangeFactorStart) && isValid$1(this._rangeFactorEnd) ? [this._rangeFactorStart, this._rangeFactorEnd] : null;
33578
+ }
33579
+ rangeFactorStart(_, slience) {
33580
+ return _ ? (_ >= 0 && _ <= 1 && (this._wholeRange = null, 0 !== _ || !isNil$1(this._rangeFactorEnd) && 1 !== this._rangeFactorEnd ? this._rangeFactorStart = _ : (this._rangeFactorStart = null, this._rangeFactorEnd = null)), this) : this._rangeFactorStart;
33581
+ }
33582
+ rangeFactorEnd(_, slience) {
33583
+ return _ ? (_ >= 0 && _ <= 1 && (this._wholeRange = null, 0 !== _ || !isNil$1(this._rangeFactorStart) && 0 !== this._rangeFactorStart ? this._rangeFactorEnd = _ : (this._rangeFactorStart = null, this._rangeFactorEnd = null)), this) : this._rangeFactorEnd;
33332
33584
  }
33333
33585
  generateFishEyeTransform() {
33334
33586
  var _a;
@@ -33377,7 +33629,7 @@
33377
33629
  return new OrdinalScale().domain(this._domain).range(this._ordinalRange).unknown(this._unknown);
33378
33630
  }
33379
33631
  calculateVisibleDomain(range) {
33380
- if (this._rangeFactor && 2 === range.length) {
33632
+ if (isValid$1(this._rangeFactorStart) && isValid$1(this._rangeFactorEnd) && 2 === range.length) {
33381
33633
  return [this.invert(range[0]), this.invert(range[1])];
33382
33634
  }
33383
33635
  return this._domain;
@@ -33415,77 +33667,6 @@
33415
33667
  }
33416
33668
  }
33417
33669
 
33418
- function identity(x) {
33419
- return x;
33420
- }
33421
- const generatePow = exponent => x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
33422
- const sqrt$1 = x => x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
33423
- const square$1 = x => x < 0 ? -x * x : x * x;
33424
- const logNegative = x => -Math.log(-x);
33425
- const expNegative = x => -Math.exp(-x);
33426
- const pow10 = x => isFinite(x) ? Math.pow(10, x) : x < 0 ? 0 : x;
33427
- const powp = base => 10 === base ? pow10 : base === Math.E ? Math.exp : x => Math.pow(base, x);
33428
- const logp = base => base === Math.E ? Math.log : 10 === base ? Math.log10 : 2 === base ? Math.log2 : (base = Math.log(base), x => Math.log(x) / base);
33429
- const symlog = c => x => Math.sign(x) * Math.log1p(Math.abs(x / c));
33430
- const symexp = c => x => Math.sign(x) * Math.expm1(Math.abs(x)) * c;
33431
- function normalize(a, b) {
33432
- if (a = Number(a), b = Number(b), b -= a) return x => (x - a) / b;
33433
- const result = Number.isNaN(b) ? NaN : .5;
33434
- return () => result;
33435
- }
33436
- function bimap(domain, range, interpolate) {
33437
- const d0 = domain[0],
33438
- d1 = domain[1],
33439
- r0 = range[0],
33440
- r1 = range[1];
33441
- let d0Fuc, r0Fuc;
33442
- return d1 < d0 ? (d0Fuc = normalize(d1, d0), r0Fuc = interpolate(r1, r0)) : (d0Fuc = normalize(d0, d1), r0Fuc = interpolate(r0, r1)), x => r0Fuc(d0Fuc(x));
33443
- }
33444
- function bandSpace$1(count, paddingInner, paddingOuter) {
33445
- let space;
33446
- return space = 1 === count ? count + 2 * paddingOuter : count - paddingInner + 2 * paddingOuter, count ? space > 0 ? space : 1 : 0;
33447
- }
33448
- function scaleWholeRangeSize$1(count, bandwidth, paddingInner, paddingOuter) {
33449
- return bandSpace$1(count, paddingInner, paddingOuter) * (bandwidth / (1 - paddingInner));
33450
- }
33451
- function calculateBandwidthFromWholeRangeSize(count, wholeSize, paddingInner, paddingOuter, round) {
33452
- const space = bandSpace$1(count, paddingInner, paddingOuter);
33453
- let step = wholeSize / Math.max(1, space || 1);
33454
- round && (step = Math.floor(step));
33455
- let bandwidth = step * (1 - paddingInner);
33456
- return round && (bandwidth = Math.round(bandwidth)), bandwidth;
33457
- }
33458
- function polymap(domain, range, interpolate) {
33459
- const j = Math.min(domain.length, range.length) - 1,
33460
- d = new Array(j),
33461
- r = new Array(j);
33462
- let i = -1;
33463
- for (domain[j] < domain[0] && (domain = domain.slice().reverse(), range = range.slice().reverse()); ++i < j;) d[i] = normalize(domain[i], domain[i + 1]), r[i] = interpolate(range[i], range[i + 1]);
33464
- return function (x) {
33465
- const i = bisect(domain, x, 1, j) - 1;
33466
- return r[i](d[i](x));
33467
- };
33468
- }
33469
- const nice = (domain, options) => {
33470
- const newDomain = domain.slice();
33471
- let startIndex = 0,
33472
- endIndex = newDomain.length - 1,
33473
- x0 = newDomain[startIndex],
33474
- x1 = newDomain[endIndex];
33475
- return x1 < x0 && ([startIndex, endIndex] = [endIndex, startIndex], [x0, x1] = [x1, x0]), newDomain[startIndex] = options.floor(x0), newDomain[endIndex] = options.ceil(x1), newDomain;
33476
- };
33477
- const niceNumber = function (value) {
33478
- let round = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
33479
- const exponent = Math.floor(Math.log10(value)),
33480
- fraction = value / Math.pow(10, exponent);
33481
- let niceFraction;
33482
- return niceFraction = round ? fraction < 1.5 ? 1 : fraction < 3 ? 2 : fraction < 7 ? 5 : 10 : fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10, niceFraction * Math.pow(10, exponent);
33483
- };
33484
- const restrictNumber = (value, domain) => {
33485
- let min, max;
33486
- return domain[0] < domain[1] ? (min = domain[0], max = domain[1]) : (min = domain[1], max = domain[0]), Math.min(Math.max(value, min), max);
33487
- };
33488
-
33489
33670
  function ticks$2(start, stop, count, allowExcessive) {
33490
33671
  let reverse;
33491
33672
  const ticks = [];
@@ -33518,10 +33699,10 @@
33518
33699
  constructor(slience) {
33519
33700
  super(), this.type = ScaleEnum.Band, this._range = [0, 1], this._step = void 0, this._bandwidth = void 0, this._isFixed = !1, this._round = !1, this._paddingInner = 0, this._paddingOuter = 0, this._align = .5, this._unknown = void 0, delete this.unknown, this.rescale(slience);
33520
33701
  }
33521
- rescale(slience) {
33702
+ rescale(slience, changeProperty) {
33522
33703
  if (slience) return this;
33523
33704
  this._wholeRange = null;
33524
- const wholeRange = this._calculateWholeRange(this._range),
33705
+ const wholeRange = this._calculateWholeRange(this._range, changeProperty),
33525
33706
  n = super.domain().length,
33526
33707
  reverse = wholeRange[1] < wholeRange[0];
33527
33708
  let start = wholeRange[Number(reverse) - 0];
@@ -33531,22 +33712,25 @@
33531
33712
  const values = range(n).map(i => start + this._step * i);
33532
33713
  return super.range(reverse ? values.reverse() : values), this.generateFishEyeTransform(), this;
33533
33714
  }
33534
- _calculateWholeRange(range) {
33535
- var _a;
33715
+ _calculateWholeRange(range, changeProperty) {
33536
33716
  if (this._wholeRange) return this._wholeRange;
33537
33717
  if ((this._minBandwidth || this._maxBandwidth) && !this._isBandwidthFixedByUser()) {
33538
- const autoBandwidth = calculateBandwidthFromWholeRangeSize(super.domain().length, Math.abs(range[1] - range[0]), this._paddingInner, this._paddingOuter, this._round);
33718
+ let wholeSize;
33719
+ if (isValid$1(this._rangeFactorStart) && isValid$1(this._rangeFactorEnd) && 2 === range.length) {
33720
+ const wholeRange = calculateWholeRangeFromRangeFactor(range, [this._rangeFactorStart, this._rangeFactorEnd]);
33721
+ wholeSize = Math.abs(wholeRange[1] - wholeRange[0]);
33722
+ } else wholeSize = Math.abs(range[1] - range[0]);
33723
+ const autoBandwidth = calculateBandwidthFromWholeRangeSize(super.domain().length, wholeSize, this._paddingInner, this._paddingOuter, this._round);
33539
33724
  autoBandwidth < this._minBandwidth ? (this._bandwidth = this._minBandwidth, this._isFixed = !0) : autoBandwidth > this._maxBandwidth ? (this._bandwidth = this._maxBandwidth, this._isFixed = !0) : (this._bandwidth = autoBandwidth, this._isFixed = !1);
33540
33725
  }
33541
33726
  if (this.isBandwidthFixed()) {
33542
33727
  const wholeLength = scaleWholeRangeSize$1(super.domain().length, this._bandwidth, this._paddingInner, this._paddingOuter),
33543
33728
  rangeFactorSize = Math.min((range[1] - range[0]) / wholeLength, 1);
33544
- if (null === (_a = this._rangeFactor) || void 0 === _a ? void 0 : _a.length) {
33545
- const [rangeFactorStart, rangeFactorEnd] = this._rangeFactor,
33546
- r0 = range[0] - wholeLength * rangeFactorStart,
33729
+ if (isValid$1(this._rangeFactorStart) && isValid$1(this._rangeFactorEnd)) {
33730
+ const r0 = range[0] - wholeLength * this._rangeFactorStart,
33547
33731
  r1 = r0 + wholeLength;
33548
- this._wholeRange = [r0, r1], this._rangeFactor = rangeFactorStart + rangeFactorSize <= 1 ? [rangeFactorStart, rangeFactorStart + rangeFactorSize] : rangeFactorEnd - rangeFactorSize >= 0 ? [rangeFactorEnd - rangeFactorSize, rangeFactorEnd] : [0, rangeFactorSize];
33549
- } else this._rangeFactor = [0, rangeFactorSize], this._wholeRange = [range[0], range[0] + wholeLength];
33732
+ this._wholeRange = [r0, r1], "rangeFactorStart" === changeProperty && this._rangeFactorStart + rangeFactorSize <= 1 ? this._rangeFactorEnd = this._rangeFactorStart + rangeFactorSize : "rangeFactorEnd" === changeProperty && this._rangeFactorEnd - rangeFactorSize >= 0 ? this._rangeFactorStart = this._rangeFactorEnd - rangeFactorSize : this._rangeFactorStart + rangeFactorSize <= 1 ? this._rangeFactorEnd = this._rangeFactorStart + rangeFactorSize : this._rangeFactorEnd - rangeFactorSize >= 0 ? this._rangeFactorStart = this._rangeFactorEnd - rangeFactorSize : (this._rangeFactorStart = 0, this._rangeFactorEnd = rangeFactorSize);
33733
+ } else this._rangeFactorStart = 0, this._rangeFactorEnd = rangeFactorSize, this._wholeRange = [range[0], range[0] + wholeLength];
33550
33734
  return this._wholeRange;
33551
33735
  }
33552
33736
  return super._calculateWholeRange(range);
@@ -33557,7 +33741,7 @@
33557
33741
  }
33558
33742
  calculateVisibleDomain(range) {
33559
33743
  const domain = this._domain;
33560
- if (this._rangeFactor && domain.length) {
33744
+ if (isValid$1(this._rangeFactorStart) && isValid$1(this._rangeFactorEnd) && domain.length) {
33561
33745
  const d0 = this._getInvertIndex(range[0]),
33562
33746
  d1 = this._getInvertIndex(range[1]);
33563
33747
  return domain.slice(Math.min(d0, d1), Math.max(d0, d1) + 1);
@@ -33635,6 +33819,12 @@
33635
33819
  rangeFactor(_, slience) {
33636
33820
  return _ ? (super.rangeFactor(_), this.rescale(slience)) : super.rangeFactor();
33637
33821
  }
33822
+ rangeFactorStart(_, slience) {
33823
+ return _ ? (super.rangeFactorStart(_), this.rescale(slience, "rangeFactorStart")) : super.rangeFactorStart();
33824
+ }
33825
+ rangeFactorEnd(_, slience) {
33826
+ return _ ? (super.rangeFactorEnd(_), this.rescale(slience, "rangeFactorEnd")) : super.rangeFactorEnd();
33827
+ }
33638
33828
  bandwidth(_, slience) {
33639
33829
  return _ ? ("auto" === _ ? (this._bandwidth = void 0, this._isFixed = !1) : (this._bandwidth = _, this._isFixed = !0), this._userBandwidth = _, this.rescale(slience)) : this._bandwidth;
33640
33830
  }
@@ -33685,7 +33875,7 @@
33685
33875
  }
33686
33876
  calculateVisibleDomain(range) {
33687
33877
  var _a;
33688
- if (this._rangeFactor && 2 === range.length) {
33878
+ if (isValid$1(this._rangeFactorStart) && isValid$1(this._rangeFactorEnd) && 2 === range.length) {
33689
33879
  return [this.invert(range[0]), this.invert(range[1])];
33690
33880
  }
33691
33881
  return null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain;
@@ -33966,7 +34156,7 @@
33966
34156
  let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
33967
34157
  let options = arguments.length > 1 ? arguments[1] : undefined;
33968
34158
  var _a;
33969
- if (this._rangeFactor && (this._rangeFactor[0] > 0 || this._rangeFactor[1] < 1) && 2 === this._range.length || !this._niceType) return this.d3Ticks(count, options);
34159
+ if (isValid$1(this._rangeFactorStart) && isValid$1(this._rangeFactorEnd) && (this._rangeFactorStart > 0 || this._rangeFactorEnd < 1) && 2 === this._range.length || !this._niceType) return this.d3Ticks(count, options);
33970
34160
  const curNiceDomain = null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain,
33971
34161
  originalDomain = this._domain,
33972
34162
  start = curNiceDomain[0],
@@ -34072,7 +34262,7 @@
34072
34262
  }
34073
34263
  2 * z.length < count && (z = ticks$1(u, v, count));
34074
34264
  } else z = ticks$1(i, j, Math.min(j - i, count)).map(this._pows);
34075
- return r ? z.reverse() : z;
34265
+ return z = z.filter(t => 0 !== t), r ? z.reverse() : z;
34076
34266
  }
34077
34267
  ticks() {
34078
34268
  let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
@@ -34100,7 +34290,7 @@
34100
34290
  } else niceType = "all";
34101
34291
  if (niceType) {
34102
34292
  const niceDomain = nice(originalDomain.slice(), {
34103
- floor: x => Math.floor(x),
34293
+ floor: x => this._pows(Math.floor(this._logs(x))),
34104
34294
  ceil: x => Math.ceil(x)
34105
34295
  });
34106
34296
  return "min" === niceType ? niceDomain[niceDomain.length - 1] = null !== (_a = niceMinMax[1]) && void 0 !== _a ? _a : niceDomain[niceDomain.length - 1] : "max" === niceType && (niceDomain[0] = null !== (_b = niceMinMax[0]) && void 0 !== _b ? _b : niceDomain[0]), this._niceDomain = niceDomain, this.rescale(), this;
@@ -36430,7 +36620,7 @@
36430
36620
  if (isVisible(itemAttr.shape) && itemGroup.createOrUpdateChild(`${itemGroupName}-shape`, Object.assign({
36431
36621
  visible: !0,
36432
36622
  x: itemAttr.shape.size / 2,
36433
- y: itemAttr.shape.size / 2 + ((null !== (_a = itemAttr.key.lineHeight) && void 0 !== _a ? _a : itemAttr.key.fontSize) - itemAttr.shape.size) / 2
36623
+ y: itemAttr.shape.size / 2 + ((null !== (_a = calculateLineHeight(itemAttr.key.lineHeight, itemAttr.key.fontSize)) && void 0 !== _a ? _a : itemAttr.key.fontSize) - itemAttr.shape.size) / 2
36434
36624
  }, itemAttr.shape), "symbol"), hasContentShape && (x += itemAttr.shape.size + itemAttr.shape.spacing), isVisible(itemAttr.key)) {
36435
36625
  let element;
36436
36626
  element = itemAttr.key.multiLine ? itemGroup.createOrUpdateChild(`${itemGroupName}-key`, Object.assign(Object.assign({
@@ -37660,7 +37850,7 @@
37660
37850
  let scaleX, scaleY;
37661
37851
  return nativeCanvas && (scaleX = rect.width / nativeCanvas.offsetWidth, scaleY = rect.height / nativeCanvas.offsetHeight), {
37662
37852
  x: (x - rect.left) / (isValidNumber$1(scaleX) ? scaleX : 1),
37663
- y: (y - rect.top) / (isValidNumber$1(scaleY) ? scaleX : 1)
37853
+ y: (y - rect.top) / (isValidNumber$1(scaleY) ? scaleY : 1)
37664
37854
  };
37665
37855
  }
37666
37856
  return {
@@ -39892,7 +40082,7 @@
39892
40082
  width = data.width, height = data.height;
39893
40083
  }
39894
40084
  let dpr = params.dpr;
39895
- if (!1 === params.canvasControled && (dpr && console.warn("canvasControled为false后,dpr参数将无效"), dpr = null), null == dpr) {
40085
+ if (null == dpr) {
39896
40086
  dpr = null !== (_a = canvas.getContext("2d").pixelRatio) && void 0 !== _a ? _a : canvas.width / width;
39897
40087
  }
39898
40088
  this.canvas = new BrowserCanvas({
@@ -45539,7 +45729,9 @@
45539
45729
  }
45540
45730
  removeAllGraphicItems() {
45541
45731
  return this.traverseMarkTree(mark => {
45542
- mark.graphicItem && removeGraphicItem(mark.graphicItem), mark.graphicItem = null;
45732
+ mark.graphicItem && (removeGraphicItem(mark.graphicItem), mark.elementMap.forEach(element => {
45733
+ element.resetGraphicItem();
45734
+ }), mark.graphicItem = null);
45543
45735
  }), this;
45544
45736
  }
45545
45737
  parseSpec(spec) {
@@ -48588,7 +48780,7 @@
48588
48780
  }
48589
48781
  };
48590
48782
 
48591
- const sankey$1 = {
48783
+ const sankey = {
48592
48784
  link: {
48593
48785
  style: {
48594
48786
  fillOpacity: 0.15,
@@ -48665,7 +48857,7 @@
48665
48857
  rangeColumn,
48666
48858
  circlePacking,
48667
48859
  heatmap,
48668
- sankey: sankey$1,
48860
+ sankey,
48669
48861
  rose,
48670
48862
  boxPlot,
48671
48863
  correlation: correlation$1
@@ -51410,23 +51602,28 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
51410
51602
 
51411
51603
  class DimensionEvent {
51412
51604
  constructor(eventDispatcher, mode) {
51413
- var _a, _b;
51414
51605
  this._eventDispatcher = eventDispatcher;
51415
51606
  this._mode = mode;
51416
- this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
51607
+ }
51608
+ get chart() {
51609
+ var _a, _b;
51610
+ if (!this._chart) {
51611
+ this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
51612
+ }
51613
+ return this._chart;
51417
51614
  }
51418
51615
  register(eType, handler) {
51419
51616
  var _a, _b;
51420
- ((_b = (_a = this._chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error$1)('Method not implemented.');
51617
+ ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error$1)('Method not implemented.');
51421
51618
  }
51422
51619
  unregister() {
51423
51620
  var _a, _b;
51424
- ((_b = (_a = this._chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error$1)('Method not implemented.');
51621
+ ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error$1)('Method not implemented.');
51425
51622
  }
51426
51623
  getTargetDimensionInfo(x, y) {
51427
51624
  var _a, _b;
51428
- const cartesianInfo = (_a = getCartesianDimensionInfo(this._chart, { x, y })) !== null && _a !== void 0 ? _a : [];
51429
- const polarInfo = (_b = getPolarDimensionInfo(this._chart, { x, y })) !== null && _b !== void 0 ? _b : [];
51625
+ const cartesianInfo = (_a = getCartesianDimensionInfo(this.chart, { x, y })) !== null && _a !== void 0 ? _a : [];
51626
+ const polarInfo = (_b = getPolarDimensionInfo(this.chart, { x, y })) !== null && _b !== void 0 ? _b : [];
51430
51627
  const result = [].concat(cartesianInfo, polarInfo);
51431
51628
  if (result.length === 0) {
51432
51629
  return null;
@@ -51435,7 +51632,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
51435
51632
  }
51436
51633
  dispatch(v, opt) {
51437
51634
  var _a;
51438
- const axis = (_a = this._chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
51635
+ const axis = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
51439
51636
  if (c.specKey !== 'axes') {
51440
51637
  return false;
51441
51638
  }
@@ -57892,7 +58089,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
57892
58089
  };
57893
58090
  registerVChartCore();
57894
58091
 
57895
- const version = "1.6.3";
58092
+ const version = "1.6.5";
57896
58093
 
57897
58094
  class ChartData {
57898
58095
  get dataList() {
@@ -76950,19 +77147,28 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
76950
77147
  }, !0);
76951
77148
  };
76952
77149
 
76953
- const sankey = (data, op) => {
76954
- var _a, _b, _c;
76955
- if (!data || !(op === null || op === void 0 ? void 0 : op.view) || !isArray$1(data)) {
76956
- return data;
76957
- }
76958
- const view = op.view();
76959
- if (view.x1 - view.x0 === 0 ||
76960
- view.y1 - view.y0 === 0 ||
76961
- view.x1 - view.x0 === -Infinity ||
76962
- view.x1 - view.x0 === Infinity ||
76963
- view.y1 - view.y0 === -Infinity ||
76964
- view.y1 - view.y0 === Infinity) {
76965
- return data;
77150
+ const collectHierarchyField = (set, data, field) => {
77151
+ data.forEach((obj) => {
77152
+ if (!isNil$1(obj[field])) {
77153
+ set.add(obj[field]);
77154
+ }
77155
+ if (obj.children && obj.children.length > 0) {
77156
+ collectHierarchyField(set, obj.children, field);
77157
+ }
77158
+ });
77159
+ };
77160
+ const convertValuesToNumbers = (data) => {
77161
+ data.forEach((obj) => {
77162
+ obj.value = isString$1(obj.value) ? +obj.value : obj.value;
77163
+ if (obj.children && obj.children.length > 0) {
77164
+ convertValuesToNumbers(obj.children);
77165
+ }
77166
+ });
77167
+ };
77168
+ const sankeyFormat = (data) => {
77169
+ var _a;
77170
+ if (!data || !isArray$1(data)) {
77171
+ return [];
76966
77172
  }
76967
77173
  if (data.length > 1) {
76968
77174
  const updateData = {
@@ -76974,58 +77180,42 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
76974
77180
  updateData[datum.id] = datum.values;
76975
77181
  }
76976
77182
  });
76977
- data = updateData;
77183
+ return [updateData];
76978
77184
  }
76979
- else {
76980
- if ((_a = data[0]) === null || _a === void 0 ? void 0 : _a.latestData) {
76981
- data = data[0].latestData[0];
76982
- }
76983
- else {
76984
- data = data[0];
76985
- }
77185
+ if ((_a = data[0]) === null || _a === void 0 ? void 0 : _a.latestData) {
77186
+ return data[0].latestData;
76986
77187
  }
76987
- if (op.sourceField !== 'source' || op.targetField !== 'target' || op.valueField !== 'value') {
76988
- for (const key in data) {
76989
- if (key === 'links') {
76990
- const updatedData = [];
76991
- data[key].forEach((datum) => {
76992
- const updatedDatum = {};
76993
- for (const key in datum) {
76994
- if (key === op.sourceField) {
76995
- updatedDatum.source = datum[op.sourceField];
76996
- }
76997
- else if (key === op.targetField) {
76998
- updatedDatum.target = datum[op.targetField];
76999
- }
77000
- else if (key === op.valueField) {
77001
- updatedDatum.value = datum[op.valueField];
77002
- }
77003
- else {
77004
- updatedDatum[key] = datum[key];
77005
- }
77006
- }
77007
- updatedData.push(updatedDatum);
77008
- });
77009
- data[key] = updatedData;
77010
- }
77011
- }
77188
+ return data;
77189
+ };
77190
+ const sankeyLayout = (data, op) => {
77191
+ var _a, _b;
77192
+ if (!data || !(op === null || op === void 0 ? void 0 : op.view) || !data.length) {
77193
+ return [];
77012
77194
  }
77013
- const convertValuesToNumbers = (data) => {
77014
- data.forEach((obj) => {
77015
- obj.value = isString$1(obj.value) ? +obj.value : obj.value;
77016
- if (obj.children && obj.children.length > 0) {
77017
- convertValuesToNumbers(obj.children);
77018
- }
77019
- });
77020
- };
77021
- for (const key in data) {
77022
- if (key === 'links') {
77195
+ const view = op.view();
77196
+ if (view.x1 - view.x0 === 0 ||
77197
+ view.y1 - view.y0 === 0 ||
77198
+ view.x1 - view.x0 === -Infinity ||
77199
+ view.x1 - view.x0 === Infinity ||
77200
+ view.y1 - view.y0 === -Infinity ||
77201
+ view.y1 - view.y0 === Infinity) {
77202
+ return [];
77203
+ }
77204
+ const originalData = data[0];
77205
+ if (op.sourceField !== 'source' || op.targetField !== 'target' || op.valueField !== 'value') {
77206
+ if (originalData.links) {
77023
77207
  const updatedData = [];
77024
- data[key].forEach((datum) => {
77208
+ originalData.links.forEach((datum) => {
77025
77209
  const updatedDatum = {};
77026
77210
  for (const key in datum) {
77027
- if (key === 'value') {
77028
- updatedDatum.value = isString$1(datum.value) ? +datum.value : datum.value;
77211
+ if (key === op.sourceField) {
77212
+ updatedDatum.source = datum[op.sourceField];
77213
+ }
77214
+ else if (key === op.targetField) {
77215
+ updatedDatum.target = datum[op.targetField];
77216
+ }
77217
+ else if (key === op.valueField) {
77218
+ updatedDatum.value = datum[op.valueField];
77029
77219
  }
77030
77220
  else {
77031
77221
  updatedDatum[key] = datum[key];
@@ -77033,17 +77223,31 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77033
77223
  }
77034
77224
  updatedData.push(updatedDatum);
77035
77225
  });
77036
- data[key] = updatedData;
77226
+ originalData.links = updatedData;
77037
77227
  }
77038
- else if (key === 'nodes') {
77039
- if ((_c = (_b = data.nodes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.children) {
77040
- convertValuesToNumbers(data.nodes);
77228
+ }
77229
+ if (originalData.links) {
77230
+ const updatedData = [];
77231
+ originalData.links.forEach((datum) => {
77232
+ const updatedDatum = {};
77233
+ for (const key in datum) {
77234
+ if (key === 'value') {
77235
+ updatedDatum.value = isString$1(datum.value) ? +datum.value : datum.value;
77236
+ }
77237
+ else {
77238
+ updatedDatum[key] = datum[key];
77239
+ }
77041
77240
  }
77042
- }
77241
+ updatedData.push(updatedDatum);
77242
+ });
77243
+ originalData.links = updatedData;
77244
+ }
77245
+ else if ((_b = (_a = originalData.nodes) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.children) {
77246
+ convertValuesToNumbers(originalData.nodes);
77043
77247
  }
77044
77248
  const layout = new SankeyLayout(op);
77045
77249
  const result = [];
77046
- result.push(layout.layout(data, view));
77250
+ result.push(layout.layout(originalData, view));
77047
77251
  return result;
77048
77252
  };
77049
77253
 
@@ -77765,12 +77969,18 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77765
77969
  this._labelLimit = (_c = (_b = this._spec.label) === null || _b === void 0 ? void 0 : _b.limit) !== null && _c !== void 0 ? _c : 100;
77766
77970
  }
77767
77971
  initData() {
77768
- var _a, _b, _c, _d, _e, _f;
77972
+ var _a, _b, _c, _d;
77769
77973
  super.initData();
77770
- if (this.getViewData()) {
77771
- registerDataSetInstanceTransform(this._dataSet, 'sankey', sankey);
77772
- this.addViewDataFilter({
77773
- type: 'sankey',
77974
+ const viewData = this.getViewData();
77975
+ const rawData = this.getRawData();
77976
+ if (rawData && viewData) {
77977
+ registerDataSetInstanceTransform(this._dataSet, 'sankeyLayout', sankeyLayout);
77978
+ registerDataSetInstanceTransform(this._dataSet, 'sankeyFormat', sankeyFormat);
77979
+ rawData.transform({
77980
+ type: 'sankeyFormat'
77981
+ }, false);
77982
+ viewData.transform({
77983
+ type: 'sankeyLayout',
77774
77984
  options: {
77775
77985
  view: () => {
77776
77986
  return {
@@ -77799,12 +78009,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77799
78009
  },
77800
78010
  level: TransformLevel.sankeyLayout
77801
78011
  });
77802
- const nodesDataSet = new DataSet();
77803
- registerDataSetInstanceParser(nodesDataSet, 'dataview', dataViewParser);
77804
- registerDataSetInstanceTransform(nodesDataSet, 'sankeyNodes', sankeyNodes);
77805
- registerDataSetInstanceTransform(nodesDataSet, 'addVChartProperty', addVChartProperty);
77806
- registerDataSetInstanceTransform(nodesDataSet, 'flatten', flatten);
77807
- const nodesDataView = new DataView(nodesDataSet, { name: `sankey-node-${this.id}-data` });
78012
+ const { dataSet } = this._option;
78013
+ registerDataSetInstanceTransform(dataSet, 'sankeyNodes', sankeyNodes);
78014
+ registerDataSetInstanceTransform(dataSet, 'flatten', flatten);
78015
+ const nodesDataView = new DataView(dataSet, { name: `sankey-node-${this.id}-data` });
77808
78016
  nodesDataView.parse([this.getViewData()], {
77809
78017
  type: 'dataview'
77810
78018
  });
@@ -77822,7 +78030,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77822
78030
  return node;
77823
78031
  }
77824
78032
  }
77825
- });
78033
+ }, false);
77826
78034
  nodesDataView.transform({
77827
78035
  type: 'addVChartProperty',
77828
78036
  options: {
@@ -77830,13 +78038,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77830
78038
  call: addDataKey
77831
78039
  }
77832
78040
  }, false);
77833
- (_e = this._data) === null || _e === void 0 ? void 0 : _e.getDataView().target.addListener('change', nodesDataView.reRunAllTransform);
77834
78041
  this._nodesSeriesData = new SeriesData(this._option, nodesDataView);
77835
- const linksDataSet = new DataSet();
77836
- registerDataSetInstanceParser(linksDataSet, 'dataview', dataViewParser);
77837
- registerDataSetInstanceTransform(linksDataSet, 'sankeyLinks', sankeyLinks);
77838
- registerDataSetInstanceTransform(linksDataSet, 'addVChartProperty', addVChartProperty);
77839
- const linksDataView = new DataView(linksDataSet, { name: `sankey-link-${this.id}-data` });
78042
+ registerDataSetInstanceTransform(dataSet, 'sankeyLinks', sankeyLinks);
78043
+ const linksDataView = new DataView(dataSet, { name: `sankey-link-${this.id}-data` });
77840
78044
  linksDataView.parse([this.getViewData()], {
77841
78045
  type: 'dataview'
77842
78046
  });
@@ -77850,7 +78054,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77850
78054
  call: addDataKey
77851
78055
  }
77852
78056
  }, false);
77853
- (_f = this._data) === null || _f === void 0 ? void 0 : _f.getDataView().target.addListener('change', linksDataView.reRunAllTransform);
77854
78057
  this._linksSeriesData = new SeriesData(this._option, linksDataView);
77855
78058
  }
77856
78059
  }
@@ -77922,11 +78125,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
77922
78125
  y1: (datum) => datum.y1,
77923
78126
  thickness: (datum) => datum.thickness,
77924
78127
  fill: (datum) => {
77925
- var _a, _b, _c, _d, _e, _f, _g, _h;
77926
- const sourceName = ((_a = this._spec) === null || _a === void 0 ? void 0 : _a.nodeKey) || ((_d = (_c = (_b = this._rawData.latestData[0]) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.children)
78128
+ var _a, _b, _c, _d, _e, _f, _g;
78129
+ const fill = (_b = (_a = this._spec.link) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fill;
78130
+ if (fill) {
78131
+ return fill;
78132
+ }
78133
+ const sourceName = ((_c = this._spec) === null || _c === void 0 ? void 0 : _c.nodeKey) || ((_f = (_e = (_d = this._rawData.latestData[0]) === null || _d === void 0 ? void 0 : _d.nodes) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.children)
77927
78134
  ? datum.source
77928
78135
  : this.getNodeList()[datum.source];
77929
- return (_g = (_f = (_e = this._spec.link) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.fill) !== null && _g !== void 0 ? _g : (_h = this._colorScale) === null || _h === void 0 ? void 0 : _h.scale(sourceName);
78136
+ return (_g = this._colorScale) === null || _g === void 0 ? void 0 : _g.scale(sourceName);
77930
78137
  },
77931
78138
  direction: (_a = this._spec.direction) !== null && _a !== void 0 ? _a : 'horizontal'
77932
78139
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
@@ -78141,12 +78348,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
78141
78348
  }
78142
78349
  }
78143
78350
  nodesSeriesDataUpdate() {
78144
- this.event.emit(ChartEvent.legendFilter, { model: this });
78145
78351
  this._nodesSeriesData.updateData();
78146
78352
  this._setNodeOrdinalColorScale();
78147
78353
  }
78148
78354
  linksSeriesDataUpdate() {
78149
- this.event.emit(ChartEvent.legendFilter, { model: this });
78150
78355
  this._linksSeriesData.updateData();
78151
78356
  }
78152
78357
  initTooltip() {
@@ -78215,22 +78420,50 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
78215
78420
  getMeasureField() {
78216
78421
  return [this._valueField];
78217
78422
  }
78218
- getSeriesKeys() {
78219
- var _a, _b;
78220
- if (this._seriesField) {
78221
- const keyArray = [];
78222
- (_b = (_a = this._nodesSeriesData) === null || _a === void 0 ? void 0 : _a.getDataView()) === null || _b === void 0 ? void 0 : _b.latestData.forEach((datum) => {
78223
- var _a;
78224
- keyArray.push((_a = datum[this._seriesField]) !== null && _a !== void 0 ? _a : datum.datum[this._seriesField]);
78225
- });
78226
- return keyArray;
78423
+ getRawDataStatisticsByField(field, isNumeric) {
78424
+ var _a;
78425
+ if (!this._rawStatisticsCache) {
78426
+ this._rawStatisticsCache = {};
78227
78427
  }
78228
- return [];
78428
+ if (!this._rawStatisticsCache[field]) {
78429
+ const canUseViewStatistics = this._viewDataStatistics && this.getViewData().transformsArr.length <= 1;
78430
+ if (canUseViewStatistics && ((_a = this._viewDataStatistics.latestData) === null || _a === void 0 ? void 0 : _a[field])) {
78431
+ this._rawStatisticsCache[field] = this._viewDataStatistics.latestData[field];
78432
+ }
78433
+ else if (this._rawData) {
78434
+ this._rawStatisticsCache[field] = {
78435
+ values: this._collectByField(field)
78436
+ };
78437
+ }
78438
+ }
78439
+ return this._rawStatisticsCache[field];
78440
+ }
78441
+ _collectByField(field) {
78442
+ var _a, _b, _c;
78443
+ const keyArray = [];
78444
+ const rawData = (_b = (_a = this.getRawData()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b[0];
78445
+ if (!rawData) {
78446
+ return [];
78447
+ }
78448
+ if (rawData.links) {
78449
+ if ((_c = rawData.nodes) === null || _c === void 0 ? void 0 : _c.length) {
78450
+ rawData.nodes.forEach((node) => {
78451
+ if (node[this._seriesField]) {
78452
+ keyArray.push(node[this._seriesField]);
78453
+ }
78454
+ });
78455
+ }
78456
+ }
78457
+ else if (rawData.nodes) {
78458
+ const set = new Set();
78459
+ collectHierarchyField(set, rawData.nodes, this._seriesField);
78460
+ return Array.from(set);
78461
+ }
78462
+ return keyArray;
78229
78463
  }
78230
78464
  onLayoutEnd(ctx) {
78231
78465
  super.onLayoutEnd(ctx);
78232
78466
  this._viewBox.set(0, 0, this._region.getLayoutRect().width, this._region.getLayoutRect().height);
78233
- this._rawData.reRunAllTransform();
78234
78467
  this.getViewData().reRunAllTransform();
78235
78468
  this._nodesSeriesData.updateData();
78236
78469
  this._linksSeriesData.updateData();
@@ -79798,6 +80031,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
79798
80031
  this._orient = v;
79799
80032
  this._layoutOrient = v;
79800
80033
  }
80034
+ set autoIndentOnce(v) {
80035
+ this._autoIndentOnce = v;
80036
+ }
79801
80037
  getScales() {
79802
80038
  return this._scales;
79803
80039
  }
@@ -79815,6 +80051,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
79815
80051
  this.layoutZIndex = LayoutZIndex.Axis;
79816
80052
  this.layoutLevel = LayoutLevel.Axis;
79817
80053
  this._orient = 'left';
80054
+ this._autoIndentOnce = false;
80055
+ this._hasAutoIndent = false;
79818
80056
  this._scales = [];
79819
80057
  this._statisticsDomain = { domain: [], index: {} };
79820
80058
  this._tick = undefined;
@@ -80429,17 +80667,26 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80429
80667
  this._layoutCache[key] = rect[key];
80430
80668
  }
80431
80669
  });
80432
- ['x1', 'x2', 'y1', 'y2'].forEach(key => {
80433
- if (this._lastComputeOutBounds[key] < this._layoutCache._lastComputeOutBounds[key]) {
80434
- this._lastComputeOutBounds[key] = this._layoutCache._lastComputeOutBounds[key];
80435
- }
80436
- else {
80437
- this._layoutCache._lastComputeOutBounds[key] = this._lastComputeOutBounds[key];
80438
- }
80439
- });
80670
+ if (this._autoIndentOnce && this._hasAutoIndent) {
80671
+ ['x1', 'x2', 'y1', 'y2'].forEach(key => {
80672
+ this.getLastComputeOutBounds()[key] = this._layoutCache._lastComputeOutBounds[key];
80673
+ });
80674
+ }
80675
+ else {
80676
+ this._hasAutoIndent = true;
80677
+ ['x1', 'x2', 'y1', 'y2'].forEach(key => {
80678
+ if (this.getLastComputeOutBounds()[key] < this._layoutCache._lastComputeOutBounds[key]) {
80679
+ this.getLastComputeOutBounds()[key] = this._layoutCache._lastComputeOutBounds[key];
80680
+ }
80681
+ else {
80682
+ this._layoutCache._lastComputeOutBounds[key] = this.getLastComputeOutBounds()[key];
80683
+ }
80684
+ });
80685
+ }
80440
80686
  return rect;
80441
80687
  }
80442
80688
  _clearLayoutCache() {
80689
+ this._hasAutoIndent = false;
80443
80690
  this._layoutCache.width = 0;
80444
80691
  this._layoutCache.height = 0;
80445
80692
  this._layoutCache._lastComputeOutBounds = { x1: 0, x2: 0, y1: 0, y2: 0 };
@@ -86474,8 +86721,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
86474
86721
  });
86475
86722
  }
86476
86723
  _handleChange(start, end, updateComponent) {
86477
- var _a;
86478
- const zoomLock = (_a = this._spec.zoomLock) !== null && _a !== void 0 ? _a : false;
86724
+ var _a, _b;
86725
+ const zoomLock = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.zoomLock) !== null && _b !== void 0 ? _b : false;
86479
86726
  if (zoomLock || end - start < this._minSpan || end - start > this._maxSpan) {
86480
86727
  return;
86481
86728
  }
@@ -86644,6 +86891,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
86644
86891
  this._relatedAxisComponent = bandAxis;
86645
86892
  }
86646
86893
  }
86894
+ if (this._relatedAxisComponent && this._filterMode === IFilterMode.axis) {
86895
+ this._relatedAxisComponent.autoIndentOnce = true;
86896
+ }
86647
86897
  }
86648
86898
  _setRegionsFromSpec() {
86649
86899
  var _a, _b;
@@ -86964,7 +87214,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
86964
87214
  var _a, _b, _c, _d, _e, _f, _g;
86965
87215
  const delayType = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType) !== null && _b !== void 0 ? _b : 'throttle';
86966
87216
  const delayTime = isValid$1((_c = this._spec) === null || _c === void 0 ? void 0 : _c.delayType) ? (_e = (_d = this._spec) === null || _d === void 0 ? void 0 : _d.delayTime) !== null && _e !== void 0 ? _e : 30 : 0;
86967
- const realTime = (_g = (_f = this._spec) === null || _f === void 0 ? void 0 : _f.realTime) !== null && _g !== void 0 ? _g : false;
87217
+ const realTime = (_g = (_f = this._spec) === null || _f === void 0 ? void 0 : _f.realTime) !== null && _g !== void 0 ? _g : true;
86968
87218
  const option = { delayType, delayTime, realTime };
86969
87219
  if (this._zoomAttr.enable) {
86970
87220
  this.initZoomEventOfRegions(this._regions, null, this._handleChartZoom, option);
@@ -87196,20 +87446,29 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
87196
87446
  }
87197
87447
  }
87198
87448
  _updateScaleRange() {
87449
+ var _a, _b;
87199
87450
  const handlerSize = (this._startHandlerSize + this._endHandlerSize) / 2;
87200
87451
  if (!this._stateScale || !this._valueScale) {
87201
87452
  return;
87202
87453
  }
87454
+ let stateScaleRange;
87455
+ const defaultSize = this._isHorizontal
87456
+ ? this.getLayoutRect().width - handlerSize
87457
+ : this.getLayoutRect().height - handlerSize;
87458
+ const defaultRange = (_b = (_a = this._relatedAxisComponent) === null || _a === void 0 ? void 0 : _a.getScale().range()) !== null && _b !== void 0 ? _b : [0, defaultSize];
87203
87459
  if (this._isHorizontal) {
87204
- this._stateScale.range([0, this._computeWidth() - handlerSize]);
87460
+ stateScaleRange = this._visible ? [0, this._computeWidth() - handlerSize] : defaultRange;
87461
+ this._stateScale.range(stateScaleRange);
87205
87462
  this._valueScale.range([this._computeHeight() - this._middleHandlerSize, 0]);
87206
87463
  }
87207
87464
  else if (this.layoutOrient === 'left') {
87208
- this._stateScale.range([0, this._computeHeight() - handlerSize]);
87465
+ stateScaleRange = this._visible ? [0, this._computeHeight() - handlerSize] : defaultRange;
87466
+ this._stateScale.range(stateScaleRange);
87209
87467
  this._valueScale.range([this._computeWidth() - this._middleHandlerSize, 0]);
87210
87468
  }
87211
87469
  else {
87212
- this._stateScale.range([0, this._computeHeight() - handlerSize]);
87470
+ stateScaleRange = this._visible ? [0, this._computeHeight() - handlerSize] : defaultRange;
87471
+ this._stateScale.range(stateScaleRange);
87213
87472
  this._valueScale.range([0, this._computeWidth() - this._middleHandlerSize]);
87214
87473
  }
87215
87474
  if (this._component) {