@visactor/vchart-extension 2.0.4-alpha.6 → 2.0.5-alpha.0

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 (77) hide show
  1. package/build/index.js +2082 -1680
  2. package/build/index.min.js +2 -2
  3. package/cjs/charts/bar-3d/series-spec-transformer.js +2 -1
  4. package/cjs/charts/candlestick/candlestick.js +1 -2
  5. package/cjs/charts/candlestick/index.d.ts +2 -0
  6. package/cjs/charts/candlestick/index.js +2 -1
  7. package/cjs/charts/candlestick/index.js.map +1 -1
  8. package/cjs/charts/candlestick/util.d.ts +2 -0
  9. package/cjs/charts/candlestick/util.js +10 -0
  10. package/cjs/charts/candlestick/util.js.map +1 -0
  11. package/cjs/charts/combination-candlestick/combination-candlestick-transformer.d.ts +14 -0
  12. package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js +205 -0
  13. package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js.map +1 -0
  14. package/cjs/charts/combination-candlestick/combination-candlestick.d.ts +12 -0
  15. package/cjs/charts/combination-candlestick/combination-candlestick.js +31 -0
  16. package/cjs/charts/combination-candlestick/combination-candlestick.js.map +1 -0
  17. package/cjs/charts/combination-candlestick/constant.d.ts +1 -0
  18. package/cjs/charts/combination-candlestick/constant.js +6 -0
  19. package/cjs/charts/combination-candlestick/constant.js.map +1 -0
  20. package/cjs/charts/combination-candlestick/index.d.ts +3 -0
  21. package/cjs/charts/combination-candlestick/index.js +22 -0
  22. package/cjs/charts/combination-candlestick/index.js.map +1 -0
  23. package/cjs/charts/combination-candlestick/interface.d.ts +12 -0
  24. package/cjs/charts/combination-candlestick/interface.js +6 -0
  25. package/cjs/charts/combination-candlestick/interface.js.map +1 -0
  26. package/cjs/charts/funnel-3d/chart.js +1 -2
  27. package/cjs/charts/funnel-3d/theme.js +2 -1
  28. package/cjs/charts/histogram-3d/index.js +1 -1
  29. package/cjs/charts/histogram-3d/interface.js +1 -1
  30. package/cjs/charts/image-cloud/image-cloud-transformer.js +1 -1
  31. package/cjs/charts/image-cloud/image-cloud.js +1 -1
  32. package/cjs/charts/image-cloud/index.js +1 -1
  33. package/cjs/charts/image-cloud/interface.js +1 -1
  34. package/cjs/charts/image-cloud/series/image-cloud.d.ts +1 -0
  35. package/cjs/charts/image-cloud/series/image-cloud.js +5 -1
  36. package/cjs/charts/image-cloud/series/image-cloud.js.map +1 -1
  37. package/cjs/index.d.ts +1 -0
  38. package/cjs/index.js +2 -2
  39. package/cjs/index.js.map +1 -1
  40. package/esm/charts/bar-3d/series-spec-transformer.js +2 -1
  41. package/esm/charts/candlestick/candlestick.js +1 -2
  42. package/esm/charts/candlestick/index.d.ts +2 -0
  43. package/esm/charts/candlestick/index.js +4 -0
  44. package/esm/charts/candlestick/index.js.map +1 -1
  45. package/esm/charts/candlestick/util.d.ts +2 -0
  46. package/esm/charts/candlestick/util.js +4 -0
  47. package/esm/charts/candlestick/util.js.map +1 -0
  48. package/esm/charts/combination-candlestick/combination-candlestick-transformer.d.ts +14 -0
  49. package/esm/charts/combination-candlestick/combination-candlestick-transformer.js +200 -0
  50. package/esm/charts/combination-candlestick/combination-candlestick-transformer.js.map +1 -0
  51. package/esm/charts/combination-candlestick/combination-candlestick.d.ts +12 -0
  52. package/esm/charts/combination-candlestick/combination-candlestick.js +29 -0
  53. package/esm/charts/combination-candlestick/combination-candlestick.js.map +1 -0
  54. package/esm/charts/combination-candlestick/constant.d.ts +1 -0
  55. package/esm/charts/combination-candlestick/constant.js +2 -0
  56. package/esm/charts/combination-candlestick/constant.js.map +1 -0
  57. package/esm/charts/combination-candlestick/index.d.ts +3 -0
  58. package/esm/charts/combination-candlestick/index.js +6 -0
  59. package/esm/charts/combination-candlestick/index.js.map +1 -0
  60. package/esm/charts/combination-candlestick/interface.d.ts +12 -0
  61. package/esm/charts/combination-candlestick/interface.js +2 -0
  62. package/esm/charts/combination-candlestick/interface.js.map +1 -0
  63. package/esm/charts/funnel-3d/chart.js +1 -2
  64. package/esm/charts/funnel-3d/theme.js +2 -1
  65. package/esm/charts/histogram-3d/index.js +1 -1
  66. package/esm/charts/histogram-3d/interface.js +1 -1
  67. package/esm/charts/image-cloud/image-cloud-transformer.js +1 -1
  68. package/esm/charts/image-cloud/image-cloud.js +1 -1
  69. package/esm/charts/image-cloud/index.js +1 -1
  70. package/esm/charts/image-cloud/interface.js +1 -1
  71. package/esm/charts/image-cloud/series/image-cloud.d.ts +1 -0
  72. package/esm/charts/image-cloud/series/image-cloud.js +5 -1
  73. package/esm/charts/image-cloud/series/image-cloud.js.map +1 -1
  74. package/esm/index.d.ts +1 -0
  75. package/esm/index.js +2 -0
  76. package/esm/index.js.map +1 -1
  77. package/package.json +8 -8
package/build/index.js CHANGED
@@ -7015,7 +7015,8 @@
7015
7015
  y1: 0,
7016
7016
  strokeBoundsBuffer: 0,
7017
7017
  cornerRadius: 0,
7018
- cornerType: "round"
7018
+ cornerType: "round",
7019
+ drawStrokeWhenZeroWH: !1
7019
7020
  });
7020
7021
  Object.assign(Object.assign({}, DefaultAttribute), {
7021
7022
  width: 0,
@@ -7024,7 +7025,8 @@
7024
7025
  y1: 0,
7025
7026
  cornerRadius: 0,
7026
7027
  length: 0,
7027
- cornerType: "round"
7028
+ cornerType: "round",
7029
+ drawStrokeWhenZeroWH: !1
7028
7030
  });
7029
7031
  const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
7030
7032
  symbolType: "circle",
@@ -7251,6 +7253,34 @@
7251
7253
  }
7252
7254
  return c;
7253
7255
  }
7256
+ static processColorStops(colorStops) {
7257
+ if (!colorStops || 0 === colorStops.length) return [];
7258
+ if (colorStops.some(item => item.length)) {
7259
+ const stops = colorStops.map(item => ({
7260
+ color: item.value,
7261
+ offset: item.length ? parseFloat(item.length.value) / 100 : -1
7262
+ }));
7263
+ stops[0].offset < 0 && (stops[0].offset = 0), stops[stops.length - 1].offset < 0 && (stops[stops.length - 1].offset = 1);
7264
+ for (let i = 1; i < stops.length - 1; i++) if (stops[i].offset < 0) {
7265
+ const prevWithOffsetIdx = i - 1;
7266
+ let nextWithOffsetIdx = i + 1;
7267
+ for (; nextWithOffsetIdx < stops.length && stops[nextWithOffsetIdx].offset < 0;) nextWithOffsetIdx++;
7268
+ const startOffset = stops[prevWithOffsetIdx].offset,
7269
+ endOffset = stops[nextWithOffsetIdx].offset,
7270
+ unspecCount = nextWithOffsetIdx - prevWithOffsetIdx;
7271
+ for (let j = 1; j < unspecCount; j++) stops[prevWithOffsetIdx + j].offset = startOffset + (endOffset - startOffset) * j / unspecCount;
7272
+ i = nextWithOffsetIdx - 1;
7273
+ }
7274
+ return stops;
7275
+ }
7276
+ return colorStops.map((item, index) => {
7277
+ const offset = colorStops.length > 1 ? index / (colorStops.length - 1) : 0;
7278
+ return {
7279
+ color: item.value,
7280
+ offset: offset
7281
+ };
7282
+ });
7283
+ }
7254
7284
  static ParseConic(datum) {
7255
7285
  const {
7256
7286
  orientation: orientation,
@@ -7264,10 +7294,7 @@
7264
7294
  y: .5,
7265
7295
  startAngle: sa,
7266
7296
  endAngle: sa + pi2,
7267
- stops: colorStops.map(item => ({
7268
- color: item.value,
7269
- offset: parseFloat(item.length.value) / 100
7270
- }))
7297
+ stops: GradientParser.processColorStops(colorStops)
7271
7298
  };
7272
7299
  }
7273
7300
  static ParseRadial(datum) {
@@ -7282,10 +7309,7 @@
7282
7309
  y1: .5,
7283
7310
  r0: 0,
7284
7311
  r1: 1,
7285
- stops: colorStops.map(item => ({
7286
- color: item.value,
7287
- offset: parseFloat(item.length.value) / 100
7288
- }))
7312
+ stops: GradientParser.processColorStops(colorStops)
7289
7313
  };
7290
7314
  }
7291
7315
  static ParseLinear(datum) {
@@ -7307,10 +7331,7 @@
7307
7331
  y0: y0,
7308
7332
  x1: x1,
7309
7333
  y1: y1,
7310
- stops: colorStops.map(item => ({
7311
- color: item.value,
7312
- offset: parseFloat(item.length.value) / 100
7313
- }))
7334
+ stops: GradientParser.processColorStops(colorStops)
7314
7335
  };
7315
7336
  }
7316
7337
  }
@@ -10219,7 +10240,7 @@
10219
10240
  });
10220
10241
  }
10221
10242
  setAttributes(params, forceUpdateTag = !1, context) {
10222
- (params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context);
10243
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
10223
10244
  }
10224
10245
  _setAttributes(params, forceUpdateTag = !1, context) {
10225
10246
  const keys = Object.keys(params);
@@ -10854,8 +10875,8 @@
10854
10875
  function strokeVisible(opacity, strokeOpacity) {
10855
10876
  return opacity * strokeOpacity > 0;
10856
10877
  }
10857
- function rectStrokeVisible(opacity, strokeOpacity, width, height) {
10858
- return opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
10878
+ function rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH) {
10879
+ return drawStrokeWhenZeroWH ? opacity * strokeOpacity > 0 : opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
10859
10880
  }
10860
10881
  function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
10861
10882
  const x10 = x1 - x0,
@@ -12843,7 +12864,7 @@
12843
12864
  case "right":
12844
12865
  deltaX = -aabbBounds.width();
12845
12866
  }
12846
- return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
12867
+ return height || ("middle" === this.verticalDirection ? deltaY -= aabbBounds.height() / 2 : "bottom" === this.verticalDirection && (deltaY -= aabbBounds.height())), aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
12847
12868
  }
12848
12869
  needUpdateTags(keys) {
12849
12870
  return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
@@ -14921,7 +14942,8 @@
14921
14942
  y1: y1,
14922
14943
  x: originX = rectAttribute.x,
14923
14944
  y: originY = rectAttribute.y,
14924
- fillStrokeOrder = rectAttribute.fillStrokeOrder
14945
+ fillStrokeOrder = rectAttribute.fillStrokeOrder,
14946
+ drawStrokeWhenZeroWH = rectAttribute.drawStrokeWhenZeroWH
14925
14947
  } = rect.attribute;
14926
14948
  let {
14927
14949
  width: width,
@@ -14929,7 +14951,7 @@
14929
14951
  } = rect.attribute;
14930
14952
  width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
14931
14953
  const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
14932
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
14954
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
14933
14955
  doFill = runFill(fill, background),
14934
14956
  doStroke = runStroke(stroke, lineWidth);
14935
14957
  if (!rect.valid || !visible) return;
@@ -15833,7 +15855,7 @@
15833
15855
  super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
15834
15856
  }
15835
15857
  drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
15836
- var _a;
15858
+ var _a, _b;
15837
15859
  const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect,
15838
15860
  {
15839
15861
  fill = rectAttribute.fill,
@@ -15846,16 +15868,17 @@
15846
15868
  fillOpacity = rectAttribute.fillOpacity,
15847
15869
  lineWidth = rectAttribute.lineWidth,
15848
15870
  strokeOpacity = rectAttribute.strokeOpacity,
15849
- visible = rectAttribute.visible
15871
+ visible = rectAttribute.visible,
15872
+ drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
15850
15873
  } = rect.attribute;
15851
15874
  let {
15852
15875
  width: width,
15853
15876
  height: height
15854
15877
  } = rect.attribute;
15855
15878
  width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
15856
- const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
15879
+ const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
15857
15880
  fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
15858
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
15881
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
15859
15882
  doFill = runFill(fill),
15860
15883
  doStroke = runStroke(stroke, lineWidth);
15861
15884
  if (!rect.valid || !visible) return;
@@ -17531,6 +17554,94 @@
17531
17554
  vchart.Factory.registerChart(Pie3dChart.type, Pie3dChart);
17532
17555
  };
17533
17556
 
17557
+ const CombinationCandlestickChart_TYPE = 'combinationCandlestick';
17558
+
17559
+ class CandlestickChartSpecTransformer extends vchart.CartesianChartSpecTransformer {
17560
+ _getDefaultSeriesSpec(spec) {
17561
+ const dataFields = [spec.openField, spec.highField, spec.lowField, spec.closeField];
17562
+ const seriesSpec = super._getDefaultSeriesSpec(spec, [
17563
+ 'candlestick',
17564
+ 'openField',
17565
+ 'highField',
17566
+ 'lowField',
17567
+ 'closeField',
17568
+ 'rising',
17569
+ 'falling',
17570
+ 'doji'
17571
+ ]);
17572
+ seriesSpec.yField = dataFields;
17573
+ return seriesSpec;
17574
+ }
17575
+ transformSpec(spec) {
17576
+ super.transformSpec(spec);
17577
+ if (!spec.axes) {
17578
+ spec.axes = [
17579
+ {
17580
+ orient: 'bottom'
17581
+ },
17582
+ {
17583
+ orient: 'left'
17584
+ }
17585
+ ];
17586
+ }
17587
+ vchart.setDefaultCrosshairForCartesianChart(spec);
17588
+ }
17589
+ }
17590
+
17591
+ const CANDLESTICK_MARK_TYPE = 'candlestick';
17592
+ class CandlestickMark extends vchart.GlyphMark {
17593
+ constructor() {
17594
+ super(...arguments);
17595
+ this.type = CandlestickMark.type;
17596
+ }
17597
+ setGlyphConfig(cfg) {
17598
+ super.setGlyphConfig(cfg);
17599
+ this._subMarks = {
17600
+ line: { type: 'line', defaultAttributes: { x: 0, y: 0 } },
17601
+ box: { type: 'rect' }
17602
+ };
17603
+ this._positionChannels = ['x', 'boxWidth', 'open', 'close', 'high', 'low'];
17604
+ this._channelEncoder = null;
17605
+ this._positionEncoder = (glyphAttrs, datum, g) => {
17606
+ const { x = g.attribute.x, boxWidth = g.attribute.boxWidth, open = g.attribute.open, close = g.attribute.close, low = g.attribute.low, high = g.attribute.high } = glyphAttrs;
17607
+ const attributes = {};
17608
+ attributes.line = {
17609
+ points: [
17610
+ {
17611
+ x: x,
17612
+ y: low
17613
+ },
17614
+ {
17615
+ x: x,
17616
+ y: high
17617
+ }
17618
+ ]
17619
+ };
17620
+ attributes.box = {
17621
+ x: x - boxWidth / 2,
17622
+ x1: x + boxWidth / 2,
17623
+ y: Math.min(open, close),
17624
+ y1: Math.max(open, close),
17625
+ drawStrokeWhenZeroWH: true
17626
+ };
17627
+ return attributes;
17628
+ };
17629
+ }
17630
+ _getDefaultStyle() {
17631
+ const defaultStyle = Object.assign({}, super._getDefaultStyle());
17632
+ return defaultStyle;
17633
+ }
17634
+ }
17635
+ CandlestickMark.type = CANDLESTICK_MARK_TYPE;
17636
+ const registerCandlestickMark = () => {
17637
+ vchart.registerGlyphMark();
17638
+ registerLine();
17639
+ registerRect();
17640
+ vchart.Factory.registerGraphicComponent('line', (attrs) => createLine(attrs));
17641
+ vchart.Factory.registerGraphicComponent('rect', (attrs) => createRect(attrs));
17642
+ vchart.Factory.registerMark(CandlestickMark.type, CandlestickMark);
17643
+ };
17644
+
17534
17645
  class Easing {
17535
17646
  constructor() {}
17536
17647
  static linear(t) {
@@ -17848,6 +17959,7 @@
17848
17959
  return this.getEndProps();
17849
17960
  }
17850
17961
  stop() {}
17962
+ release() {}
17851
17963
  }
17852
17964
  class WaitStep extends Step {
17853
17965
  constructor(type, props, duration, easing) {
@@ -17855,8 +17967,6 @@
17855
17967
  }
17856
17968
  onStart() {
17857
17969
  super.onStart();
17858
- }
17859
- onFirstRun() {
17860
17970
  const fromProps = this.getFromProps();
17861
17971
  this.target.setAttributes(fromProps);
17862
17972
  }
@@ -18065,7 +18175,9 @@
18065
18175
  this.status !== AnimateStatus.END && this.onEnd(), this.status = AnimateStatus.END, this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
18066
18176
  }
18067
18177
  release() {
18068
- this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
18178
+ this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [], this.forEachStep(step => {
18179
+ step.release();
18180
+ });
18069
18181
  }
18070
18182
  getDuration() {
18071
18183
  return this._duration;
@@ -18139,6 +18251,10 @@
18139
18251
  getLoop() {
18140
18252
  return this._loopCount;
18141
18253
  }
18254
+ forEachStep(cb) {
18255
+ let step = this._firstStep;
18256
+ for (; step;) cb(step), step = step.next;
18257
+ }
18142
18258
  }
18143
18259
 
18144
18260
  const performanceRAF = new PerformanceRAF();
@@ -18371,6 +18487,9 @@
18371
18487
  constructor(target) {
18372
18488
  this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
18373
18489
  }
18490
+ get started() {
18491
+ return this._started;
18492
+ }
18374
18493
  onStart(cb) {
18375
18494
  cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
18376
18495
  cb();
@@ -18511,14 +18630,14 @@
18511
18630
  return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
18512
18631
  }
18513
18632
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
18514
- var _a, _b, _c, _d;
18633
+ var _a, _b, _c, _d, _e, _f;
18515
18634
  if (custom && customType) {
18516
18635
  const customParams = Object.assign({
18517
- width: graphic.stage.width,
18518
- height: graphic.stage.height,
18636
+ width: (null === (_a = graphic.stage) || void 0 === _a ? void 0 : _a.width) || 0,
18637
+ height: (null === (_b = graphic.stage) || void 0 === _b ? void 0 : _b.height) || 0,
18519
18638
  group: this._target.parent
18520
18639
  }, this.resolveValue(customParameters, graphic)),
18521
- objOptions = isFunction$1(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParams) : options;
18640
+ objOptions = isFunction$1(options) ? options.call(null, null !== (_d = customParams && (null === (_c = customParams.data) || void 0 === _c ? void 0 : _c[0])) && void 0 !== _d ? _d : null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, customParams) : options;
18522
18641
  customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
18523
18642
  } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
18524
18643
  }
@@ -18738,7 +18857,7 @@
18738
18857
  reApplyState(state) {
18739
18858
  var _a;
18740
18859
  const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
18741
- if (stateInfo) {
18860
+ if (stateInfo && stateInfo.executor.started) {
18742
18861
  const stateList = this.stateList.slice();
18743
18862
  stateInfo.executor.stop(), this.stateList = stateList, stateInfo.executor.execute(stateInfo.animationConfig);
18744
18863
  }
@@ -18916,911 +19035,1710 @@
18916
19035
  }
18917
19036
  }
18918
19037
 
18919
- const WordCloud3dAnimation = (params) => {
18920
- return {
18921
- custom: RotateBySphereAnimate,
18922
- customParameters: () => params,
18923
- easing: 'linear',
18924
- loop: Infinity,
18925
- duration: 6000
19038
+ const scaleIn = () => {
19039
+ return (graphic) => {
19040
+ const finalAttribute = graphic.getFinalAttribute();
19041
+ const { x, y, open, high, low, close } = finalAttribute;
19042
+ const animateAttributes = { from: { x, y }, to: { x, y } };
19043
+ if (isValidNumber$1(open) && isValidNumber$1(close)) {
19044
+ if (open > close) {
19045
+ animateAttributes.from.open = low;
19046
+ animateAttributes.to.open = open;
19047
+ animateAttributes.from.close = low;
19048
+ animateAttributes.to.close = close;
19049
+ if (isValidNumber$1(high)) {
19050
+ animateAttributes.from.high = low;
19051
+ animateAttributes.to.high = high;
19052
+ }
19053
+ }
19054
+ else {
19055
+ animateAttributes.from.open = high;
19056
+ animateAttributes.to.open = open;
19057
+ animateAttributes.from.close = high;
19058
+ animateAttributes.to.close = close;
19059
+ if (isValidNumber$1(low)) {
19060
+ animateAttributes.from.low = high;
19061
+ animateAttributes.to.low = low;
19062
+ }
19063
+ }
19064
+ }
19065
+ return animateAttributes;
18926
19066
  };
18927
19067
  };
18928
- const registerWordCloud3dAnimation = () => {
18929
- vchart.Factory.registerAnimation('wordCloud3d', (params) => ({
18930
- appear: WordCloud3dAnimation(params)
18931
- }));
18932
- };
18933
-
18934
- const wordCloud3d = {
18935
- word: {
18936
- padding: 1,
18937
- style: {
18938
- textAlign: 'center',
18939
- textBaseline: 'alphabetic'
19068
+ const scaleOut = () => {
19069
+ return (graphic) => {
19070
+ const finalAttribute = graphic.getFinalAttribute();
19071
+ const { x, y, open, high, low, close } = finalAttribute;
19072
+ const animateAttributes = { from: { x, y }, to: { x, y } };
19073
+ if (isValidNumber$1(open) && isValidNumber$1(close)) {
19074
+ if (open > close) {
19075
+ animateAttributes.from.open = open;
19076
+ animateAttributes.to.open = low;
19077
+ animateAttributes.from.close = close;
19078
+ animateAttributes.to.close = low;
19079
+ if (isValidNumber$1(high)) {
19080
+ animateAttributes.from.high = high;
19081
+ animateAttributes.to.high = low;
19082
+ }
19083
+ }
19084
+ else {
19085
+ animateAttributes.from.open = open;
19086
+ animateAttributes.to.open = high;
19087
+ animateAttributes.from.close = close;
19088
+ animateAttributes.to.close = high;
19089
+ if (isValidNumber$1(low)) {
19090
+ animateAttributes.from.low = low;
19091
+ animateAttributes.to.low = high;
19092
+ }
19093
+ }
18940
19094
  }
18941
- }
19095
+ return animateAttributes;
19096
+ };
18942
19097
  };
18943
-
18944
- class WordCloud3dSeries extends vchart.BaseWordCloudSeries {
18945
- constructor() {
18946
- super(...arguments);
18947
- this.type = SeriesType3dEnum.wordCloud3d;
19098
+ class CandlestickScaleIn extends ACustomAnimate {
19099
+ constructor(from, to, duration, easing, params) {
19100
+ super(from, to, duration, easing, params);
18948
19101
  }
18949
- _wordCloudTransformOption() {
18950
- var _a;
18951
- return Object.assign(Object.assign({}, super._wordCloudTransformOption()), { postProjection: (_a = this._spec.postProjection) !== null && _a !== void 0 ? _a : 'StereographicProjection', depth_3d: this._spec.depth_3d });
19102
+ onBind() {
19103
+ super.onBind();
19104
+ const finalAttribute = this.target.getFinalAttribute();
19105
+ if (finalAttribute) {
19106
+ this.target.setAttributes(finalAttribute);
19107
+ }
19108
+ const { from, to } = this.computeAttribute();
19109
+ this.propKeys = Object.keys(to).filter(key => to[key] != null);
19110
+ this.animate.reSyncProps();
19111
+ this.from = from;
19112
+ this.to = to;
19113
+ this.target.setAttributes(this.from);
18952
19114
  }
18953
- _wordCloudShapeTransformOption() {
18954
- var _a;
18955
- return Object.assign(Object.assign({}, super._wordCloudShapeTransformOption()), { postProjection: (_a = this._spec.postProjection) !== null && _a !== void 0 ? _a : 'StereographicProjection', depth_3d: this._spec.depth_3d });
19115
+ computeAttribute() {
19116
+ const attr = scaleIn()(this.target, this.params, this.params.options);
19117
+ return attr;
18956
19118
  }
18957
- initMark() {
18958
- this._wordMark = this._createMark(vchart.BaseWordCloudSeries.mark.word, {
18959
- groupKey: this._seriesField,
18960
- isSeriesMark: true
18961
- }, {
18962
- support3d: true
19119
+ onUpdate(end, ratio, out) {
19120
+ const attribute = this.target.attribute;
19121
+ this.propKeys.forEach(key => {
19122
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
18963
19123
  });
19124
+ this.target.setAttributes(attribute);
18964
19125
  }
18965
- initMarkStyle() {
18966
- super.initMarkStyle();
18967
- const wordMark = this._wordMark;
18968
- if (wordMark) {
18969
- this.setMarkStyle(wordMark, {
18970
- z: (datum) => { var _a; return (_a = datum.z) !== null && _a !== void 0 ? _a : 0; }
18971
- }, 'normal', vchart.AttributeLevel.Series);
19126
+ }
19127
+ class CandlestickScaleOut extends ACustomAnimate {
19128
+ constructor(from, to, duration, easing, params) {
19129
+ super(from, to, duration, easing, params);
19130
+ }
19131
+ onBind() {
19132
+ var _a;
19133
+ if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
19134
+ this.target.setAttributes(this.params.diffAttrs);
18972
19135
  }
19136
+ const { from, to } = this.computeAttribute();
19137
+ this.propKeys = Object.keys(to).filter(key => to[key] != null);
19138
+ this.animate.reSyncProps();
19139
+ this.from = from;
19140
+ this.to = to;
19141
+ this.target.setAttributes(this.from);
18973
19142
  }
18974
- initAnimation() {
18975
- var _a, _b;
18976
- const padding = (_a = this._padding) !== null && _a !== void 0 ? _a : {};
18977
- if (this._wordMark) {
18978
- this._wordMark.setAnimationConfig(vchart.animationConfig((_b = vchart.Factory.getAnimationInKey('wordCloud3d')) === null || _b === void 0 ? void 0 : _b(() => {
18979
- var _a;
18980
- const stage = this.getCompiler().getStage();
18981
- const width = stage.width - padding.left || 0 - padding.right || 0;
18982
- const height = stage.height - padding.top || 0 - padding.bottom || 0;
18983
- const r = Math.max(width, height) / 2;
18984
- return {
18985
- center: { x: r, y: r, z: (_a = this._spec.depth_3d) !== null && _a !== void 0 ? _a : r },
18986
- r
18987
- };
18988
- }), vchart.userAnimationConfig("word", this._spec, this._markAttributeContext)));
18989
- }
19143
+ computeAttribute() {
19144
+ const attr = scaleOut()(this.target, this.params, this.params.options);
19145
+ return attr;
19146
+ }
19147
+ onUpdate(end, ratio, out) {
19148
+ const attribute = this.target.attribute;
19149
+ this.propKeys.forEach(key => {
19150
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
19151
+ });
19152
+ this.target.setAttributes(attribute);
18990
19153
  }
18991
19154
  }
18992
- WordCloud3dSeries.type = SeriesType3dEnum.wordCloud3d;
18993
- WordCloud3dSeries.builtInTheme = { wordCloud3d };
18994
- const registerWordCloud3dSeries = () => {
18995
- vchart.registerTextMark();
18996
- registerWordCloud3dAnimation();
18997
- vchart.Factory.registerSeries(WordCloud3dSeries.type, WordCloud3dSeries);
18998
- };
18999
- const registerWordCloudShape3dSeries = () => {
19000
- registerWordCloud3dSeries();
19155
+ const registerCandlestickScaleAnimation = () => {
19156
+ AnimateExecutor.registerBuiltInAnimate('candlestickScaleIn', CandlestickScaleIn);
19157
+ AnimateExecutor.registerBuiltInAnimate('candlestickScaleOut', CandlestickScaleOut);
19001
19158
  };
19002
19159
 
19003
- class WordCloud3dChartSpecTransformer extends vchart.BaseWordCloudChartSpecTransformer {
19004
- _getDefaultSeriesSpec(spec) {
19005
- const series = super._getDefaultSeriesSpec(spec);
19006
- series.depth_3d = spec.depth_3d;
19007
- return series;
19008
- }
19009
- }
19160
+ const CANDLESTICK_CHART_TYPE = 'candlestick';
19161
+ const CANDLESTICK_SERIES_TYPE = 'candlestick';
19162
+ var CANDLESTICK_TOOLTIP_KEYS;
19163
+ (function (CANDLESTICK_TOOLTIP_KEYS) {
19164
+ CANDLESTICK_TOOLTIP_KEYS["OPEN"] = "open";
19165
+ CANDLESTICK_TOOLTIP_KEYS["HIGH"] = "high";
19166
+ CANDLESTICK_TOOLTIP_KEYS["LOW"] = "low";
19167
+ CANDLESTICK_TOOLTIP_KEYS["CLOSE"] = "close";
19168
+ CANDLESTICK_TOOLTIP_KEYS["SERIES_FIELD"] = "seriesField";
19169
+ })(CANDLESTICK_TOOLTIP_KEYS || (CANDLESTICK_TOOLTIP_KEYS = {}));
19170
+ var CandlestickMarkNameEnum;
19171
+ (function (CandlestickMarkNameEnum) {
19172
+ CandlestickMarkNameEnum["candlestick"] = "candlestick";
19173
+ })(CandlestickMarkNameEnum || (CandlestickMarkNameEnum = {}));
19174
+ const CandlestickSeriesMark = Object.assign(Object.assign({}, vchart.baseSeriesMark), { ["candlestick"]: { name: "candlestick", type: 'candlestick' } });
19010
19175
 
19011
- class WordCloud3dChart extends vchart.BaseWordCloudChart {
19176
+ class CandlestickSeriesTooltipHelper extends vchart.BaseSeriesTooltipHelper {
19012
19177
  constructor() {
19013
19178
  super(...arguments);
19014
- this.transformerConstructor = WordCloud3dChartSpecTransformer;
19015
- this.type = "wordCloud3d";
19016
- this.seriesType = SeriesType3dEnum.wordCloud3d;
19179
+ this.getContentKey = (contentType) => (datum) => {
19180
+ switch (contentType) {
19181
+ case CANDLESTICK_TOOLTIP_KEYS.OPEN: {
19182
+ const openField = this.series.getOpenField();
19183
+ return openField;
19184
+ }
19185
+ case CANDLESTICK_TOOLTIP_KEYS.HIGH: {
19186
+ const highField = this.series.getHighField();
19187
+ return highField;
19188
+ }
19189
+ case CANDLESTICK_TOOLTIP_KEYS.LOW: {
19190
+ const lowField = this.series.getLowField();
19191
+ return lowField;
19192
+ }
19193
+ case CANDLESTICK_TOOLTIP_KEYS.CLOSE: {
19194
+ const closeField = this.series.getCloseField();
19195
+ return closeField;
19196
+ }
19197
+ case CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD: {
19198
+ const seriesField = this.series.getSeriesField();
19199
+ return seriesField;
19200
+ }
19201
+ }
19202
+ return null;
19203
+ };
19204
+ this.getContentValue = (contentType) => (datum) => {
19205
+ switch (contentType) {
19206
+ case CANDLESTICK_TOOLTIP_KEYS.OPEN: {
19207
+ const openField = this.series.getOpenField();
19208
+ return datum[openField];
19209
+ }
19210
+ case CANDLESTICK_TOOLTIP_KEYS.HIGH: {
19211
+ const highField = this.series.getHighField();
19212
+ return datum[highField];
19213
+ }
19214
+ case CANDLESTICK_TOOLTIP_KEYS.LOW: {
19215
+ const lowField = this.series.getLowField();
19216
+ return datum[lowField];
19217
+ }
19218
+ case CANDLESTICK_TOOLTIP_KEYS.CLOSE: {
19219
+ const closeField = this.series.getCloseField();
19220
+ return datum[closeField];
19221
+ }
19222
+ case CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD: {
19223
+ const seriesField = this.series.getSeriesField();
19224
+ return datum[seriesField];
19225
+ }
19226
+ }
19227
+ return null;
19228
+ };
19229
+ this.shapeColorCallback = (datum) => {
19230
+ return this.series.getMarkInName('candlestick').getAttribute('stroke', datum);
19231
+ };
19017
19232
  }
19018
- }
19019
- WordCloud3dChart.type = "wordCloud3d";
19020
- WordCloud3dChart.seriesType = SeriesType3dEnum.wordCloud3d;
19021
- WordCloud3dChart.transformerConstructor = WordCloud3dChartSpecTransformer;
19022
- const registerWordCloud3dChart = () => {
19023
- register3DPlugin();
19024
- registerWordCloud3dSeries();
19025
- vchart.Factory.registerChart(WordCloud3dChart.type, WordCloud3dChart);
19026
- };
19027
- const registerWordCloudShape3dChart = () => {
19028
- register3DPlugin();
19029
- registerWordCloudShape3dSeries();
19030
- registerWordCloud3dChart();
19031
- };
19032
-
19033
- const axisZ = {
19034
- label: {
19035
- space: 0
19233
+ getDefaultContentList(activeType) {
19234
+ return [
19235
+ {
19236
+ key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.OPEN),
19237
+ value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.OPEN)
19238
+ },
19239
+ {
19240
+ key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.HIGH),
19241
+ value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.HIGH)
19242
+ },
19243
+ {
19244
+ key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.LOW),
19245
+ value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.LOW)
19246
+ },
19247
+ {
19248
+ key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.CLOSE),
19249
+ value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.CLOSE)
19250
+ },
19251
+ {
19252
+ key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD),
19253
+ value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD)
19254
+ }
19255
+ ];
19036
19256
  }
19037
- };
19257
+ }
19038
19258
 
19039
- const getUpdateAttributeOfZAxis = (axis, ignoreGrid) => {
19040
- var _a;
19041
- const regionSize = vchart.getCombinedSizeOfRegions(axis.getRegions());
19042
- const { width } = axis.getLayoutRect();
19043
- const axisLength = width;
19044
- const depth = axis.layout3dBox ? axis.layout3dBox.length : 0;
19045
- const depthZ = axis.layout3dBox ? axis.layout3dBox.width : 0;
19046
- const end = { x: depth, y: 0 };
19047
- const items = axis.getLabelItems(axisLength);
19048
- const attrs = {
19049
- start: { x: 0, y: 0 },
19050
- end,
19051
- title: {
19052
- text: axis._spec.title.text || axis._dataFieldText,
19053
- maxWidth: axis._getTitleLimit(false)
19259
+ const getCandlestickTheme = () => {
19260
+ const res = {
19261
+ rising: {
19262
+ style: {
19263
+ boxFill: '#FF0000',
19264
+ stroke: '#FF0000'
19265
+ }
19054
19266
  },
19055
- items,
19056
- scale: axis._scale.clone()
19267
+ falling: {
19268
+ style: {
19269
+ boxFill: '#00AA00',
19270
+ stroke: '#00AA00'
19271
+ }
19272
+ },
19273
+ doji: {
19274
+ style: {
19275
+ boxFill: '#000000',
19276
+ stroke: '#000000'
19277
+ }
19278
+ },
19279
+ candlestick: {
19280
+ style: {
19281
+ lineWidth: 1
19282
+ }
19283
+ }
19057
19284
  };
19058
- const directionStr = (_a = axis.directionStr) !== null && _a !== void 0 ? _a : 'r2l';
19059
- let anchor3d = [0, 0];
19060
- let alpha = -Math.PI / 2;
19061
- let z = 0;
19062
- if (directionStr === 'l2r') {
19063
- z = axis.layout3dBox.length;
19064
- anchor3d = [0, 0, 0];
19065
- alpha = Math.PI / 2;
19066
- }
19067
- attrs.z = z;
19068
- attrs.alpha = alpha;
19069
- attrs.anchor3d = anchor3d;
19070
- if (!ignoreGrid) {
19071
- attrs.grid = {
19072
- type: 'line',
19073
- start: { x: 0, y: 0 },
19074
- end,
19075
- items: items[0],
19076
- verticalFactor: axis._axisStyle.verticalFactor,
19077
- depth: depthZ,
19078
- length: !ignoreGrid ? regionSize.height : 0,
19079
- alpha,
19080
- z,
19081
- anchor3d
19082
- };
19083
- }
19084
- return attrs;
19285
+ return res;
19085
19286
  };
19287
+ const candlestick = getCandlestickTheme();
19086
19288
 
19087
- class Axis3dMixin {
19088
- setLayout3dBox(box3d) {
19089
- this.layout3dBox = box3d;
19289
+ const DEFAULT_STROKE_COLOR = '#000';
19290
+ class CandlestickSeries extends vchart.CartesianSeries {
19291
+ constructor() {
19292
+ super(...arguments);
19293
+ this.type = CANDLESTICK_SERIES_TYPE;
19294
+ this._mergedStyles = {
19295
+ rising: {},
19296
+ falling: {},
19297
+ doji: {}
19298
+ };
19090
19299
  }
19091
- _afterUpdateAttribute(attrs, ignoreGrid) {
19092
- const isZ = vchart.isZAxis(this._orient);
19093
- const isX = vchart.isXAxis(this._orient);
19094
- const isY = vchart.isYAxis(this._orient);
19095
- let regionHeight = 0;
19096
- let regionWidth = 0;
19097
- if (!ignoreGrid) {
19098
- const regions = this.getRegions();
19099
- let { x: minX, y: minY } = regions[0].getLayoutStartPoint();
19100
- let maxX = minX + regions[0].getLayoutRect().width;
19101
- let maxY = minY + regions[0].getLayoutRect().height;
19102
- for (let index = 1; index < regions.length; index++) {
19103
- const region = regions[index];
19104
- const { x, y } = region.getLayoutStartPoint();
19105
- const { width, height } = region.getLayoutRect();
19106
- minX = Math.min(minX, x);
19107
- maxX = Math.max(maxX, width + x);
19108
- minY = Math.min(minY, y);
19109
- maxY = Math.max(maxY, height + y);
19110
- }
19111
- regionHeight = Math.abs(maxY - minY);
19112
- regionWidth = Math.abs(maxX - minX);
19300
+ getOpenField() {
19301
+ return this._openField;
19302
+ }
19303
+ getHighField() {
19304
+ return this._highField;
19305
+ }
19306
+ getLowField() {
19307
+ return this._lowField;
19308
+ }
19309
+ getCloseField() {
19310
+ return this._closeField;
19311
+ }
19312
+ getBoxFill() {
19313
+ return this._boxFill;
19314
+ }
19315
+ getStrokeColor() {
19316
+ return this._strokeColor;
19317
+ }
19318
+ setAttrFromSpec() {
19319
+ var _a, _b, _c, _d, _e, _f, _g, _h;
19320
+ super.setAttrFromSpec();
19321
+ const spec = this._spec;
19322
+ const CandlestickStyle = (_b = (_a = spec.candlestick) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
19323
+ this._openField = spec.openField;
19324
+ this._highField = spec.highField;
19325
+ this._lowField = spec.lowField;
19326
+ this._closeField = spec.closeField;
19327
+ this._boxWidth = CandlestickStyle.boxWidth;
19328
+ this._boxFill = CandlestickStyle.boxFill;
19329
+ this._strokeColor = CandlestickStyle.strokeColor;
19330
+ this._buildMergedStyles(CandlestickStyle, (_d = (_c = spec.rising) === null || _c === void 0 ? void 0 : _c.style) !== null && _d !== void 0 ? _d : {}, (_f = (_e = spec.falling) === null || _e === void 0 ? void 0 : _e.style) !== null && _f !== void 0 ? _f : {}, (_h = (_g = spec.doji) === null || _g === void 0 ? void 0 : _g.style) !== null && _h !== void 0 ? _h : {});
19331
+ }
19332
+ initMark() {
19333
+ this._candlestickMark = this._createMark(CandlestickSeries.mark.candlestick, {
19334
+ groupKey: this._seriesField,
19335
+ isSeriesMark: true
19336
+ });
19337
+ }
19338
+ initMarkStyle() {
19339
+ var _a;
19340
+ const candlestickMark = this._candlestickMark;
19341
+ if (candlestickMark) {
19342
+ const CandlestickStyles = {
19343
+ fill: (datum) => {
19344
+ const boxFill = this.mergeStyle(datum).boxFill;
19345
+ return boxFill;
19346
+ },
19347
+ stroke: (datum) => {
19348
+ const strokeColor = this.mergeStyle(datum).stroke;
19349
+ return strokeColor;
19350
+ },
19351
+ lineWidth: (datum) => {
19352
+ const lineWidth = this.mergeStyle(datum).lineWidth;
19353
+ return lineWidth;
19354
+ },
19355
+ boxWidth: (_a = this._boxWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth.bind(this),
19356
+ x: this.dataToPositionX.bind(this)
19357
+ };
19358
+ candlestickMark.setGlyphConfig({});
19359
+ this.setMarkStyle(candlestickMark, CandlestickStyles, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
19113
19360
  }
19114
- let gridLength = 0;
19115
- let axisLength = 0;
19116
- const { width, height } = this.getLayoutRect();
19117
- let end = { x: 0, y: 0 };
19118
- if (isX) {
19119
- end = { x: width, y: 0 };
19120
- gridLength = regionHeight;
19121
- axisLength = width;
19361
+ }
19362
+ initCandlestickMarkStyle() {
19363
+ var _a;
19364
+ const candlestickMark = this._candlestickMark;
19365
+ const axisHelper = this._yAxisHelper;
19366
+ if (candlestickMark && axisHelper) {
19367
+ const { dataToPosition } = axisHelper;
19368
+ const scale = (_a = axisHelper === null || axisHelper === void 0 ? void 0 : axisHelper.getScale) === null || _a === void 0 ? void 0 : _a.call(axisHelper, 0);
19369
+ this.setMarkStyle(candlestickMark, {
19370
+ open: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._openField), {
19371
+ bandPosition: this._bandPosition
19372
+ }), scale),
19373
+ high: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._highField), {
19374
+ bandPosition: this._bandPosition
19375
+ }), scale),
19376
+ low: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._lowField), {
19377
+ bandPosition: this._bandPosition
19378
+ }), scale),
19379
+ close: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._closeField), {
19380
+ bandPosition: this._bandPosition
19381
+ }), scale)
19382
+ }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
19122
19383
  }
19123
- else if (isY) {
19124
- end = { x: 0, y: height };
19125
- gridLength = regionWidth;
19126
- axisLength = height;
19384
+ }
19385
+ init(option) {
19386
+ super.init(option);
19387
+ this.initCandlestickMarkStyle();
19388
+ }
19389
+ _initAnimationSpec(config = {}) {
19390
+ const newConfig = merge({}, config);
19391
+ ['appear', 'enter', 'update', 'exit', 'disappear'].forEach(state => {
19392
+ if (newConfig[state] && newConfig[state].type === 'scaleIn') {
19393
+ newConfig[state].type = 'candlestickScaleIn';
19394
+ }
19395
+ else if (newConfig[state] && newConfig[state].type === 'scaleOut') {
19396
+ newConfig[state].type = 'candlestickScaleOut';
19397
+ }
19398
+ });
19399
+ return newConfig;
19400
+ }
19401
+ initAnimation() {
19402
+ var _a;
19403
+ const animationParams = vchart.getGroupAnimationParams(this);
19404
+ if (this._candlestickMark) {
19405
+ const newDefaultConfig = this._initAnimationSpec((_a = vchart.Factory.getAnimationInKey('scaleInOut')) === null || _a === void 0 ? void 0 : _a());
19406
+ const newConfig = this._initAnimationSpec(vchart.userAnimationConfig(CANDLESTICK_SERIES_TYPE, this._spec, this._markAttributeContext));
19407
+ this._candlestickMark.setAnimationConfig(vchart.animationConfig(newDefaultConfig, newConfig, animationParams));
19127
19408
  }
19128
- const depth = this.layout3dBox ? this.layout3dBox.length : 0;
19129
- if (!isZ) {
19130
- const items = this.getLabelItems(axisLength);
19131
- attrs.grid = {
19132
- length: gridLength
19133
- };
19134
- attrs.start = { x: 0, y: 0 };
19135
- attrs.text = this._spec.title.text || this._dataFieldText;
19136
- attrs.maxWidth = this._getTitleLimit(isX);
19137
- attrs.items = items;
19138
- attrs.grid = {
19139
- type: 'line',
19140
- start: { x: 0, y: 0 },
19141
- end,
19142
- items: items[0],
19143
- depth,
19144
- length: gridLength
19145
- };
19146
- return attrs;
19409
+ }
19410
+ initTooltip() {
19411
+ this._tooltipHelper = new CandlestickSeriesTooltipHelper(this);
19412
+ this._candlestickMark && this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark);
19413
+ }
19414
+ _buildMergedStyles(baseStyle, risingStyle, fallingStyle, dojiStyle) {
19415
+ this._mergedStyles.rising = merge({}, baseStyle, risingStyle);
19416
+ this._mergedStyles.falling = merge({}, baseStyle, fallingStyle);
19417
+ this._mergedStyles.doji = merge({}, baseStyle, dojiStyle);
19418
+ }
19419
+ mergeStyle(datum) {
19420
+ const open = this.getDatumPositionValues(datum, this._openField)[0];
19421
+ const close = this.getDatumPositionValues(datum, this._closeField)[0];
19422
+ if (open < close) {
19423
+ return this._mergedStyles.rising;
19147
19424
  }
19148
- return getUpdateAttributeOfZAxis(this, ignoreGrid);
19425
+ else if (open > close) {
19426
+ return this._mergedStyles.falling;
19427
+ }
19428
+ else {
19429
+ return this._mergedStyles.doji;
19430
+ }
19431
+ }
19432
+ _getMarkWidth() {
19433
+ if (this._autoBoxWidth) {
19434
+ return this._autoBoxWidth;
19435
+ }
19436
+ const bandAxisHelper = this._xAxisHelper;
19437
+ const xField = this._fieldX;
19438
+ const innerBandWidth = bandAxisHelper.getBandwidth(xField.length - 1);
19439
+ const autoBoxWidth = innerBandWidth / xField.length;
19440
+ this._autoBoxWidth = autoBoxWidth;
19441
+ return this._autoBoxWidth;
19442
+ }
19443
+ onLayoutEnd() {
19444
+ super.onLayoutEnd();
19445
+ this._autoBoxWidth = null;
19446
+ }
19447
+ getActiveMarks() {
19448
+ return [this._candlestickMark];
19149
19449
  }
19150
19450
  }
19151
-
19152
- const registerCartesianBandAxis3d = () => {
19451
+ CandlestickSeries.type = CANDLESTICK_SERIES_TYPE;
19452
+ CandlestickSeries.builtInTheme = { candlestick };
19453
+ CandlestickSeries.mark = CandlestickSeriesMark;
19454
+ const registerCandlestickSeries = () => {
19455
+ registerCandlestickMark();
19456
+ vchart.registerSymbolMark();
19457
+ vchart.registerScaleInOutAnimation();
19153
19458
  vchart.registerCartesianBandAxis();
19154
- const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianBandAxis.type);
19155
- AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianBandAxis.builtInTheme.axisX), axisZ) });
19156
- mixin(AxisCls, Axis3dMixin);
19157
- };
19158
-
19159
- const registerCartesianLinearAxis3d = () => {
19160
19459
  vchart.registerCartesianLinearAxis();
19161
- const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianLinearAxis.type);
19162
- AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianLinearAxis.builtInTheme.axisX), axisZ) });
19163
- mixin(AxisCls, Axis3dMixin);
19164
- };
19165
-
19166
- const registerCartesianLogAxis3d = () => {
19167
- vchart.registerCartesianLogAxis();
19168
- const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianLogAxis.type);
19169
- AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianLogAxis.builtInTheme.axisX), axisZ) });
19170
- mixin(AxisCls, Axis3dMixin);
19171
- };
19172
-
19173
- const registerCartesianSymlogAxis3d = () => {
19174
- vchart.registerCartesianLogAxis();
19175
- const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianSymlogAxis.type);
19176
- AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ) });
19177
- mixin(AxisCls, Axis3dMixin);
19178
- };
19179
-
19180
- const registerCartesianTimeAxis3d = () => {
19181
- vchart.registerCartesianTimeAxis();
19182
- const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianTimeAxis.type);
19183
- AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ) });
19184
- mixin(AxisCls, Axis3dMixin);
19460
+ registerCandlestickScaleAnimation();
19461
+ vchart.Factory.registerSeries(CandlestickSeries.type, CandlestickSeries);
19185
19462
  };
19186
19463
 
19187
- const registerAxis3dPlugin = () => {
19188
- register3DPlugin();
19189
- registerLayout3d();
19190
- registerCartesianBandAxis3d();
19191
- registerCartesianLinearAxis3d();
19192
- registerCartesianTimeAxis3d();
19193
- registerCartesianSymlogAxis3d();
19194
- registerCartesianLogAxis3d();
19464
+ class CandlestickChart extends vchart.BaseChart {
19465
+ _setModelOption() {
19466
+ this._modelOption.getDimensionInfo = vchart.getCartesianDimensionInfo;
19467
+ this._modelOption.getDimensionInfoByValue = vchart.getDimensionInfoByValue;
19468
+ this._modelOption.getRectByDimensionData = vchart.getCartesianCrosshairRect;
19469
+ }
19470
+ }
19471
+ CandlestickChart.type = CANDLESTICK_CHART_TYPE;
19472
+ CandlestickChart.seriesType = CANDLESTICK_SERIES_TYPE;
19473
+ CandlestickChart.transformerConstructor = CandlestickChartSpecTransformer;
19474
+ const registerCandlestickChart = () => {
19475
+ vchart.registerDimensionTooltipProcessor();
19476
+ vchart.registerMarkTooltipProcessor();
19477
+ vchart.registerDimensionEvents();
19478
+ vchart.registerDimensionHover();
19479
+ registerCandlestickSeries();
19480
+ vchart.Factory.registerChart(CandlestickChart.type, CandlestickChart);
19195
19481
  };
19196
19482
 
19197
- const rangeColumn3dSeriesMark = Object.assign(Object.assign({}, bar3dSeriesMark), { ["minLabel"]: { name: "minLabel", type: "text" }, ["maxLabel"]: { name: "maxLabel", type: "text" } });
19483
+ function transformCandlestickSeriesSpec(spec) {
19484
+ spec.yField = [spec.openField, spec.highField, spec.lowField, spec.closeField];
19485
+ }
19198
19486
 
19199
- const DefaultBandWidth = 6;
19200
- class RangeColumn3dSeries extends vchart.RangeColumnSeries {
19201
- constructor() {
19202
- super(...arguments);
19203
- this.type = SeriesType3dEnum.rangeColumn3d;
19204
- this._barMarkType = "rect3d";
19205
- this._barName = SeriesType3dEnum.bar3d;
19487
+ class CombinationCandlestickChartSpecTransformer extends vchart.CartesianChartSpecTransformer {
19488
+ needAxes() {
19489
+ return true;
19206
19490
  }
19207
- }
19208
- RangeColumn3dSeries.type = SeriesType3dEnum.rangeColumn3d;
19209
- RangeColumn3dSeries.mark = rangeColumn3dSeriesMark;
19210
- const registerRangeColumn3dSeries = () => {
19211
- registerRect3dMark();
19212
- vchart.registerCartesianBandAxis();
19213
- vchart.registerCartesianLinearAxis();
19214
- vchart.Factory.registerSeries(RangeColumn3dSeries.type, RangeColumn3dSeries);
19215
- };
19216
-
19217
- class RangeColumn3dSeriesSpecTransformer extends vchart.RangeColumnSeriesSpecTransformer {
19218
- _transformLabelSpec(spec) {
19219
- var _a;
19220
- const labelPosition = (_a = spec.label) === null || _a === void 0 ? void 0 : _a.position;
19221
- if (labelPosition !== "bothEnd") {
19222
- this._addMarkLabelSpec(spec, "bar3d");
19491
+ transformSpec(spec) {
19492
+ this.transformRegion(spec);
19493
+ if (spec.tooltip === undefined) {
19494
+ spec.tooltip = {};
19223
19495
  }
19496
+ this.transformSeriesSpec(spec);
19497
+ this._transformAxisSpec(spec);
19498
+ this._transformLayout(spec);
19224
19499
  }
19225
- }
19226
-
19227
- class RangeColumn3dChartSpecTransformer extends vchart.CartesianChartSpecTransformer {
19228
- _getDefaultSeriesSpec(spec) {
19500
+ transformRegion(spec) {
19229
19501
  var _a, _b;
19230
- const series = super._getDefaultSeriesSpec(spec, ['bar3d', 'barGapInGroup']);
19231
- if (spec.direction === "horizontal") {
19232
- series.xField = (_a = spec.xField) !== null && _a !== void 0 ? _a : [spec.minField, spec.maxField];
19502
+ const commonSpec = spec;
19503
+ commonSpec.region = [(_a = spec.candlestickRegion) !== null && _a !== void 0 ? _a : {}];
19504
+ if (spec.previewSeries) {
19505
+ commonSpec.region.push((_b = spec.previewRegion) !== null && _b !== void 0 ? _b : {});
19506
+ }
19507
+ }
19508
+ transformSeriesSpec(spec) {
19509
+ var _a;
19510
+ spec.series = (_a = spec.series) !== null && _a !== void 0 ? _a : [];
19511
+ spec.series.forEach(s => {
19512
+ this._transformSeriesData(spec, s);
19513
+ s.regionIndex = 0;
19514
+ });
19515
+ const tempCandlestickSeries = spec.series.find(s => s.id === spec.candlestickSeries.id);
19516
+ let candlestickSpec;
19517
+ if (tempCandlestickSeries) {
19518
+ merge(tempCandlestickSeries, spec.candlestickSeries);
19519
+ candlestickSpec = tempCandlestickSeries;
19233
19520
  }
19234
19521
  else {
19235
- series.yField = (_b = spec.yField) !== null && _b !== void 0 ? _b : [spec.minField, spec.maxField];
19522
+ spec.series.push(spec.candlestickSeries);
19523
+ candlestickSpec = spec.candlestickSeries;
19236
19524
  }
19237
- return series;
19525
+ transformCandlestickSeriesSpec(candlestickSpec);
19526
+ this._transformSeriesData(spec, candlestickSpec);
19527
+ candlestickSpec.regionIndex = 0;
19528
+ if (spec.previewSeries) {
19529
+ const tempPreviewSeries = spec.series.find(s => s.id === spec.previewSeries.id);
19530
+ let previewSeriesSpec;
19531
+ if (tempPreviewSeries) {
19532
+ merge(tempPreviewSeries, spec.previewSeries);
19533
+ previewSeriesSpec = tempPreviewSeries;
19534
+ }
19535
+ else {
19536
+ spec.series.push(spec.previewSeries);
19537
+ previewSeriesSpec = spec.previewSeries;
19538
+ }
19539
+ previewSeriesSpec.regionIndex = 1;
19540
+ this._transformSeriesData(spec, previewSeriesSpec);
19541
+ }
19542
+ }
19543
+ _transformSeriesData(spec, seriesSpec) {
19544
+ var _a;
19545
+ if (seriesSpec.data) {
19546
+ spec.data = array((_a = spec.data) !== null && _a !== void 0 ? _a : []);
19547
+ array(seriesSpec.data).forEach((d, index) => {
19548
+ spec.data.push(d);
19549
+ if (index === 0) {
19550
+ seriesSpec.dataIndex = spec.data.length - 1;
19551
+ if ('id' in d) {
19552
+ seriesSpec.dataId = d.id;
19553
+ }
19554
+ else if ('name' in d) {
19555
+ seriesSpec.dataId = d.name;
19556
+ }
19557
+ }
19558
+ });
19559
+ delete seriesSpec.data;
19560
+ }
19561
+ }
19562
+ _transformAxisSpec(spec) {
19563
+ super._transformAxisSpec(spec);
19564
+ if (!spec.previewSeries) {
19565
+ return;
19566
+ }
19567
+ if (!spec.previewAxes) {
19568
+ spec.previewAxes = {
19569
+ type: 'linear',
19570
+ orient: 'left',
19571
+ visible: false
19572
+ };
19573
+ }
19574
+ spec.previewAxes.regionIndex = [1];
19575
+ spec.axes.push(spec.previewAxes);
19576
+ spec.axes.forEach(axis => {
19577
+ if (axis === spec.previewAxes) {
19578
+ return;
19579
+ }
19580
+ if (axis.orient === 'left' || axis.orient === 'right') {
19581
+ axis.regionIndex = [0];
19582
+ }
19583
+ });
19584
+ }
19585
+ _transformDataZoomSpec(spec) {
19586
+ if (spec.dataZoom) {
19587
+ array(spec.dataZoom).forEach(dataZoom => {
19588
+ if (dataZoom.orient === 'left' || dataZoom.orient === 'right') {
19589
+ dataZoom.regionIndex = [0];
19590
+ }
19591
+ });
19592
+ }
19593
+ }
19594
+ _transformLayout(spec) {
19595
+ var _a, _b;
19596
+ const layout = {
19597
+ type: 'grid',
19598
+ col: 2,
19599
+ row: 6,
19600
+ elements: [],
19601
+ colWidth: [],
19602
+ rowHeight: []
19603
+ };
19604
+ let totalRow = 0;
19605
+ let totalCol = 0;
19606
+ if (((_a = spec.title) === null || _a === void 0 ? void 0 : _a.visible) !== false) {
19607
+ totalRow++;
19608
+ }
19609
+ if (spec.legends) {
19610
+ const firstLegend = array(spec.legends)[0];
19611
+ if ((firstLegend === null || firstLegend === void 0 ? void 0 : firstLegend.visible) !== false) {
19612
+ if (firstLegend.orient === 'top' || firstLegend.orient === 'bottom') {
19613
+ totalRow++;
19614
+ }
19615
+ else {
19616
+ totalCol++;
19617
+ }
19618
+ }
19619
+ }
19620
+ if (spec.dataZoom) {
19621
+ array(spec.dataZoom).forEach(dataZoom => {
19622
+ if ((dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.visible) !== false) {
19623
+ if (dataZoom.orient === 'top' || dataZoom.orient === 'bottom') {
19624
+ totalRow++;
19625
+ }
19626
+ else {
19627
+ totalCol++;
19628
+ }
19629
+ }
19630
+ });
19631
+ }
19632
+ if (spec.axes) {
19633
+ const hasLayout = {
19634
+ top: false,
19635
+ bottom: false,
19636
+ left: false,
19637
+ right: false,
19638
+ z: false
19639
+ };
19640
+ array(spec.axes).forEach(axis => {
19641
+ if (hasLayout[axis.orient]) {
19642
+ return;
19643
+ }
19644
+ hasLayout[axis.orient] = true;
19645
+ if (axis.orient === 'top' || axis.orient === 'bottom') {
19646
+ totalRow++;
19647
+ }
19648
+ else {
19649
+ totalCol++;
19650
+ }
19651
+ });
19652
+ }
19653
+ totalRow++;
19654
+ totalCol++;
19655
+ if (spec.previewSeries) {
19656
+ totalRow++;
19657
+ }
19658
+ layout.row = totalRow;
19659
+ layout.col = totalCol;
19660
+ const temp = {
19661
+ top: 0,
19662
+ bottom: 0,
19663
+ left: 0,
19664
+ right: 0
19665
+ };
19666
+ if (((_b = spec.title) === null || _b === void 0 ? void 0 : _b.visible) !== false) {
19667
+ this._layoutOrientItem(layout, spec.title, temp, { specKey: 'title', index: 0 }, 'total');
19668
+ }
19669
+ if (spec.legends) {
19670
+ const firstLegend = array(spec.legends)[0];
19671
+ if ((firstLegend === null || firstLegend === void 0 ? void 0 : firstLegend.visible) !== false) {
19672
+ this._layoutOrientItem(layout, firstLegend, temp, { specKey: 'legends', index: 0 }, 'less');
19673
+ }
19674
+ }
19675
+ if (spec.dataZoom) {
19676
+ array(spec.dataZoom).forEach((dataZoom, index) => {
19677
+ if ((dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.visible) === false) {
19678
+ return;
19679
+ }
19680
+ this._layoutOrientItem(layout, dataZoom, temp, { specKey: 'dataZoom', index }, 'one');
19681
+ });
19682
+ }
19683
+ if (spec.axes) {
19684
+ const hasLayout = {
19685
+ left: false,
19686
+ right: false
19687
+ };
19688
+ spec.axes.forEach((axis, index) => {
19689
+ if (axis.orient !== 'left' && axis.orient !== 'right') {
19690
+ return;
19691
+ }
19692
+ if (hasLayout[axis.orient]) {
19693
+ return;
19694
+ }
19695
+ hasLayout[axis.orient] = true;
19696
+ this._layoutOrientItem(layout, axis, temp, { specKey: 'axes', index }, 'one');
19697
+ });
19698
+ }
19699
+ const regionLayout = this._layoutOrientItem(layout, { orient: 'top' }, temp, { specKey: 'region', index: 0 }, 'one');
19700
+ if (spec.previewSeries) {
19701
+ const regionLayout = this._layoutOrientItem(layout, { orient: 'bottom' }, temp, { specKey: 'region', index: 1 }, 'one');
19702
+ const previewAxesIndex = spec.axes.findIndex(axis => axis === spec.previewAxes);
19703
+ if (previewAxesIndex !== -1) {
19704
+ const previewAxesLayout = {
19705
+ col: regionLayout.col - 1,
19706
+ row: regionLayout.row,
19707
+ modelKey: 'axes',
19708
+ modelIndex: previewAxesIndex
19709
+ };
19710
+ layout.elements.push(previewAxesLayout);
19711
+ }
19712
+ if (spec.previewHeight) {
19713
+ if (typeof spec.previewHeight === 'string') {
19714
+ if (vchart.isPercent(spec.previewHeight)) {
19715
+ const heightStr = spec.previewHeight;
19716
+ layout.rowHeight.push({
19717
+ index: regionLayout.row,
19718
+ size: (size) => (Number(heightStr.substring(0, heightStr.length - 1)) * size) / 100
19719
+ });
19720
+ }
19721
+ }
19722
+ else {
19723
+ layout.rowHeight.push({
19724
+ index: regionLayout.row,
19725
+ size: spec.previewHeight
19726
+ });
19727
+ }
19728
+ }
19729
+ }
19730
+ const bottomAxesIndex = spec.axes.findIndex(axis => axis.orient === 'bottom');
19731
+ this._layoutOrientItem(layout, spec.axes[bottomAxesIndex], temp, { specKey: 'axes', index: bottomAxesIndex }, 'one');
19732
+ spec.axes.forEach((axis, index) => {
19733
+ if (axis === spec.previewAxes) {
19734
+ return;
19735
+ }
19736
+ const axisLayout = layout.elements.find(item => 'modelKey' in item && item.modelKey === 'axes' && item.modelIndex === index);
19737
+ if (axisLayout) {
19738
+ if (axis.orient === 'top' || axis.orient === 'bottom') {
19739
+ axisLayout.col = regionLayout.col;
19740
+ }
19741
+ else {
19742
+ axisLayout.row = regionLayout.row;
19743
+ }
19744
+ }
19745
+ });
19746
+ array(spec.dataZoom).forEach((dataZoom, index) => {
19747
+ const dataZoomLayout = layout.elements.find(item => 'modelKey' in item && item.modelKey === 'dataZoom' && item.modelIndex === index);
19748
+ if (dataZoomLayout) {
19749
+ if (dataZoom.orient === 'top' || dataZoom.orient === 'bottom') {
19750
+ dataZoomLayout.col = regionLayout.col;
19751
+ }
19752
+ else {
19753
+ dataZoomLayout.row = regionLayout.row;
19754
+ }
19755
+ }
19756
+ });
19757
+ spec.layout = layout;
19758
+ }
19759
+ _layoutOrientItem(layout, modelSpec, temp, modelInfo, spanType) {
19760
+ var _a;
19761
+ const modelLayout = {
19762
+ modelKey: modelInfo.specKey,
19763
+ modelIndex: modelInfo.index,
19764
+ col: 0,
19765
+ row: 0
19766
+ };
19767
+ const orient = (_a = modelSpec.orient) !== null && _a !== void 0 ? _a : 'top';
19768
+ const { span, index } = this._getLayoutElementCommon(layout, temp, spanType, orient);
19769
+ layout.elements.push(modelLayout);
19770
+ if (orient === 'top') {
19771
+ modelLayout.row = temp.top;
19772
+ modelLayout.rowSpan = 1;
19773
+ modelLayout.colSpan = span;
19774
+ modelLayout.col = index;
19775
+ temp.top++;
19776
+ }
19777
+ else if (orient === 'bottom') {
19778
+ modelLayout.row = layout.row - temp.bottom - 1;
19779
+ modelLayout.rowSpan = 1;
19780
+ modelLayout.colSpan = span;
19781
+ modelLayout.col = index;
19782
+ temp.bottom++;
19783
+ }
19784
+ else if (orient === 'left') {
19785
+ modelLayout.col = temp.left;
19786
+ modelLayout.colSpan = 1;
19787
+ modelLayout.rowSpan = span;
19788
+ modelLayout.row = index;
19789
+ temp.left++;
19790
+ }
19791
+ else if (orient === 'right') {
19792
+ modelLayout.col = layout.col - temp.right - 1;
19793
+ modelLayout.colSpan = 1;
19794
+ modelLayout.rowSpan = span;
19795
+ modelLayout.row = index;
19796
+ temp.right++;
19797
+ }
19798
+ return modelLayout;
19799
+ }
19800
+ _getLayoutElementCommon(layout, temp, span, orient) {
19801
+ if (orient === 'top' || orient === 'bottom') {
19802
+ return {
19803
+ span: span === 'total' ? layout.col : span === 'one' ? 1 : layout.col - temp.left - temp.right,
19804
+ index: span === 'total' ? 0 : temp.left
19805
+ };
19806
+ }
19807
+ return {
19808
+ span: span === 'total' ? layout.row : span === 'one' ? 1 : layout.row - temp.top - temp.bottom,
19809
+ index: span === 'total' ? 0 : temp.top
19810
+ };
19238
19811
  }
19239
19812
  }
19240
19813
 
19241
- class RangeColumn3dChart extends vchart.BaseChart {
19814
+ class CombinationCandlestickChart extends vchart.BaseChart {
19242
19815
  constructor() {
19243
19816
  super(...arguments);
19244
- this.transformerConstructor = RangeColumn3dChartSpecTransformer;
19245
- this.type = "rangeColumn3d";
19246
- this.seriesType = SeriesType3dEnum.rangeColumn3d;
19817
+ this.type = CombinationCandlestickChart_TYPE;
19818
+ this.transformerConstructor = CombinationCandlestickChartSpecTransformer;
19247
19819
  }
19248
19820
  _setModelOption() {
19249
- this._modelOption.getDimensionInfo = vchart.getCartesianDimensionInfo;
19821
+ this._modelOption.getDimensionInfo = (chart, point, isTooltip) => {
19822
+ var _a;
19823
+ return [...((_a = vchart.getCartesianDimensionInfo(chart, point, isTooltip)) !== null && _a !== void 0 ? _a : [])];
19824
+ };
19250
19825
  this._modelOption.getDimensionInfoByValue = vchart.getDimensionInfoByValue;
19251
19826
  this._modelOption.getRectByDimensionData = vchart.getCartesianCrosshairRect;
19252
19827
  }
19253
19828
  }
19254
- RangeColumn3dChart.type = "rangeColumn3d";
19255
- RangeColumn3dChart.seriesType = SeriesType3dEnum.rangeColumn3d;
19256
- RangeColumn3dChart.transformerConstructor = RangeColumn3dChartSpecTransformer;
19257
- const registerRangeColumn3dChart = () => {
19258
- vchart.registerDimensionTooltipProcessor();
19259
- vchart.registerMarkTooltipProcessor();
19260
- vchart.registerDimensionEvents();
19261
- vchart.registerDimensionHover();
19262
- register3DPlugin();
19263
- registerLayout3d();
19264
- registerRangeColumn3dSeries();
19265
- vchart.Factory.registerChart(RangeColumn3dChart.type, RangeColumn3dChart);
19829
+ CombinationCandlestickChart.type = CombinationCandlestickChart_TYPE;
19830
+ CombinationCandlestickChart.transformerConstructor = CombinationCandlestickChartSpecTransformer;
19831
+ mixin(CombinationCandlestickChart, vchart.StackChartMixin);
19832
+ const registerCombinationCandlestickChart = () => {
19833
+ registerCandlestickSeries();
19834
+ vchart.Factory.registerChart(CombinationCandlestickChart.type, CombinationCandlestickChart);
19266
19835
  };
19267
19836
 
19268
- const PICTOGRAM_CHART_TYPE = 'pictogram';
19269
- const PICTOGRAM_SERIES_TYPE = 'pictogram';
19270
- const ELEMENT_HIGHLIGHT_BY_GRPHIC_NAME = 'element-highlight-by-graphic-name';
19271
- const ELEMENT_SELECT_BY_GRPHIC_NAME = 'element-select-by-graphic-name';
19272
- var PictogramMarkNameEnum;
19273
- (function (PictogramMarkNameEnum) {
19274
- PictogramMarkNameEnum["pictogram"] = "pictogram";
19275
- })(PictogramMarkNameEnum || (PictogramMarkNameEnum = {}));
19276
- const PictogramSeriesMark = Object.assign(Object.assign({}, vchart.baseSeriesMark), { ["pictogram"]: { name: "pictogram", type: "group" } });
19837
+ const WordCloud3dAnimation = (params) => {
19838
+ return {
19839
+ custom: RotateBySphereAnimate,
19840
+ customParameters: () => params,
19841
+ easing: 'linear',
19842
+ loop: Infinity,
19843
+ duration: 6000
19844
+ };
19845
+ };
19846
+ const registerWordCloud3dAnimation = () => {
19847
+ vchart.Factory.registerAnimation('wordCloud3d', (params) => ({
19848
+ appear: WordCloud3dAnimation(params)
19849
+ }));
19850
+ };
19277
19851
 
19278
- class PictogramChartSpecTransformer extends vchart.BaseChartSpecTransformer {
19279
- _isValidSeries(type) {
19280
- return type === PICTOGRAM_SERIES_TYPE;
19852
+ const wordCloud3d = {
19853
+ word: {
19854
+ padding: 1,
19855
+ style: {
19856
+ textAlign: 'center',
19857
+ textBaseline: 'alphabetic'
19858
+ }
19281
19859
  }
19282
- _getDefaultSeriesSpec(spec) {
19283
- return super._getDefaultSeriesSpec(spec, [
19284
- 'type',
19285
- 'nameField',
19286
- 'valueField',
19287
- 'svg',
19288
- 'pictogram',
19289
- 'defaultFillColor'
19290
- ]);
19860
+ };
19861
+
19862
+ class WordCloud3dSeries extends vchart.BaseWordCloudSeries {
19863
+ constructor() {
19864
+ super(...arguments);
19865
+ this.type = SeriesType3dEnum.wordCloud3d;
19291
19866
  }
19292
- transformSpec(spec) {
19293
- super.transformSpec(spec);
19294
- spec.region.forEach((r) => {
19295
- r.coordinate = 'geo';
19296
- });
19297
- super.transformSeriesSpec(spec);
19867
+ _wordCloudTransformOption() {
19868
+ var _a;
19869
+ return Object.assign(Object.assign({}, super._wordCloudTransformOption()), { postProjection: (_a = this._spec.postProjection) !== null && _a !== void 0 ? _a : 'StereographicProjection', depth_3d: this._spec.depth_3d });
19298
19870
  }
19299
- }
19300
-
19301
- const svgSourceMap = new Map();
19302
- let svgDataSet;
19303
- function initSVGDataSet() {
19304
- if (svgDataSet) {
19305
- return;
19871
+ _wordCloudShapeTransformOption() {
19872
+ var _a;
19873
+ return Object.assign(Object.assign({}, super._wordCloudShapeTransformOption()), { postProjection: (_a = this._spec.postProjection) !== null && _a !== void 0 ? _a : 'StereographicProjection', depth_3d: this._spec.depth_3d });
19306
19874
  }
19307
- svgDataSet = new DataSet();
19308
- vchart.registerDataSetInstanceParser(svgDataSet, 'svg', svgParser);
19309
- }
19310
- function registerSVGSource(key, source) {
19311
- if (svgSourceMap.has(key)) {
19312
- vchart.warn(`svg source key of '${key}' already exists, will be overwritten.`);
19875
+ initMark() {
19876
+ this._wordMark = this._createMark(vchart.BaseWordCloudSeries.mark.word, {
19877
+ groupKey: this._seriesField,
19878
+ isSeriesMark: true
19879
+ }, {
19880
+ support3d: true
19881
+ });
19313
19882
  }
19314
- initSVGDataSet();
19315
- const dataView = new DataView(svgDataSet);
19316
- dataView.parse(source, {
19317
- type: 'svg'
19318
- });
19319
- svgSourceMap.set(key, dataView);
19320
- }
19321
- function unregisterSVGSource(key) {
19322
- if (!svgSourceMap.has(key)) {
19323
- vchart.warn(`map type of '${key}' does not exists.`);
19324
- return;
19883
+ initMarkStyle() {
19884
+ super.initMarkStyle();
19885
+ const wordMark = this._wordMark;
19886
+ if (wordMark) {
19887
+ this.setMarkStyle(wordMark, {
19888
+ z: (datum) => { var _a; return (_a = datum.z) !== null && _a !== void 0 ? _a : 0; }
19889
+ }, 'normal', vchart.AttributeLevel.Series);
19890
+ }
19325
19891
  }
19326
- svgSourceMap.delete(key);
19327
- }
19328
- function getSVGSource(type) {
19329
- return svgSourceMap.get(type);
19330
- }
19331
- function clearSVGSource() {
19332
- svgSourceMap.clear();
19333
- svgDataSet = null;
19334
- }
19335
-
19336
- class PictogramSeriesSpecTransformer extends vchart.BaseSeriesSpecTransformer {
19337
- _getDefaultSpecFromChart(chartSpec) {
19338
- var _a, _b, _c;
19339
- const spec = (_a = super._getDefaultSpecFromChart(chartSpec)) !== null && _a !== void 0 ? _a : {};
19340
- const svg = chartSpec.svg;
19341
- const elements = (_c = (_b = svgSourceMap.get(svg)) === null || _b === void 0 ? void 0 : _b.latestData) === null || _c === void 0 ? void 0 : _c.elements;
19342
- if (elements && elements.length) {
19343
- const names = elements.map(e => e.name).filter(n => isValid$1(n));
19344
- names.forEach(name => {
19345
- if (chartSpec[name]) {
19346
- spec[name] = chartSpec[name];
19347
- }
19348
- });
19892
+ initAnimation() {
19893
+ var _a, _b;
19894
+ const padding = (_a = this._padding) !== null && _a !== void 0 ? _a : {};
19895
+ if (this._wordMark) {
19896
+ this._wordMark.setAnimationConfig(vchart.animationConfig((_b = vchart.Factory.getAnimationInKey('wordCloud3d')) === null || _b === void 0 ? void 0 : _b(() => {
19897
+ var _a;
19898
+ const stage = this.getCompiler().getStage();
19899
+ const width = stage.width - padding.left || 0 - padding.right || 0;
19900
+ const height = stage.height - padding.top || 0 - padding.bottom || 0;
19901
+ const r = Math.max(width, height) / 2;
19902
+ return {
19903
+ center: { x: r, y: r, z: (_a = this._spec.depth_3d) !== null && _a !== void 0 ? _a : r },
19904
+ r
19905
+ };
19906
+ }), vchart.userAnimationConfig("word", this._spec, this._markAttributeContext)));
19349
19907
  }
19350
- return spec;
19351
19908
  }
19352
19909
  }
19910
+ WordCloud3dSeries.type = SeriesType3dEnum.wordCloud3d;
19911
+ WordCloud3dSeries.builtInTheme = { wordCloud3d };
19912
+ const registerWordCloud3dSeries = () => {
19913
+ vchart.registerTextMark();
19914
+ registerWordCloud3dAnimation();
19915
+ vchart.Factory.registerSeries(WordCloud3dSeries.type, WordCloud3dSeries);
19916
+ };
19917
+ const registerWordCloudShape3dSeries = () => {
19918
+ registerWordCloud3dSeries();
19919
+ };
19353
19920
 
19354
- class PictogramSeriesTooltipHelper extends vchart.BaseSeriesTooltipHelper {
19355
- constructor() {
19356
- super(...arguments);
19357
- this.dimensionTooltipTitleCallback = (datum) => {
19358
- var _a;
19359
- const series = this.series;
19360
- return (_a = this._getDimensionData(datum)) !== null && _a !== void 0 ? _a : series.getDatumName(datum);
19361
- };
19362
- this.markTooltipValueCallback = (datum, params) => {
19363
- const { measureFields } = this._seriesCacheInfo;
19364
- if (measureFields[0] && datum.data) {
19365
- return datum.data[measureFields[0]];
19366
- }
19367
- };
19368
- this.markTooltipKeyCallback = (datum) => {
19369
- var _a;
19370
- return (_a = datum.data) === null || _a === void 0 ? void 0 : _a[this.series.getDimensionField()[0]];
19371
- };
19921
+ class WordCloud3dChartSpecTransformer extends vchart.BaseWordCloudChartSpecTransformer {
19922
+ _getDefaultSeriesSpec(spec) {
19923
+ const series = super._getDefaultSeriesSpec(spec);
19924
+ series.depth_3d = spec.depth_3d;
19925
+ return series;
19372
19926
  }
19373
19927
  }
19374
19928
 
19375
- const type$1 = 'element-highlight-by-graphic-name';
19376
- class ElementHighlightByGraphicName extends vchart.ElementHighlight {
19929
+ class WordCloud3dChart extends vchart.BaseWordCloudChart {
19377
19930
  constructor() {
19378
19931
  super(...arguments);
19379
- this.type = type$1;
19380
- this.handleStart = (e) => {
19381
- if (e && e.item && this.isGraphicInMark(e.item)) {
19382
- const shouldStart = this.options.shouldStart ? this.options.shouldStart(e) : this._filterByName(e);
19383
- if (shouldStart) {
19384
- const itemKey = this._parseTargetKey(e);
19385
- this.start(itemKey);
19386
- }
19387
- }
19388
- };
19389
- this.handleReset = (e) => {
19390
- if (e && e.item && this.isGraphicInMark(e.item)) {
19391
- this.reset();
19392
- }
19393
- };
19394
- }
19395
- _filterByName(e) {
19396
- var _a;
19397
- const name = (_a = e === null || e === void 0 ? void 0 : e.node) === null || _a === void 0 ? void 0 : _a.name;
19398
- return !!name;
19399
- }
19400
- _parseTargetKey(e) {
19401
- return e.node.name;
19402
- }
19403
- start(itemKey) {
19404
- if (isNil$1(itemKey)) {
19405
- return;
19406
- }
19407
- const { interaction, highlightState, blurState } = this.options;
19408
- const statedGraphics = interaction.getStatedGraphics(this);
19409
- const newStatedGraphics = [];
19410
- this.getMarks().forEach(m => {
19411
- var _a;
19412
- (_a = m.getGraphics()) === null || _a === void 0 ? void 0 : _a.forEach(g => {
19413
- if (g.name === itemKey) {
19414
- newStatedGraphics.push(g);
19415
- }
19416
- });
19417
- });
19418
- interaction.updateStates(this, newStatedGraphics, statedGraphics, highlightState, blurState);
19419
- interaction.setStatedGraphics(this, newStatedGraphics);
19420
- }
19421
- reset() {
19422
- const { highlightState, blurState, interaction } = this.options;
19423
- interaction.clearAllStatesOfTrigger(this, highlightState, blurState);
19424
- interaction.setStatedGraphics(this, []);
19932
+ this.transformerConstructor = WordCloud3dChartSpecTransformer;
19933
+ this.type = "wordCloud3d";
19934
+ this.seriesType = SeriesType3dEnum.wordCloud3d;
19425
19935
  }
19426
19936
  }
19427
- ElementHighlightByGraphicName.type = type$1;
19428
- const registerElementHighlightByGraphicName = () => {
19429
- vchart.Factory.registerInteractionTrigger(ElementHighlightByGraphicName.type, ElementHighlightByGraphicName);
19937
+ WordCloud3dChart.type = "wordCloud3d";
19938
+ WordCloud3dChart.seriesType = SeriesType3dEnum.wordCloud3d;
19939
+ WordCloud3dChart.transformerConstructor = WordCloud3dChartSpecTransformer;
19940
+ const registerWordCloud3dChart = () => {
19941
+ register3DPlugin();
19942
+ registerWordCloud3dSeries();
19943
+ vchart.Factory.registerChart(WordCloud3dChart.type, WordCloud3dChart);
19944
+ };
19945
+ const registerWordCloudShape3dChart = () => {
19946
+ register3DPlugin();
19947
+ registerWordCloudShape3dSeries();
19948
+ registerWordCloud3dChart();
19430
19949
  };
19431
19950
 
19432
- const type = 'element-select-by-graphic-name';
19433
- class ElementSelectByGraphicName extends vchart.ElementSelect {
19434
- constructor() {
19435
- super(...arguments);
19436
- this.type = type;
19437
- }
19438
- start(markGraphic) {
19439
- const name = markGraphic === null || markGraphic === void 0 ? void 0 : markGraphic.name;
19440
- if (name) {
19441
- this.getMarks().forEach(mark => {
19442
- var _a;
19443
- (_a = mark.getGraphics()) === null || _a === void 0 ? void 0 : _a.forEach(g => {
19444
- if (g.name === name) {
19445
- super.start(g);
19446
- }
19447
- });
19448
- });
19449
- }
19951
+ const axisZ = {
19952
+ label: {
19953
+ space: 0
19450
19954
  }
19451
- }
19452
- ElementSelectByGraphicName.type = type;
19453
- const registerElementSelectByGraphicName = () => {
19454
- vchart.Factory.registerInteractionTrigger(ElementSelectByGraphicName.type, ElementSelectByGraphicName);
19455
19955
  };
19456
19956
 
19457
- function isValidStrokeOrFill(attr) {
19957
+ const getUpdateAttributeOfZAxis = (axis, ignoreGrid) => {
19458
19958
  var _a;
19459
- return isValid$1(attr) && attr !== 'none' && !((_a = attr.includes) === null || _a === void 0 ? void 0 : _a.call(attr, 'url'));
19460
- }
19461
- const getLineWidth = (attributes) => {
19462
- const strokeWidth = parseFloat(attributes.strokeWidth);
19463
- if (!isNaN(strokeWidth)) {
19464
- return strokeWidth;
19959
+ const regionSize = vchart.getCombinedSizeOfRegions(axis.getRegions());
19960
+ const { width } = axis.getLayoutRect();
19961
+ const axisLength = width;
19962
+ const depth = axis.layout3dBox ? axis.layout3dBox.length : 0;
19963
+ const depthZ = axis.layout3dBox ? axis.layout3dBox.width : 0;
19964
+ const end = { x: depth, y: 0 };
19965
+ const items = axis.getLabelItems(axisLength);
19966
+ const attrs = {
19967
+ start: { x: 0, y: 0 },
19968
+ end,
19969
+ title: {
19970
+ text: axis._spec.title.text || axis._dataFieldText,
19971
+ maxWidth: axis._getTitleLimit(false)
19972
+ },
19973
+ items,
19974
+ scale: axis._scale.clone()
19975
+ };
19976
+ const directionStr = (_a = axis.directionStr) !== null && _a !== void 0 ? _a : 'r2l';
19977
+ let anchor3d = [0, 0];
19978
+ let alpha = -Math.PI / 2;
19979
+ let z = 0;
19980
+ if (directionStr === 'l2r') {
19981
+ z = axis.layout3dBox.length;
19982
+ anchor3d = [0, 0, 0];
19983
+ alpha = Math.PI / 2;
19465
19984
  }
19466
- const stroke = attributes.stroke;
19467
- return stroke && isValidStrokeOrFill(stroke) ? 1 : 0;
19468
- };
19469
- const getFill = (attributes, defaultFill) => {
19470
- var _a;
19471
- const fill = (_a = attributes.fill) !== null && _a !== void 0 ? _a : defaultFill;
19472
- return fill && isValidStrokeOrFill(fill) ? fill : undefined;
19473
- };
19474
- const getStroke = (attributes, defaultStroke) => {
19475
- var _a;
19476
- const stroke = (_a = attributes.stroke) !== null && _a !== void 0 ? _a : defaultStroke;
19477
- return stroke && isValidStrokeOrFill(stroke) ? stroke : false;
19478
- };
19479
- const commonAttributes = (attributes) => {
19480
- return Object.assign(Object.assign({}, attributes), { x: parseFloat(attributes.x) || undefined, y: parseFloat(attributes.y) || undefined, fillStrokeOrder: false, fill: getFill(attributes), lineWidth: getLineWidth(attributes), stroke: getStroke(attributes) });
19985
+ attrs.z = z;
19986
+ attrs.alpha = alpha;
19987
+ attrs.anchor3d = anchor3d;
19988
+ if (!ignoreGrid) {
19989
+ attrs.grid = {
19990
+ type: 'line',
19991
+ start: { x: 0, y: 0 },
19992
+ end,
19993
+ items: items[0],
19994
+ verticalFactor: axis._axisStyle.verticalFactor,
19995
+ depth: depthZ,
19996
+ length: !ignoreGrid ? regionSize.height : 0,
19997
+ alpha,
19998
+ z,
19999
+ anchor3d
20000
+ };
20001
+ }
20002
+ return attrs;
19481
20003
  };
19482
- const graphicAttributeTransform = {
19483
- group: (attributes) => {
19484
- const common = commonAttributes(attributes);
19485
- return Object.assign(Object.assign({}, common), { visibleAll: common.visible !== false });
19486
- },
19487
- rule: (attributes) => {
19488
- return Object.assign(Object.assign({}, commonAttributes(attributes)), { x: parseFloat(attributes.x1), y: parseFloat(attributes.y1), x1: parseFloat(attributes.x2), y1: parseFloat(attributes.y2) });
19489
- },
19490
- rect: (attributes) => {
19491
- return Object.assign(Object.assign({}, commonAttributes(attributes)), { fill: getFill(attributes, '#000'), width: parseFloat(attributes.width), height: parseFloat(attributes.height) });
19492
- },
19493
- polygon: (attributes) => {
19494
- return Object.assign(Object.assign({}, commonAttributes(attributes)), { fill: getFill(attributes, '#000'), points: attributes.points
19495
- .trim()
19496
- .split(/\s+/)
19497
- .map((pair) => {
19498
- const [x, y] = pair.split(',').map(Number);
19499
- return { x, y };
19500
- }) });
19501
- },
19502
- line: (attributes) => {
19503
- return Object.assign(Object.assign({}, commonAttributes(attributes)), { points: attributes.points
19504
- .trim()
19505
- .split(/\s+/)
19506
- .map((pair) => {
19507
- const [x, y] = pair.split(',').map(Number);
19508
- return { x, y };
19509
- }) });
19510
- },
19511
- path: (attributes) => {
19512
- return Object.assign(Object.assign({}, commonAttributes(attributes)), { path: attributes.d, fillStrokeOrder: false, fill: getFill(attributes, '#000') });
19513
- },
19514
- arc: (attributes) => {
19515
- var _a;
19516
- return Object.assign(Object.assign({}, commonAttributes(attributes)), { outerRadius: (_a = attributes.r) !== null && _a !== void 0 ? _a : attributes.ry, x: parseFloat(attributes.cx), y: parseFloat(attributes.cy), startAngle: 0, endAngle: Math.PI * 2, scaleX: parseFloat(attributes.rx) / parseFloat(attributes.ry) || 1, fill: getFill(attributes, '#000') });
19517
- },
19518
- text: (attributes, value) => {
19519
- var _a, _b;
19520
- return Object.assign(Object.assign({}, commonAttributes(attributes)), { text: value, textAlign: (_a = attributes.textAlign) !== null && _a !== void 0 ? _a : 'left', textBaseLine: (_b = attributes.textAnchor) !== null && _b !== void 0 ? _b : 'middle', anchor: [0, 0], fill: getFill(attributes, '#000') });
19521
- }
19522
- };
19523
- const pictogram = (data) => {
19524
- var _a, _b;
19525
- if (!data || !data[0]) {
19526
- return {};
20004
+
20005
+ class Axis3dMixin {
20006
+ setLayout3dBox(box3d) {
20007
+ this.layout3dBox = box3d;
19527
20008
  }
19528
- const { elements } = data[0].latestData;
19529
- if (elements && elements.length) {
19530
- elements.forEach((el, index) => {
19531
- var _a;
19532
- el[vchart.DEFAULT_DATA_INDEX] = index;
19533
- el._uniqueId = `${el.id}-${index}`;
19534
- el.data = undefined;
19535
- const { graphicType: type, transform } = el;
19536
- const finalAttributes = {
19537
- visible: el.attributes.visibility !== 'hidden' && el.attributes.visibility !== 'collapse'
19538
- };
19539
- if (el.graphicType === 'text') {
19540
- merge(finalAttributes, el._inheritStyle, (_a = el.parent) === null || _a === void 0 ? void 0 : _a._textGroupStyle, el.attributes);
19541
- }
19542
- else if (el.graphicType !== 'group') {
19543
- merge(finalAttributes, el._inheritStyle, el.attributes);
19544
- }
19545
- if (graphicAttributeTransform[type]) {
19546
- el._finalAttributes = graphicAttributeTransform[type](finalAttributes, el.value);
19547
- }
19548
- else {
19549
- el._finalAttributes = finalAttributes;
19550
- }
19551
- if (transform) {
19552
- el._finalAttributes.postMatrix = Object.assign({}, transform);
19553
- }
19554
- });
19555
- const texts = elements.filter(el => el.tagName === 'text');
19556
- for (let i = 0; i < texts.length; i++) {
19557
- const textId = texts[i]._uniqueId;
19558
- const children = elements.filter(el => {
19559
- let result = false;
19560
- let parent = el.parent;
19561
- while (parent) {
19562
- if (parent._uniqueId === textId) {
19563
- result = true;
19564
- break;
19565
- }
19566
- parent = parent.parent;
19567
- }
19568
- return result;
19569
- });
19570
- if (children && children.length) {
19571
- const startX = (_b = (_a = texts[i]._textGroupStyle) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0;
19572
- let curX = startX;
19573
- for (let j = 0; j < children.length; j++) {
19574
- const currentChild = children[j];
19575
- if (currentChild.graphicType === 'group') {
19576
- curX = startX;
19577
- }
19578
- else if (currentChild.value) {
19579
- if (currentChild.parent._textGroupStyle.x === undefined) {
19580
- const lastText = children
19581
- .slice(0, j)
19582
- .reverse()
19583
- .find(c => c.graphicType === 'text' && c.value);
19584
- if (lastText) {
19585
- const width = vchart.measureText(lastText.value, lastText._finalAttributes).width;
19586
- curX += width;
19587
- }
19588
- currentChild._finalAttributes.x = curX;
19589
- }
19590
- }
19591
- }
20009
+ _afterUpdateAttribute(attrs, ignoreGrid) {
20010
+ const isZ = vchart.isZAxis(this._orient);
20011
+ const isX = vchart.isXAxis(this._orient);
20012
+ const isY = vchart.isYAxis(this._orient);
20013
+ let regionHeight = 0;
20014
+ let regionWidth = 0;
20015
+ if (!ignoreGrid) {
20016
+ const regions = this.getRegions();
20017
+ let { x: minX, y: minY } = regions[0].getLayoutStartPoint();
20018
+ let maxX = minX + regions[0].getLayoutRect().width;
20019
+ let maxY = minY + regions[0].getLayoutRect().height;
20020
+ for (let index = 1; index < regions.length; index++) {
20021
+ const region = regions[index];
20022
+ const { x, y } = region.getLayoutStartPoint();
20023
+ const { width, height } = region.getLayoutRect();
20024
+ minX = Math.min(minX, x);
20025
+ maxX = Math.max(maxX, width + x);
20026
+ minY = Math.min(minY, y);
20027
+ maxY = Math.max(maxY, height + y);
19592
20028
  }
20029
+ regionHeight = Math.abs(maxY - minY);
20030
+ regionWidth = Math.abs(maxX - minX);
20031
+ }
20032
+ let gridLength = 0;
20033
+ let axisLength = 0;
20034
+ const { width, height } = this.getLayoutRect();
20035
+ let end = { x: 0, y: 0 };
20036
+ if (isX) {
20037
+ end = { x: width, y: 0 };
20038
+ gridLength = regionHeight;
20039
+ axisLength = width;
20040
+ }
20041
+ else if (isY) {
20042
+ end = { x: 0, y: height };
20043
+ gridLength = regionWidth;
20044
+ axisLength = height;
20045
+ }
20046
+ const depth = this.layout3dBox ? this.layout3dBox.length : 0;
20047
+ if (!isZ) {
20048
+ const items = this.getLabelItems(axisLength);
20049
+ attrs.grid = {
20050
+ length: gridLength
20051
+ };
20052
+ attrs.start = { x: 0, y: 0 };
20053
+ attrs.text = this._spec.title.text || this._dataFieldText;
20054
+ attrs.maxWidth = this._getTitleLimit(isX);
20055
+ attrs.items = items;
20056
+ attrs.grid = {
20057
+ type: 'line',
20058
+ start: { x: 0, y: 0 },
20059
+ end,
20060
+ items: items[0],
20061
+ depth,
20062
+ length: gridLength
20063
+ };
20064
+ return attrs;
19593
20065
  }
20066
+ return getUpdateAttributeOfZAxis(this, ignoreGrid);
19594
20067
  }
19595
- return elements;
20068
+ }
20069
+
20070
+ const registerCartesianBandAxis3d = () => {
20071
+ vchart.registerCartesianBandAxis();
20072
+ const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianBandAxis.type);
20073
+ AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianBandAxis.builtInTheme.axisX), axisZ) });
20074
+ mixin(AxisCls, Axis3dMixin);
19596
20075
  };
19597
20076
 
19598
- class PictogramSeries extends vchart.GeoSeries {
20077
+ const registerCartesianLinearAxis3d = () => {
20078
+ vchart.registerCartesianLinearAxis();
20079
+ const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianLinearAxis.type);
20080
+ AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianLinearAxis.builtInTheme.axisX), axisZ) });
20081
+ mixin(AxisCls, Axis3dMixin);
20082
+ };
20083
+
20084
+ const registerCartesianLogAxis3d = () => {
20085
+ vchart.registerCartesianLogAxis();
20086
+ const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianLogAxis.type);
20087
+ AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianLogAxis.builtInTheme.axisX), axisZ) });
20088
+ mixin(AxisCls, Axis3dMixin);
20089
+ };
20090
+
20091
+ const registerCartesianSymlogAxis3d = () => {
20092
+ vchart.registerCartesianLogAxis();
20093
+ const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianSymlogAxis.type);
20094
+ AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ) });
20095
+ mixin(AxisCls, Axis3dMixin);
20096
+ };
20097
+
20098
+ const registerCartesianTimeAxis3d = () => {
20099
+ vchart.registerCartesianTimeAxis();
20100
+ const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianTimeAxis.type);
20101
+ AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ) });
20102
+ mixin(AxisCls, Axis3dMixin);
20103
+ };
20104
+
20105
+ const registerAxis3dPlugin = () => {
20106
+ register3DPlugin();
20107
+ registerLayout3d();
20108
+ registerCartesianBandAxis3d();
20109
+ registerCartesianLinearAxis3d();
20110
+ registerCartesianTimeAxis3d();
20111
+ registerCartesianSymlogAxis3d();
20112
+ registerCartesianLogAxis3d();
20113
+ };
20114
+
20115
+ const rangeColumn3dSeriesMark = Object.assign(Object.assign({}, bar3dSeriesMark), { ["minLabel"]: { name: "minLabel", type: "text" }, ["maxLabel"]: { name: "maxLabel", type: "text" } });
20116
+
20117
+ const DefaultBandWidth = 6;
20118
+ class RangeColumn3dSeries extends vchart.RangeColumnSeries {
19599
20119
  constructor() {
19600
20120
  super(...arguments);
19601
- this.type = PICTOGRAM_SERIES_TYPE;
19602
- this._idToMark = new Map();
20121
+ this.type = SeriesType3dEnum.rangeColumn3d;
20122
+ this._barMarkType = "rect3d";
20123
+ this._barName = SeriesType3dEnum.bar3d;
19603
20124
  }
19604
- setAttrFromSpec() {
19605
- var _a, _b, _c;
19606
- super.setAttrFromSpec();
19607
- this.svg = this._spec.svg;
19608
- this._nameField = this._spec.nameField;
19609
- this._valueField = this._spec.valueField;
19610
- if (!this.svg) {
19611
- (_a = this._option) === null || _a === void 0 ? void 0 : _a.onError(`svg source is not specified !`);
19612
- }
19613
- this._parsedSvgResult = (_b = getSVGSource(this.svg)) === null || _b === void 0 ? void 0 : _b.latestData;
19614
- if (!this._parsedSvgResult) {
19615
- (_c = this._option) === null || _c === void 0 ? void 0 : _c.onError(`'${this.svg}' is not registered !`);
20125
+ }
20126
+ RangeColumn3dSeries.type = SeriesType3dEnum.rangeColumn3d;
20127
+ RangeColumn3dSeries.mark = rangeColumn3dSeriesMark;
20128
+ const registerRangeColumn3dSeries = () => {
20129
+ registerRect3dMark();
20130
+ vchart.registerCartesianBandAxis();
20131
+ vchart.registerCartesianLinearAxis();
20132
+ vchart.Factory.registerSeries(RangeColumn3dSeries.type, RangeColumn3dSeries);
20133
+ };
20134
+
20135
+ class RangeColumn3dSeriesSpecTransformer extends vchart.RangeColumnSeriesSpecTransformer {
20136
+ _transformLabelSpec(spec) {
20137
+ var _a;
20138
+ const labelPosition = (_a = spec.label) === null || _a === void 0 ? void 0 : _a.position;
20139
+ if (labelPosition !== "bothEnd") {
20140
+ this._addMarkLabelSpec(spec, "bar3d");
19616
20141
  }
19617
20142
  }
19618
- getDatumCenter(datum) {
19619
- return [Number.NaN, Number.NaN];
20143
+ }
20144
+
20145
+ class RangeColumn3dChartSpecTransformer extends vchart.CartesianChartSpecTransformer {
20146
+ _getDefaultSeriesSpec(spec) {
20147
+ var _a, _b;
20148
+ const series = super._getDefaultSeriesSpec(spec, ['bar3d', 'barGapInGroup']);
20149
+ if (spec.direction === "horizontal") {
20150
+ series.xField = (_a = spec.xField) !== null && _a !== void 0 ? _a : [spec.minField, spec.maxField];
20151
+ }
20152
+ else {
20153
+ series.yField = (_b = spec.yField) !== null && _b !== void 0 ? _b : [spec.minField, spec.maxField];
20154
+ }
20155
+ return series;
19620
20156
  }
19621
- getDatumName(datum) {
19622
- return datum.name || datum._nameFromParent;
20157
+ }
20158
+
20159
+ class RangeColumn3dChart extends vchart.BaseChart {
20160
+ constructor() {
20161
+ super(...arguments);
20162
+ this.transformerConstructor = RangeColumn3dChartSpecTransformer;
20163
+ this.type = "rangeColumn3d";
20164
+ this.seriesType = SeriesType3dEnum.rangeColumn3d;
19623
20165
  }
19624
- getMarksWithoutRoot() {
19625
- return this.getMarks().filter(m => m.name && !m.name.includes('seriesGroup') && !m.name.includes('root') && m !== this._pictogramMark);
20166
+ _setModelOption() {
20167
+ this._modelOption.getDimensionInfo = vchart.getCartesianDimensionInfo;
20168
+ this._modelOption.getDimensionInfoByValue = vchart.getDimensionInfoByValue;
20169
+ this._modelOption.getRectByDimensionData = vchart.getCartesianCrosshairRect;
19626
20170
  }
19627
- _buildMarkAttributeContext() {
19628
- super._buildMarkAttributeContext();
19629
- this._markAttributeContext.getTransformMatrix = this.getRootMatrix.bind(this);
19630
- this._markAttributeContext.coordToPosition = this.coordToPosition.bind(this);
19631
- this._markAttributeContext.dataToPosition = this.dataToPosition.bind(this);
19632
- }
19633
- _defaultHoverConfig(finalHoverSpec) {
19634
- return {
19635
- type: ELEMENT_HIGHLIGHT_BY_GRPHIC_NAME,
19636
- trigger: finalHoverSpec.trigger,
19637
- triggerOff: 'pointerout',
19638
- blurState: vchart.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,
19639
- highlightState: vchart.STATE_VALUE_ENUM.STATE_HOVER
19640
- };
20171
+ }
20172
+ RangeColumn3dChart.type = "rangeColumn3d";
20173
+ RangeColumn3dChart.seriesType = SeriesType3dEnum.rangeColumn3d;
20174
+ RangeColumn3dChart.transformerConstructor = RangeColumn3dChartSpecTransformer;
20175
+ const registerRangeColumn3dChart = () => {
20176
+ vchart.registerDimensionTooltipProcessor();
20177
+ vchart.registerMarkTooltipProcessor();
20178
+ vchart.registerDimensionEvents();
20179
+ vchart.registerDimensionHover();
20180
+ register3DPlugin();
20181
+ registerLayout3d();
20182
+ registerRangeColumn3dSeries();
20183
+ vchart.Factory.registerChart(RangeColumn3dChart.type, RangeColumn3dChart);
20184
+ };
20185
+
20186
+ const PICTOGRAM_CHART_TYPE = 'pictogram';
20187
+ const PICTOGRAM_SERIES_TYPE = 'pictogram';
20188
+ const ELEMENT_HIGHLIGHT_BY_GRPHIC_NAME = 'element-highlight-by-graphic-name';
20189
+ const ELEMENT_SELECT_BY_GRPHIC_NAME = 'element-select-by-graphic-name';
20190
+ var PictogramMarkNameEnum;
20191
+ (function (PictogramMarkNameEnum) {
20192
+ PictogramMarkNameEnum["pictogram"] = "pictogram";
20193
+ })(PictogramMarkNameEnum || (PictogramMarkNameEnum = {}));
20194
+ const PictogramSeriesMark = Object.assign(Object.assign({}, vchart.baseSeriesMark), { ["pictogram"]: { name: "pictogram", type: "group" } });
20195
+
20196
+ class PictogramChartSpecTransformer extends vchart.BaseChartSpecTransformer {
20197
+ _isValidSeries(type) {
20198
+ return type === PICTOGRAM_SERIES_TYPE;
19641
20199
  }
19642
- _defaultSelectConfig(finalSelectSpec) {
19643
- const isMultiple = finalSelectSpec.mode === 'multiple';
19644
- const triggerOff = isValid$1(finalSelectSpec.triggerOff)
19645
- ? finalSelectSpec.triggerOff
19646
- : isMultiple
19647
- ? ['empty', 'self']
19648
- : ['empty', finalSelectSpec.trigger];
19649
- return {
19650
- type: ELEMENT_SELECT_BY_GRPHIC_NAME,
19651
- trigger: finalSelectSpec.trigger,
19652
- triggerOff: triggerOff,
19653
- reverseState: vchart.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,
19654
- state: vchart.STATE_VALUE_ENUM.STATE_SELECTED,
19655
- isMultiple
19656
- };
20200
+ _getDefaultSeriesSpec(spec) {
20201
+ return super._getDefaultSeriesSpec(spec, [
20202
+ 'type',
20203
+ 'nameField',
20204
+ 'valueField',
20205
+ 'svg',
20206
+ 'pictogram',
20207
+ 'defaultFillColor'
20208
+ ]);
19657
20209
  }
19658
- initMark() {
19659
- var _a;
19660
- this._pictogramMark = this._createMark(PictogramSeries.mark.pictogram, {
19661
- groupKey: this.getDimensionField()[0],
19662
- isSeriesMark: true,
19663
- skipBeforeLayouted: true
19664
- }, {
19665
- morph: vchart.shouldMarkDoMorph(this._spec, PictogramSeries.mark.pictogram.name)
20210
+ transformSpec(spec) {
20211
+ super.transformSpec(spec);
20212
+ spec.region.forEach((r) => {
20213
+ r.coordinate = 'geo';
19666
20214
  });
19667
- if (!this._pictogramMark) {
19668
- return;
19669
- }
19670
- this._pictogramMark.setData(this._mapViewData);
19671
- this._pictogramMark.setUserId(PictogramSeries.mark.pictogram.name);
19672
- for (const element of this._mapViewData.getDataView().latestData) {
19673
- const { graphicType: type, name, parent, id, _nameFromParent, _uniqueId } = element;
19674
- const mark = this._createMark({ type, name: name !== null && name !== void 0 ? name : _nameFromParent }, {
19675
- groupKey: _uniqueId,
19676
- isSeriesMark: false,
19677
- skipBeforeLayouted: true,
19678
- parent: (_a = this._idToMark.get(parent === null || parent === void 0 ? void 0 : parent._uniqueId)) !== null && _a !== void 0 ? _a : this._pictogramMark
19679
- }, {
19680
- morph: vchart.shouldMarkDoMorph(this._spec, PictogramSeries.mark.pictogram.name)
20215
+ super.transformSeriesSpec(spec);
20216
+ }
20217
+ }
20218
+
20219
+ const svgSourceMap = new Map();
20220
+ let svgDataSet;
20221
+ function initSVGDataSet() {
20222
+ if (svgDataSet) {
20223
+ return;
20224
+ }
20225
+ svgDataSet = new DataSet();
20226
+ vchart.registerDataSetInstanceParser(svgDataSet, 'svg', svgParser);
20227
+ }
20228
+ function registerSVGSource(key, source) {
20229
+ if (svgSourceMap.has(key)) {
20230
+ vchart.warn(`svg source key of '${key}' already exists, will be overwritten.`);
20231
+ }
20232
+ initSVGDataSet();
20233
+ const dataView = new DataView(svgDataSet);
20234
+ dataView.parse(source, {
20235
+ type: 'svg'
20236
+ });
20237
+ svgSourceMap.set(key, dataView);
20238
+ }
20239
+ function unregisterSVGSource(key) {
20240
+ if (!svgSourceMap.has(key)) {
20241
+ vchart.warn(`map type of '${key}' does not exists.`);
20242
+ return;
20243
+ }
20244
+ svgSourceMap.delete(key);
20245
+ }
20246
+ function getSVGSource(type) {
20247
+ return svgSourceMap.get(type);
20248
+ }
20249
+ function clearSVGSource() {
20250
+ svgSourceMap.clear();
20251
+ svgDataSet = null;
20252
+ }
20253
+
20254
+ class PictogramSeriesSpecTransformer extends vchart.BaseSeriesSpecTransformer {
20255
+ _getDefaultSpecFromChart(chartSpec) {
20256
+ var _a, _b, _c;
20257
+ const spec = (_a = super._getDefaultSpecFromChart(chartSpec)) !== null && _a !== void 0 ? _a : {};
20258
+ const svg = chartSpec.svg;
20259
+ const elements = (_c = (_b = svgSourceMap.get(svg)) === null || _b === void 0 ? void 0 : _b.latestData) === null || _c === void 0 ? void 0 : _c.elements;
20260
+ if (elements && elements.length) {
20261
+ const names = elements.map(e => e.name).filter(n => isValid$1(n));
20262
+ names.forEach(name => {
20263
+ if (chartSpec[name]) {
20264
+ spec[name] = chartSpec[name];
20265
+ }
19681
20266
  });
19682
- if (mark) {
19683
- mark.setData(this._mapViewData);
19684
- mark.setUserId(_uniqueId);
19685
- this._idToMark.set(_uniqueId, mark);
19686
- if (mark.type !== 'group') {
19687
- mark.setMarkConfig({ graphicName: mark.name });
20267
+ }
20268
+ return spec;
20269
+ }
20270
+ }
20271
+
20272
+ class PictogramSeriesTooltipHelper extends vchart.BaseSeriesTooltipHelper {
20273
+ constructor() {
20274
+ super(...arguments);
20275
+ this.dimensionTooltipTitleCallback = (datum) => {
20276
+ var _a;
20277
+ const series = this.series;
20278
+ return (_a = this._getDimensionData(datum)) !== null && _a !== void 0 ? _a : series.getDatumName(datum);
20279
+ };
20280
+ this.markTooltipValueCallback = (datum, params) => {
20281
+ const { measureFields } = this._seriesCacheInfo;
20282
+ if (measureFields[0] && datum.data) {
20283
+ return datum.data[measureFields[0]];
20284
+ }
20285
+ };
20286
+ this.markTooltipKeyCallback = (datum) => {
20287
+ var _a;
20288
+ return (_a = datum.data) === null || _a === void 0 ? void 0 : _a[this.series.getDimensionField()[0]];
20289
+ };
20290
+ }
20291
+ }
20292
+
20293
+ const type$1 = 'element-highlight-by-graphic-name';
20294
+ class ElementHighlightByGraphicName extends vchart.ElementHighlight {
20295
+ constructor() {
20296
+ super(...arguments);
20297
+ this.type = type$1;
20298
+ this.handleStart = (e) => {
20299
+ if (e && e.item && this.isGraphicInMark(e.item)) {
20300
+ const shouldStart = this.options.shouldStart ? this.options.shouldStart(e) : this._filterByName(e);
20301
+ if (shouldStart) {
20302
+ const itemKey = this._parseTargetKey(e);
20303
+ this.start(itemKey);
19688
20304
  }
19689
- mark.setTransform([
19690
- {
19691
- type: 'filter',
19692
- callback: (datum) => {
19693
- return datum._uniqueId === _uniqueId;
19694
- }
19695
- }
19696
- ]);
19697
20305
  }
19698
- }
19699
- this._initLabelMark();
20306
+ };
20307
+ this.handleReset = (e) => {
20308
+ if (e && e.item && this.isGraphicInMark(e.item)) {
20309
+ this.reset();
20310
+ }
20311
+ };
19700
20312
  }
19701
- _initLabelMark() {
19702
- if (this._spec.label.visible !== true) {
20313
+ _filterByName(e) {
20314
+ var _a;
20315
+ const name = (_a = e === null || e === void 0 ? void 0 : e.node) === null || _a === void 0 ? void 0 : _a.name;
20316
+ return !!name;
20317
+ }
20318
+ _parseTargetKey(e) {
20319
+ return e.node.name;
20320
+ }
20321
+ start(itemKey) {
20322
+ if (isNil$1(itemKey)) {
19703
20323
  return;
19704
20324
  }
19705
- const labelMark = this._createMark(PictogramSeries.mark.label, {
19706
- isSeriesMark: false,
19707
- parent: this._pictogramMark,
19708
- groupKey: '_uniqueId',
19709
- skipBeforeLayouted: true
20325
+ const { interaction, highlightState, blurState } = this.options;
20326
+ const statedGraphics = interaction.getStatedGraphics(this);
20327
+ const newStatedGraphics = [];
20328
+ this.getMarks().forEach(m => {
20329
+ var _a;
20330
+ (_a = m.getGraphics()) === null || _a === void 0 ? void 0 : _a.forEach(g => {
20331
+ if (g.name === itemKey) {
20332
+ newStatedGraphics.push(g);
20333
+ }
20334
+ });
19710
20335
  });
19711
- if (labelMark) {
19712
- this._labelMark = labelMark;
19713
- this._labelMark.setData(this._mapViewData);
19714
- }
20336
+ interaction.updateStates(this, newStatedGraphics, statedGraphics, highlightState, blurState);
20337
+ interaction.setStatedGraphics(this, newStatedGraphics);
19715
20338
  }
19716
- initLabelMarkStyle() {
19717
- if (!this._labelMark) {
19718
- return;
19719
- }
19720
- this.setMarkStyle(this._labelMark, {
19721
- visible: (d) => !!this._validElement(d),
19722
- x: (d) => { var _a; return (_a = this.dataToPosition(d, true)) === null || _a === void 0 ? void 0 : _a.x; },
19723
- y: (d) => { var _a; return (_a = this.dataToPosition(d, true)) === null || _a === void 0 ? void 0 : _a.y; },
19724
- text: (d) => d[this.nameField],
19725
- textAlign: 'center',
19726
- textBaseline: 'middle'
19727
- }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
20339
+ reset() {
20340
+ const { highlightState, blurState, interaction } = this.options;
20341
+ interaction.clearAllStatesOfTrigger(this, highlightState, blurState);
20342
+ interaction.setStatedGraphics(this, []);
19728
20343
  }
19729
- initMarkStyle() {
19730
- const { root, viewBoxRect } = this._parsedSvgResult;
19731
- const elements = this._mapViewData.getDataView().latestData;
19732
- if (root) {
19733
- this.setMarkStyle(this._pictogramMark, graphicAttributeTransform.group(root.attributes), 'normal', vchart.AttributeLevel.Built_In);
19734
- if (root.transform) {
19735
- this.setMarkStyle(this._pictogramMark, {
19736
- postMatrix: () => root.transform
19737
- }, 'normal', vchart.AttributeLevel.Built_In);
19738
- }
19739
- if (viewBoxRect) {
19740
- this._pictogramMark.setMarkConfig({
19741
- clip: true,
19742
- clipPath: [createRect(Object.assign(Object.assign({}, viewBoxRect), { fill: true }))]
20344
+ }
20345
+ ElementHighlightByGraphicName.type = type$1;
20346
+ const registerElementHighlightByGraphicName = () => {
20347
+ vchart.Factory.registerInteractionTrigger(ElementHighlightByGraphicName.type, ElementHighlightByGraphicName);
20348
+ };
20349
+
20350
+ const type = 'element-select-by-graphic-name';
20351
+ class ElementSelectByGraphicName extends vchart.ElementSelect {
20352
+ constructor() {
20353
+ super(...arguments);
20354
+ this.type = type;
20355
+ }
20356
+ start(markGraphic) {
20357
+ const name = markGraphic === null || markGraphic === void 0 ? void 0 : markGraphic.name;
20358
+ if (name) {
20359
+ this.getMarks().forEach(mark => {
20360
+ var _a;
20361
+ (_a = mark.getGraphics()) === null || _a === void 0 ? void 0 : _a.forEach(g => {
20362
+ if (g.name === name) {
20363
+ super.start(g);
20364
+ }
19743
20365
  });
19744
- }
19745
- }
19746
- for (const element of elements) {
19747
- const { _uniqueId, _finalAttributes: attributes } = element;
19748
- const mark = this._idToMark.get(_uniqueId);
19749
- const valid = this._validElement(element);
19750
- if (mark) {
19751
- this.setMarkStyle(mark, { keepStrokeScale: true }, 'normal', vchart.AttributeLevel.Built_In);
19752
- if (valid) {
19753
- this.initMarkStyleWithSpec(mark, merge({}, this._spec.pictogram, this._spec[mark.name]));
19754
- this.setMarkStyle(mark, attributes, 'normal', vchart.AttributeLevel.Series);
19755
- mark.setPostProcess('fill', (result, datum) => {
19756
- return isValid$1(result) ? result : this._spec.defaultFillColor;
19757
- });
19758
- }
19759
- else {
19760
- mark.setMarkConfig({ interactive: false });
19761
- this.setMarkStyle(mark, attributes, 'normal', vchart.AttributeLevel.Built_In);
19762
- }
19763
- }
20366
+ });
19764
20367
  }
19765
- this.initLabelMarkStyle();
19766
20368
  }
19767
- _validElement(element) {
19768
- return element.name || element._nameFromParent;
20369
+ }
20370
+ ElementSelectByGraphicName.type = type;
20371
+ const registerElementSelectByGraphicName = () => {
20372
+ vchart.Factory.registerInteractionTrigger(ElementSelectByGraphicName.type, ElementSelectByGraphicName);
20373
+ };
20374
+
20375
+ function isValidStrokeOrFill(attr) {
20376
+ var _a;
20377
+ return isValid$1(attr) && attr !== 'none' && !((_a = attr.includes) === null || _a === void 0 ? void 0 : _a.call(attr, 'url'));
20378
+ }
20379
+ const getLineWidth = (attributes) => {
20380
+ const strokeWidth = parseFloat(attributes.strokeWidth);
20381
+ if (!isNaN(strokeWidth)) {
20382
+ return strokeWidth;
19769
20383
  }
19770
- initTooltip() {
19771
- this._tooltipHelper = new PictogramSeriesTooltipHelper(this);
19772
- this.getMarksWithoutRoot().forEach(mark => {
19773
- if (mark && mark.name) {
19774
- this._tooltipHelper.activeTriggerSet.mark.add(mark);
20384
+ const stroke = attributes.stroke;
20385
+ return stroke && isValidStrokeOrFill(stroke) ? 1 : 0;
20386
+ };
20387
+ const getFill = (attributes, defaultFill) => {
20388
+ var _a;
20389
+ const fill = (_a = attributes.fill) !== null && _a !== void 0 ? _a : defaultFill;
20390
+ return fill && isValidStrokeOrFill(fill) ? fill : undefined;
20391
+ };
20392
+ const getStroke = (attributes, defaultStroke) => {
20393
+ var _a;
20394
+ const stroke = (_a = attributes.stroke) !== null && _a !== void 0 ? _a : defaultStroke;
20395
+ return stroke && isValidStrokeOrFill(stroke) ? stroke : false;
20396
+ };
20397
+ const commonAttributes = (attributes) => {
20398
+ return Object.assign(Object.assign({}, attributes), { x: parseFloat(attributes.x) || undefined, y: parseFloat(attributes.y) || undefined, fillStrokeOrder: false, fill: getFill(attributes), lineWidth: getLineWidth(attributes), stroke: getStroke(attributes) });
20399
+ };
20400
+ const graphicAttributeTransform = {
20401
+ group: (attributes) => {
20402
+ const common = commonAttributes(attributes);
20403
+ return Object.assign(Object.assign({}, common), { visibleAll: common.visible !== false });
20404
+ },
20405
+ rule: (attributes) => {
20406
+ return Object.assign(Object.assign({}, commonAttributes(attributes)), { x: parseFloat(attributes.x1), y: parseFloat(attributes.y1), x1: parseFloat(attributes.x2), y1: parseFloat(attributes.y2) });
20407
+ },
20408
+ rect: (attributes) => {
20409
+ return Object.assign(Object.assign({}, commonAttributes(attributes)), { fill: getFill(attributes, '#000'), width: parseFloat(attributes.width), height: parseFloat(attributes.height) });
20410
+ },
20411
+ polygon: (attributes) => {
20412
+ return Object.assign(Object.assign({}, commonAttributes(attributes)), { fill: getFill(attributes, '#000'), points: attributes.points
20413
+ .trim()
20414
+ .split(/\s+/)
20415
+ .map((pair) => {
20416
+ const [x, y] = pair.split(',').map(Number);
20417
+ return { x, y };
20418
+ }) });
20419
+ },
20420
+ line: (attributes) => {
20421
+ return Object.assign(Object.assign({}, commonAttributes(attributes)), { points: attributes.points
20422
+ .trim()
20423
+ .split(/\s+/)
20424
+ .map((pair) => {
20425
+ const [x, y] = pair.split(',').map(Number);
20426
+ return { x, y };
20427
+ }) });
20428
+ },
20429
+ path: (attributes) => {
20430
+ return Object.assign(Object.assign({}, commonAttributes(attributes)), { path: attributes.d, fillStrokeOrder: false, fill: getFill(attributes, '#000') });
20431
+ },
20432
+ arc: (attributes) => {
20433
+ var _a;
20434
+ return Object.assign(Object.assign({}, commonAttributes(attributes)), { outerRadius: (_a = attributes.r) !== null && _a !== void 0 ? _a : attributes.ry, x: parseFloat(attributes.cx), y: parseFloat(attributes.cy), startAngle: 0, endAngle: Math.PI * 2, scaleX: parseFloat(attributes.rx) / parseFloat(attributes.ry) || 1, fill: getFill(attributes, '#000') });
20435
+ },
20436
+ text: (attributes, value) => {
20437
+ var _a, _b;
20438
+ return Object.assign(Object.assign({}, commonAttributes(attributes)), { text: value, textAlign: (_a = attributes.textAlign) !== null && _a !== void 0 ? _a : 'left', textBaseLine: (_b = attributes.textAnchor) !== null && _b !== void 0 ? _b : 'middle', anchor: [0, 0], fill: getFill(attributes, '#000') });
20439
+ }
20440
+ };
20441
+ const pictogram = (data) => {
20442
+ var _a, _b;
20443
+ if (!data || !data[0]) {
20444
+ return {};
20445
+ }
20446
+ const { elements } = data[0].latestData;
20447
+ if (elements && elements.length) {
20448
+ elements.forEach((el, index) => {
20449
+ var _a;
20450
+ el[vchart.DEFAULT_DATA_INDEX] = index;
20451
+ el._uniqueId = `${el.id}-${index}`;
20452
+ el.data = undefined;
20453
+ const { graphicType: type, transform } = el;
20454
+ const finalAttributes = {
20455
+ visible: el.attributes.visibility !== 'hidden' && el.attributes.visibility !== 'collapse'
20456
+ };
20457
+ if (el.graphicType === 'text') {
20458
+ merge(finalAttributes, el._inheritStyle, (_a = el.parent) === null || _a === void 0 ? void 0 : _a._textGroupStyle, el.attributes);
20459
+ }
20460
+ else if (el.graphicType !== 'group') {
20461
+ merge(finalAttributes, el._inheritStyle, el.attributes);
20462
+ }
20463
+ if (graphicAttributeTransform[type]) {
20464
+ el._finalAttributes = graphicAttributeTransform[type](finalAttributes, el.value);
20465
+ }
20466
+ else {
20467
+ el._finalAttributes = finalAttributes;
20468
+ }
20469
+ if (transform) {
20470
+ el._finalAttributes.postMatrix = Object.assign({}, transform);
19775
20471
  }
19776
20472
  });
19777
- }
19778
- dataToPosition(datum, global = false) {
19779
- if (!datum) {
19780
- return null;
19781
- }
19782
- const name = datum[this.nameField];
19783
- if (!name) {
19784
- return null;
19785
- }
19786
- const mark = this.getMarksWithoutRoot().filter(mark => mark.name === name);
19787
- if (!mark || mark.length === 0) {
19788
- return null;
19789
- }
19790
- let bounds = new Bounds();
19791
- if (global) {
19792
- mark.forEach(m => {
19793
- bounds = bounds.union(m.getGraphics()[0].globalAABBBounds);
19794
- });
19795
- }
19796
- else {
19797
- mark.forEach(m => {
19798
- bounds = bounds.union(m.getProduct().AABBBounds);
20473
+ const texts = elements.filter(el => el.tagName === 'text');
20474
+ for (let i = 0; i < texts.length; i++) {
20475
+ const textId = texts[i]._uniqueId;
20476
+ const children = elements.filter(el => {
20477
+ let result = false;
20478
+ let parent = el.parent;
20479
+ while (parent) {
20480
+ if (parent._uniqueId === textId) {
20481
+ result = true;
20482
+ break;
20483
+ }
20484
+ parent = parent.parent;
20485
+ }
20486
+ return result;
19799
20487
  });
20488
+ if (children && children.length) {
20489
+ const startX = (_b = (_a = texts[i]._textGroupStyle) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0;
20490
+ let curX = startX;
20491
+ for (let j = 0; j < children.length; j++) {
20492
+ const currentChild = children[j];
20493
+ if (currentChild.graphicType === 'group') {
20494
+ curX = startX;
20495
+ }
20496
+ else if (currentChild.value) {
20497
+ if (currentChild.parent._textGroupStyle.x === undefined) {
20498
+ const lastText = children
20499
+ .slice(0, j)
20500
+ .reverse()
20501
+ .find(c => c.graphicType === 'text' && c.value);
20502
+ if (lastText) {
20503
+ const width = vchart.measureText(lastText.value, lastText._finalAttributes).width;
20504
+ curX += width;
20505
+ }
20506
+ currentChild._finalAttributes.x = curX;
20507
+ }
20508
+ }
20509
+ }
20510
+ }
19800
20511
  }
19801
- const point = { x: (bounds.x1 + bounds.x2) / 2, y: (bounds.y1 + bounds.y2) / 2 };
19802
- if (global) {
19803
- const { x, y } = this.getLayoutStartPoint();
19804
- point.x -= x;
19805
- point.y -= y;
19806
- }
19807
- return point;
19808
20512
  }
19809
- coordToPosition(point) {
19810
- if (!point) {
19811
- return null;
20513
+ return elements;
20514
+ };
20515
+
20516
+ class PictogramSeries extends vchart.GeoSeries {
20517
+ constructor() {
20518
+ super(...arguments);
20519
+ this.type = PICTOGRAM_SERIES_TYPE;
20520
+ this._idToMark = new Map();
20521
+ }
20522
+ setAttrFromSpec() {
20523
+ var _a, _b, _c;
20524
+ super.setAttrFromSpec();
20525
+ this.svg = this._spec.svg;
20526
+ this._nameField = this._spec.nameField;
20527
+ this._valueField = this._spec.valueField;
20528
+ if (!this.svg) {
20529
+ (_a = this._option) === null || _a === void 0 ? void 0 : _a.onError(`svg source is not specified !`);
19812
20530
  }
19813
- const { x, y } = point;
19814
- const matrix = this.getRootMatrix();
19815
- if (!matrix) {
19816
- return null;
20531
+ this._parsedSvgResult = (_b = getSVGSource(this.svg)) === null || _b === void 0 ? void 0 : _b.latestData;
20532
+ if (!this._parsedSvgResult) {
20533
+ (_c = this._option) === null || _c === void 0 ? void 0 : _c.onError(`'${this.svg}' is not registered !`);
19817
20534
  }
19818
- const position = {};
19819
- matrix.getInverse().transformPoint({ x, y }, position);
19820
- return position;
19821
20535
  }
19822
- getRootMatrix() {
19823
- var _a;
20536
+ getDatumCenter(datum) {
20537
+ return [Number.NaN, Number.NaN];
20538
+ }
20539
+ getDatumName(datum) {
20540
+ return datum.name || datum._nameFromParent;
20541
+ }
20542
+ getMarksWithoutRoot() {
20543
+ return this.getMarks().filter(m => m.name && !m.name.includes('seriesGroup') && !m.name.includes('root') && m !== this._pictogramMark);
20544
+ }
20545
+ _buildMarkAttributeContext() {
20546
+ super._buildMarkAttributeContext();
20547
+ this._markAttributeContext.getTransformMatrix = this.getRootMatrix.bind(this);
20548
+ this._markAttributeContext.coordToPosition = this.coordToPosition.bind(this);
20549
+ this._markAttributeContext.dataToPosition = this.dataToPosition.bind(this);
20550
+ }
20551
+ _defaultHoverConfig(finalHoverSpec) {
20552
+ return {
20553
+ type: ELEMENT_HIGHLIGHT_BY_GRPHIC_NAME,
20554
+ trigger: finalHoverSpec.trigger,
20555
+ triggerOff: 'pointerout',
20556
+ blurState: vchart.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,
20557
+ highlightState: vchart.STATE_VALUE_ENUM.STATE_HOVER
20558
+ };
20559
+ }
20560
+ _defaultSelectConfig(finalSelectSpec) {
20561
+ const isMultiple = finalSelectSpec.mode === 'multiple';
20562
+ const triggerOff = isValid$1(finalSelectSpec.triggerOff)
20563
+ ? finalSelectSpec.triggerOff
20564
+ : isMultiple
20565
+ ? ['empty', 'self']
20566
+ : ['empty', finalSelectSpec.trigger];
20567
+ return {
20568
+ type: ELEMENT_SELECT_BY_GRPHIC_NAME,
20569
+ trigger: finalSelectSpec.trigger,
20570
+ triggerOff: triggerOff,
20571
+ reverseState: vchart.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,
20572
+ state: vchart.STATE_VALUE_ENUM.STATE_SELECTED,
20573
+ isMultiple
20574
+ };
20575
+ }
20576
+ initMark() {
20577
+ var _a;
20578
+ this._pictogramMark = this._createMark(PictogramSeries.mark.pictogram, {
20579
+ groupKey: this.getDimensionField()[0],
20580
+ isSeriesMark: true,
20581
+ skipBeforeLayouted: true
20582
+ }, {
20583
+ morph: vchart.shouldMarkDoMorph(this._spec, PictogramSeries.mark.pictogram.name)
20584
+ });
20585
+ if (!this._pictogramMark) {
20586
+ return;
20587
+ }
20588
+ this._pictogramMark.setData(this._mapViewData);
20589
+ this._pictogramMark.setUserId(PictogramSeries.mark.pictogram.name);
20590
+ for (const element of this._mapViewData.getDataView().latestData) {
20591
+ const { graphicType: type, name, parent, id, _nameFromParent, _uniqueId } = element;
20592
+ const mark = this._createMark({ type, name: name !== null && name !== void 0 ? name : _nameFromParent }, {
20593
+ groupKey: _uniqueId,
20594
+ isSeriesMark: false,
20595
+ skipBeforeLayouted: true,
20596
+ parent: (_a = this._idToMark.get(parent === null || parent === void 0 ? void 0 : parent._uniqueId)) !== null && _a !== void 0 ? _a : this._pictogramMark
20597
+ }, {
20598
+ morph: vchart.shouldMarkDoMorph(this._spec, PictogramSeries.mark.pictogram.name)
20599
+ });
20600
+ if (mark) {
20601
+ mark.setData(this._mapViewData);
20602
+ mark.setUserId(_uniqueId);
20603
+ this._idToMark.set(_uniqueId, mark);
20604
+ if (mark.type !== 'group') {
20605
+ mark.setMarkConfig({ graphicName: mark.name });
20606
+ }
20607
+ mark.setTransform([
20608
+ {
20609
+ type: 'filter',
20610
+ callback: (datum) => {
20611
+ return datum._uniqueId === _uniqueId;
20612
+ }
20613
+ }
20614
+ ]);
20615
+ }
20616
+ }
20617
+ this._initLabelMark();
20618
+ }
20619
+ _initLabelMark() {
20620
+ if (this._spec.label.visible !== true) {
20621
+ return;
20622
+ }
20623
+ const labelMark = this._createMark(PictogramSeries.mark.label, {
20624
+ isSeriesMark: false,
20625
+ parent: this._pictogramMark,
20626
+ groupKey: '_uniqueId',
20627
+ skipBeforeLayouted: true
20628
+ });
20629
+ if (labelMark) {
20630
+ this._labelMark = labelMark;
20631
+ this._labelMark.setData(this._mapViewData);
20632
+ }
20633
+ }
20634
+ initLabelMarkStyle() {
20635
+ if (!this._labelMark) {
20636
+ return;
20637
+ }
20638
+ this.setMarkStyle(this._labelMark, {
20639
+ visible: (d) => !!this._validElement(d),
20640
+ x: (d) => { var _a; return (_a = this.dataToPosition(d, true)) === null || _a === void 0 ? void 0 : _a.x; },
20641
+ y: (d) => { var _a; return (_a = this.dataToPosition(d, true)) === null || _a === void 0 ? void 0 : _a.y; },
20642
+ text: (d) => d[this.nameField],
20643
+ textAlign: 'center',
20644
+ textBaseline: 'middle'
20645
+ }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
20646
+ }
20647
+ initMarkStyle() {
20648
+ const { root, viewBoxRect } = this._parsedSvgResult;
20649
+ const elements = this._mapViewData.getDataView().latestData;
20650
+ if (root) {
20651
+ this.setMarkStyle(this._pictogramMark, graphicAttributeTransform.group(root.attributes), 'normal', vchart.AttributeLevel.Built_In);
20652
+ if (root.transform) {
20653
+ this.setMarkStyle(this._pictogramMark, {
20654
+ postMatrix: () => root.transform
20655
+ }, 'normal', vchart.AttributeLevel.Built_In);
20656
+ }
20657
+ if (viewBoxRect) {
20658
+ this._pictogramMark.setMarkConfig({
20659
+ clip: true,
20660
+ clipPath: [createRect(Object.assign(Object.assign({}, viewBoxRect), { fill: true }))]
20661
+ });
20662
+ }
20663
+ }
20664
+ for (const element of elements) {
20665
+ const { _uniqueId, _finalAttributes: attributes } = element;
20666
+ const mark = this._idToMark.get(_uniqueId);
20667
+ const valid = this._validElement(element);
20668
+ if (mark) {
20669
+ this.setMarkStyle(mark, { keepStrokeScale: true }, 'normal', vchart.AttributeLevel.Built_In);
20670
+ if (valid) {
20671
+ this.initMarkStyleWithSpec(mark, merge({}, this._spec.pictogram, this._spec[mark.name]));
20672
+ this.setMarkStyle(mark, attributes, 'normal', vchart.AttributeLevel.Series);
20673
+ mark.setPostProcess('fill', (result, datum) => {
20674
+ return isValid$1(result) ? result : this._spec.defaultFillColor;
20675
+ });
20676
+ }
20677
+ else {
20678
+ mark.setMarkConfig({ interactive: false });
20679
+ this.setMarkStyle(mark, attributes, 'normal', vchart.AttributeLevel.Built_In);
20680
+ }
20681
+ }
20682
+ }
20683
+ this.initLabelMarkStyle();
20684
+ }
20685
+ _validElement(element) {
20686
+ return element.name || element._nameFromParent;
20687
+ }
20688
+ initTooltip() {
20689
+ this._tooltipHelper = new PictogramSeriesTooltipHelper(this);
20690
+ this.getMarksWithoutRoot().forEach(mark => {
20691
+ if (mark && mark.name) {
20692
+ this._tooltipHelper.activeTriggerSet.mark.add(mark);
20693
+ }
20694
+ });
20695
+ }
20696
+ dataToPosition(datum, global = false) {
20697
+ if (!datum) {
20698
+ return null;
20699
+ }
20700
+ const name = datum[this.nameField];
20701
+ if (!name) {
20702
+ return null;
20703
+ }
20704
+ const mark = this.getMarksWithoutRoot().filter(mark => mark.name === name);
20705
+ if (!mark || mark.length === 0) {
20706
+ return null;
20707
+ }
20708
+ let bounds = new Bounds();
20709
+ if (global) {
20710
+ mark.forEach(m => {
20711
+ bounds = bounds.union(m.getGraphics()[0].globalAABBBounds);
20712
+ });
20713
+ }
20714
+ else {
20715
+ mark.forEach(m => {
20716
+ bounds = bounds.union(m.getProduct().AABBBounds);
20717
+ });
20718
+ }
20719
+ const point = { x: (bounds.x1 + bounds.x2) / 2, y: (bounds.y1 + bounds.y2) / 2 };
20720
+ if (global) {
20721
+ const { x, y } = this.getLayoutStartPoint();
20722
+ point.x -= x;
20723
+ point.y -= y;
20724
+ }
20725
+ return point;
20726
+ }
20727
+ coordToPosition(point) {
20728
+ if (!point) {
20729
+ return null;
20730
+ }
20731
+ const { x, y } = point;
20732
+ const matrix = this.getRootMatrix();
20733
+ if (!matrix) {
20734
+ return null;
20735
+ }
20736
+ const position = {};
20737
+ matrix.getInverse().transformPoint({ x, y }, position);
20738
+ return position;
20739
+ }
20740
+ getRootMatrix() {
20741
+ var _a;
19824
20742
  return (_a = this.getPictogramRootGraphic()) === null || _a === void 0 ? void 0 : _a.transMatrix;
19825
20743
  }
19826
20744
  getPictogramRootGraphic() {
@@ -21576,932 +22494,409 @@
21576
22494
  cellInfo.forEach(cell => {
21577
22495
  let intersectPixelCount = 0;
21578
22496
  eachPixel(cell, index => {
21579
- labels[index] && intersectPixelCount++;
21580
- }), cell.intersectPixels = intersectPixelCount;
21581
- });
21582
- }
21583
- const imageCount = images.length,
21584
- maxDistance = Math.sqrt(Math.pow(size[0], 2) + Math.pow(size[1], 2)),
21585
- imageVisible = cell => {
21586
- const {
21587
- intersectPixels: intersectPixels
21588
- } = cell;
21589
- return "default" === placement ? intersectPixels > .5 * cellPixelCount : "edge" !== placement || intersectPixels > .1 * cellPixelCount && intersectPixels < cellPixelCount;
21590
- };
21591
- for (let i = 0; i < imageCount; i++) {
21592
- const image = images[i],
21593
- cell = cellInfo[i];
21594
- cell && (image.x = cell.centerX - image.width / 2, image.y = cell.centerY - image.height / 2, image.visible = imageVisible(cell), image.cell = `${cell.row}_${cell.col}`, image.angle = Math.random() * (2 * maxAngle) - maxAngle, image.anchor = [image.x + image.width / 2, image.y + image.height / 2], image.zIndex = maxDistance - cell.distance, image.distance = cell.distance, image.frequency = 1, cell.image = image);
21595
- }
21596
- const key = Object.keys(images[0]).find(k => k.includes("VGRAMMAR"));
21597
- if (imageCount < cellCount) for (let i = imageCount; i < cellCount; i++) {
21598
- const image = images[i - imageCount],
21599
- cell = cellInfo[i];
21600
- if (cell) {
21601
- const repeatImage = Object.assign({}, image);
21602
- repeatImage.x = cell.centerX - repeatImage.width / 2, repeatImage.y = cell.centerY - repeatImage.height / 2, repeatImage.anchor = [repeatImage.x + repeatImage.width / 2, repeatImage.y + repeatImage.height / 2], repeatImage.angle = Math.random() * (2 * maxAngle) - maxAngle, repeatImage.frequency += 1, repeatImage[key] = `${repeatImage[key]}_${repeatImage.frequency}`, repeatImage.visible = imageVisible(cell), repeatImage.cell = `${cell.row}_${cell.col}`, repeatImage.distance = cell.distance, repeatImage.zIndex = maxDistance - cell.distance, cell.image = repeatImage, images.push(repeatImage);
21603
- }
21604
- }
21605
- return images.filter(img => img.visible);
21606
- }
21607
- }
21608
-
21609
- const transform = (options, upstreamData, parameters) => {
21610
- var _a, _b;
21611
- const size = isFunction$1(options.size) ? options.size() : options.size;
21612
- if (options.size = size, !size || isNil$1(size[0]) || isNil$1(size[1]) || size[0] <= 0 || size[1] <= 0) {
21613
- return Logger.getInstance().info("Wordcloud size dimensions must be greater than 0"), [];
21614
- }
21615
- if (options.size = [Math.ceil(size[0]), Math.ceil(size[1])], options.image || Logger.getInstance().error("Imagecloud: image source must be specified."), options.onBeforeLayout && options.onBeforeLayout(), !upstreamData || 0 === upstreamData.length) return [];
21616
- let layoutConstructor;
21617
- switch (null !== (_b = null === (_a = options.layoutConfig) || void 0 === _a ? void 0 : _a.layoutMode) && void 0 !== _b ? _b : "spiral") {
21618
- case "grid":
21619
- layoutConstructor = GridLayout;
21620
- break;
21621
- case "stack":
21622
- layoutConstructor = StackLayout;
21623
- break;
21624
- default:
21625
- layoutConstructor = SpiralLayout;
21626
- }
21627
- const layout = new layoutConstructor(options);
21628
- return layout.layout(upstreamData), layout.unfinished() ? {
21629
- progressive: layout
21630
- } : layout.output();
21631
- };
21632
-
21633
- class AxialRotateAnimation extends ACustomAnimate {
21634
- constructor(from, to, duration, easing, params) {
21635
- var _a;
21636
- super(from, to, duration, easing, params);
21637
- this._rotations = (_a = params === null || params === void 0 ? void 0 : params.rotation) !== null && _a !== void 0 ? _a : 1;
21638
- }
21639
- onBind() {
21640
- this._scaleX = this.target.attribute.scaleX;
21641
- if (!isValidNumber$1(this._rotations)) {
21642
- this.valid = false;
21643
- }
21644
- }
21645
- onUpdate(end, ratio, out) {
21646
- var _a;
21647
- if (this.valid === false) {
21648
- return;
21649
- }
21650
- if (end) {
21651
- out.scaleX = this._scaleX;
21652
- return;
21653
- }
21654
- const currentAngle = this._rotations * 360 * ratio;
21655
- const currentAngleInRadians = (currentAngle * Math.PI) / 180;
21656
- const scaleX = Math.abs(Math.cos(currentAngleInRadians)) * ((_a = this._scaleX) !== null && _a !== void 0 ? _a : 1);
21657
- this.target.attribute.scaleX = scaleX;
21658
- this.target.addUpdatePositionTag();
21659
- this.target.addUpdateShapeAndBoundsTag();
21660
- }
21661
- }
21662
- function imageCloudPresetAnimation(params, preset) {
21663
- switch (preset) {
21664
- case 'axialRotate':
21665
- return [
21666
- {
21667
- custom: AxialRotateAnimation,
21668
- customParameters: {
21669
- rotation: 1
21670
- },
21671
- duration: vchart.DEFAULT_ANIMATION_CONFIG.appear.duration
21672
- },
21673
- {
21674
- channel: {
21675
- y: {
21676
- from: (datum, element) => {
21677
- return params.height() + element.getFinalAttribute().y;
21678
- }
21679
- },
21680
- fillOpacity: {
21681
- from: 0,
21682
- to: 1
21683
- }
21684
- },
21685
- easing: 'sineInOut'
21686
- }
21687
- ];
21688
- case 'growIn':
21689
- return {
21690
- channel: {
21691
- scaleX: {
21692
- from: 0,
21693
- to: 1
21694
- },
21695
- scaleY: {
21696
- from: 0,
21697
- to: 1
21698
- },
21699
- x: { from: () => params.center().x },
21700
- y: { from: () => params.center().y }
21701
- },
21702
- duration: vchart.DEFAULT_ANIMATION_CONFIG.appear.duration
21703
- };
21704
- case 'scaleIn':
21705
- return { type: 'scaleIn', duration: vchart.DEFAULT_ANIMATION_CONFIG.appear.duration };
21706
- case 'fadeIn':
21707
- default:
21708
- return { type: 'fadeIn', easing: 'linear', duration: vchart.DEFAULT_ANIMATION_CONFIG.appear.duration };
21709
- }
21710
- }
21711
- const registerImageCloudAnimation = () => {
21712
- vchart.Factory.registerAnimation('imageCloud', (params, preset) => ({
21713
- appear: imageCloudPresetAnimation(params, preset),
21714
- enter: imageCloudPresetAnimation(params, preset),
21715
- exit: { type: 'fadeOut' },
21716
- disappear: { type: 'fadeOut' }
21717
- }));
21718
- };
21719
-
21720
- class ImageCloudTooltipHelper extends vchart.BaseSeriesTooltipHelper {
21721
- constructor() {
21722
- super(...arguments);
21723
- this.markTooltipKeyCallback = (datum) => {
21724
- var _a, _b;
21725
- return (_b = (_a = this.series) === null || _a === void 0 ? void 0 : _a.getMarkData(datum)) === null || _b === void 0 ? void 0 : _b[this.series.getDimensionField()[0]];
21726
- };
21727
- this.markTooltipValueCallback = (datum) => {
21728
- var _a, _b;
21729
- const { measureFields } = this._seriesCacheInfo;
21730
- const data = (_a = this.series) === null || _a === void 0 ? void 0 : _a.getMarkData(datum);
21731
- if (measureFields[0] && data) {
21732
- return (_b = data[measureFields[0]]) !== null && _b !== void 0 ? _b : datum.value;
21733
- }
21734
- return undefined;
21735
- };
21736
- this.dimensionTooltipTitleCallback = (datum) => {
21737
- var _a;
21738
- const { dimensionFields } = this._seriesCacheInfo;
21739
- const data = (_a = this.series) === null || _a === void 0 ? void 0 : _a.getMarkData(datum);
21740
- if (dimensionFields[0] && data) {
21741
- return data[dimensionFields[0]];
21742
- }
21743
- return undefined;
21744
- };
21745
- }
21746
- get defaultShapeType() {
21747
- return 'square';
21748
- }
21749
- }
21750
-
21751
- class ImageCloudSeries extends vchart.BaseSeries {
21752
- constructor() {
21753
- super(...arguments);
21754
- this.type = IMAGE_CLOUD_SERIES_TYPE;
21755
- }
21756
- setValueField(field) {
21757
- if (isValid$1(field)) {
21758
- this._valueField = field;
21759
- }
21760
- }
21761
- setAttrFromSpec() {
21762
- super.setAttrFromSpec();
21763
- this._nameField = this._spec.nameField;
21764
- this._valueField = this._spec.valueField;
21765
- this._urlField = this._spec.urlField;
21766
- }
21767
- initMark() {
21768
- var _a;
21769
- if ((_a = this._spec.imageMask) === null || _a === void 0 ? void 0 : _a.visible) {
21770
- this._maskMark = this._createMark(imageCloudSeriesMark.imageMask, {
21771
- dataView: false,
21772
- skipBeforeLayouted: true
21773
- });
21774
- }
21775
- this._imageMark = this._createMark(imageCloudSeriesMark.image, {
21776
- key: datum => `${datum[vchart.DEFAULT_DATA_KEY]}-${datum.frequency}`,
21777
- isSeriesMark: true,
21778
- skipBeforeLayouted: true
21779
- });
21780
- }
21781
- initMarkStyle() {
21782
- this._initImageMarkStyle();
21783
- this._initMaskMarkStyle();
21784
- }
21785
- _initImageMarkStyle() {
21786
- var _a, _b;
21787
- if (!this._imageMark) {
21788
- return;
21789
- }
21790
- this._imageMark.setTransform([
21791
- Object.assign({ type: 'imagecloud' }, this._imageCloudTransformOption())
21792
- ]);
21793
- this.setMarkStyle(this._imageMark, {
21794
- x: (datum) => datum.x,
21795
- y: (datum) => datum.y,
21796
- width: (datum) => datum.width,
21797
- height: (datum) => datum.height,
21798
- visible: (datum) => datum.visible,
21799
- angle: (datum) => datum.angle,
21800
- clipConfig: (datum) => datum.clipConfig,
21801
- image: (datum) => datum[this._urlField],
21802
- scaleCenter: ['50%', '50%']
21803
- }, 'normal', vchart.AttributeLevel.Series);
21804
- const isMasked = ((_a = this._spec.layoutConfig) === null || _a === void 0 ? void 0 : _a.placement) === 'masked';
21805
- if (isMasked) {
21806
- this.setMarkStyle(this._imageMark, {
21807
- globalCompositeOperation: 'source-atop'
21808
- }, 'normal', vchart.AttributeLevel.Series);
21809
- this.setMarkStyle(this._rootMark, {
21810
- width: () => this._region.getLayoutRect().width,
21811
- height: () => this._region.getLayoutRect().height,
21812
- globalCompositeOperation: 'destination-in',
21813
- clip: true,
21814
- drawMode: 1
21815
- }, 'normal', vchart.AttributeLevel.Series);
21816
- }
21817
- if (((_b = this._spec.layoutConfig) === null || _b === void 0 ? void 0 : _b.layoutMode) === 'stack') {
21818
- this.setMarkStyle(this._imageMark, {
21819
- stroke: 'white',
21820
- lineWidth: 2,
21821
- shadowBlur: 6,
21822
- shadowColor: 'grey'
21823
- }, 'normal', vchart.AttributeLevel.Series);
21824
- }
21825
- }
21826
- isFillingImage(datum) {
21827
- return datum._frequency > 1;
21828
- }
21829
- _initMaskMarkStyle() {
21830
- if (!this._maskMark) {
21831
- return;
21832
- }
21833
- this._maskMark.setMarkConfig({ interactive: false });
21834
- this.setMarkStyle(this._maskMark, {
21835
- width: () => {
21836
- return this._region.getLayoutRect().width;
21837
- },
21838
- height: () => {
21839
- return this._region.getLayoutRect().height;
21840
- }
21841
- }, 'normal', vchart.AttributeLevel.Series);
21842
- }
21843
- initTooltip() {
21844
- this._tooltipHelper = new ImageCloudTooltipHelper(this);
21845
- this._imageMark && this._tooltipHelper.activeTriggerSet.mark.add(this._imageMark);
21846
- }
21847
- _imageCloudTransformOption() {
21848
- var _a;
21849
- return {
21850
- size: () => {
21851
- const { width, height } = this._region.getLayoutRect();
21852
- return [width, height];
21853
- },
21854
- image: { field: this._urlField },
21855
- weight: { field: this._valueField },
21856
- imageConfig: {
21857
- imageSize: this._spec.imageSize,
21858
- imageSizeRange: this._spec.imageSizeRange,
21859
- padding: (_a = this._spec.image) === null || _a === void 0 ? void 0 : _a.padding
21860
- },
21861
- ratio: this._spec.ratio,
21862
- mask: this._spec.maskShape,
21863
- maskConfig: this._spec.imageMask,
21864
- layoutConfig: this._spec.layoutConfig,
21865
- createCanvas: vchart.vglobal.createCanvas.bind(vchart.vglobal),
21866
- createImage,
21867
- onUpdateMaskCanvas: ((inputImage, maskImage) => {
21868
- var _a;
21869
- if (inputImage && this._maskMark) {
21870
- this._maskMark
21871
- .getProduct()
21872
- .getChildren()
21873
- .forEach((element) => {
21874
- element.setAttribute('background', inputImage);
21875
- });
21876
- }
21877
- if (maskImage && ((_a = this._spec.layoutConfig) === null || _a === void 0 ? void 0 : _a.placement) === 'masked') {
21878
- this._rootMark.getProduct().setAttribute('background', maskImage);
21879
- }
21880
- }).bind(this)
21881
- };
21882
- }
21883
- _buildMarkAttributeContext() {
21884
- super._buildMarkAttributeContext();
21885
- this._markAttributeContext.isFillingImage = this.isFillingImage.bind(this);
21886
- }
21887
- initAnimation() {
21888
- [this._imageMark].forEach(mark => {
21889
- var _a, _b;
21890
- if (mark) {
21891
- const appearPreset = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.animationAppear) === null || _b === void 0 ? void 0 : _b.preset;
21892
- const params = {
21893
- center: () => {
21894
- const { width, height } = this._region.getLayoutRect();
21895
- return { x: width / 2, y: height / 2 };
21896
- },
21897
- height: () => {
21898
- const { height } = this._region.getLayoutRect();
21899
- return height;
21900
- }
21901
- };
21902
- mark.setAnimationConfig(vchart.animationConfig(vchart.Factory.getAnimationInKey('imageCloud')(params, appearPreset), vchart.userAnimationConfig("image", this._spec, this._markAttributeContext)));
21903
- }
21904
- });
21905
- }
21906
- getDimensionField() {
21907
- var _a;
21908
- return [(_a = this._nameField) !== null && _a !== void 0 ? _a : this._spec.urlField];
21909
- }
21910
- getMeasureField() {
21911
- return [this._valueField];
21912
- }
21913
- getStatisticFields() {
21914
- const fields = [];
21915
- fields.push({ key: this._nameField, operations: ['values'] });
21916
- fields.push({ key: this._valueField, operations: ['max', 'min'] });
21917
- return fields;
21918
- }
21919
- getActiveMarks() {
21920
- return [this._imageMark];
21921
- }
21922
- getMarkData(datum) {
21923
- var _a;
21924
- return (_a = datum === null || datum === void 0 ? void 0 : datum.datum) !== null && _a !== void 0 ? _a : datum;
21925
- }
21926
- getGroupFields() {
21927
- return [];
21928
- }
21929
- dataToPosition(data) {
21930
- return null;
21931
- }
21932
- dataToPositionX(data) {
21933
- var _a;
21934
- return (_a = this.dataToPosition(data)) === null || _a === void 0 ? void 0 : _a.x;
21935
- }
21936
- dataToPositionY(data) {
21937
- var _a;
21938
- return (_a = this.dataToPosition(data)) === null || _a === void 0 ? void 0 : _a.y;
21939
- }
21940
- valueToPosition(value1, value2) {
21941
- return null;
21942
- }
21943
- getStackGroupFields() {
21944
- return [];
21945
- }
21946
- getStackValueField() {
21947
- return '';
21948
- }
21949
- }
21950
- ImageCloudSeries.type = IMAGE_CLOUD_SERIES_TYPE;
21951
- ImageCloudSeries.mark = imageCloudSeriesMark;
21952
- const registerImageCloudSeries = () => {
21953
- vchart.registerImageMark();
21954
- registerImageCloudAnimation();
21955
- vchart.Factory.registerSeries(ImageCloudSeries.type, ImageCloudSeries);
21956
- vchart.Factory.registerGrammarTransform('imagecloud', {
21957
- transform: transform
21958
- });
21959
- };
21960
-
21961
- class ImageCloudChart extends vchart.BaseChart {
21962
- constructor() {
21963
- super(...arguments);
21964
- this.transformerConstructor = ImageCloudChart.transformerConstructor;
21965
- this.type = IMAGE_CLOUD_CHART_TYPE;
21966
- this.seriesType = IMAGE_CLOUD_SERIES_TYPE;
21967
- }
21968
- }
21969
- ImageCloudChart.type = IMAGE_CLOUD_CHART_TYPE;
21970
- ImageCloudChart.seriesType = IMAGE_CLOUD_SERIES_TYPE;
21971
- ImageCloudChart.transformerConstructor = ImageCloudChartSpecTransformer;
21972
- const registerImageCloudChart = () => {
21973
- registerImageCloudSeries();
21974
- vchart.Factory.registerChart(ImageCloudChart.type, ImageCloudChart);
21975
- };
21976
-
21977
- class CandlestickChartSpecTransformer extends vchart.CartesianChartSpecTransformer {
21978
- _getDefaultSeriesSpec(spec) {
21979
- const dataFields = [spec.openField, spec.highField, spec.lowField, spec.closeField];
21980
- const seriesSpec = super._getDefaultSeriesSpec(spec, [
21981
- 'candlestick',
21982
- 'openField',
21983
- 'highField',
21984
- 'lowField',
21985
- 'closeField',
21986
- 'rising',
21987
- 'falling',
21988
- 'doji'
21989
- ]);
21990
- seriesSpec.yField = dataFields;
21991
- return seriesSpec;
21992
- }
21993
- transformSpec(spec) {
21994
- super.transformSpec(spec);
21995
- if (!spec.axes) {
21996
- spec.axes = [
21997
- {
21998
- orient: 'bottom'
21999
- },
22000
- {
22001
- orient: 'left'
22002
- }
22003
- ];
22004
- }
22005
- vchart.setDefaultCrosshairForCartesianChart(spec);
22006
- }
22007
- }
22008
-
22009
- const CANDLESTICK_MARK_TYPE = 'candlestick';
22010
- class CandlestickMark extends vchart.GlyphMark {
22011
- constructor() {
22012
- super(...arguments);
22013
- this.type = CandlestickMark.type;
22497
+ labels[index] && intersectPixelCount++;
22498
+ }), cell.intersectPixels = intersectPixelCount;
22499
+ });
22014
22500
  }
22015
- setGlyphConfig(cfg) {
22016
- super.setGlyphConfig(cfg);
22017
- this._subMarks = {
22018
- line: { type: 'line', defaultAttributes: { x: 0, y: 0 } },
22019
- box: { type: 'rect' }
22020
- };
22021
- this._positionChannels = ['x', 'boxWidth', 'open', 'close', 'high', 'low'];
22022
- this._channelEncoder = null;
22023
- this._positionEncoder = (glyphAttrs, datum, g) => {
22024
- const { x = g.attribute.x, boxWidth = g.attribute.boxWidth, open = g.attribute.open, close = g.attribute.close, low = g.attribute.low, high = g.attribute.high } = glyphAttrs;
22025
- const attributes = {};
22026
- attributes.line = {
22027
- points: [
22028
- {
22029
- x: x,
22030
- y: low
22031
- },
22032
- {
22033
- x: x,
22034
- y: high
22035
- }
22036
- ]
22037
- };
22038
- attributes.box = {
22039
- x: x - boxWidth / 2,
22040
- x1: x + boxWidth / 2,
22041
- y: Math.min(open, close),
22042
- y1: Math.max(open, close),
22043
- drawStrokeWhenZeroWH: true
22044
- };
22045
- return attributes;
22046
- };
22501
+ const imageCount = images.length,
22502
+ maxDistance = Math.sqrt(Math.pow(size[0], 2) + Math.pow(size[1], 2)),
22503
+ imageVisible = cell => {
22504
+ const {
22505
+ intersectPixels: intersectPixels
22506
+ } = cell;
22507
+ return "default" === placement ? intersectPixels > .5 * cellPixelCount : "edge" !== placement || intersectPixels > .1 * cellPixelCount && intersectPixels < cellPixelCount;
22508
+ };
22509
+ for (let i = 0; i < imageCount; i++) {
22510
+ const image = images[i],
22511
+ cell = cellInfo[i];
22512
+ cell && (image.x = cell.centerX - image.width / 2, image.y = cell.centerY - image.height / 2, image.visible = imageVisible(cell), image.cell = `${cell.row}_${cell.col}`, image.angle = Math.random() * (2 * maxAngle) - maxAngle, image.anchor = [image.x + image.width / 2, image.y + image.height / 2], image.zIndex = maxDistance - cell.distance, image.distance = cell.distance, image.frequency = 1, cell.image = image);
22047
22513
  }
22048
- _getDefaultStyle() {
22049
- const defaultStyle = Object.assign({}, super._getDefaultStyle());
22050
- return defaultStyle;
22514
+ const key = Object.keys(images[0]).find(k => k.includes("VGRAMMAR"));
22515
+ if (imageCount < cellCount) for (let i = imageCount; i < cellCount; i++) {
22516
+ const image = images[i - imageCount],
22517
+ cell = cellInfo[i];
22518
+ if (cell) {
22519
+ const repeatImage = Object.assign({}, image);
22520
+ repeatImage.x = cell.centerX - repeatImage.width / 2, repeatImage.y = cell.centerY - repeatImage.height / 2, repeatImage.anchor = [repeatImage.x + repeatImage.width / 2, repeatImage.y + repeatImage.height / 2], repeatImage.angle = Math.random() * (2 * maxAngle) - maxAngle, repeatImage.frequency += 1, repeatImage[key] = `${repeatImage[key]}_${repeatImage.frequency}`, repeatImage.visible = imageVisible(cell), repeatImage.cell = `${cell.row}_${cell.col}`, repeatImage.distance = cell.distance, repeatImage.zIndex = maxDistance - cell.distance, cell.image = repeatImage, images.push(repeatImage);
22521
+ }
22051
22522
  }
22523
+ return images.filter(img => img.visible);
22524
+ }
22052
22525
  }
22053
- CandlestickMark.type = CANDLESTICK_MARK_TYPE;
22054
- const registerCandlestickMark = () => {
22055
- vchart.registerGlyphMark();
22056
- registerLine();
22057
- registerRect();
22058
- vchart.Factory.registerGraphicComponent('line', (attrs) => createLine(attrs));
22059
- vchart.Factory.registerGraphicComponent('rect', (attrs) => createRect(attrs));
22060
- vchart.Factory.registerMark(CandlestickMark.type, CandlestickMark);
22061
- };
22062
22526
 
22063
- const scaleIn = () => {
22064
- return (graphic) => {
22065
- const finalAttribute = graphic.getFinalAttribute();
22066
- const { x, y, open, high, low, close } = finalAttribute;
22067
- const animateAttributes = { from: { x, y }, to: { x, y } };
22068
- if (isValidNumber$1(open) && isValidNumber$1(close)) {
22069
- if (open > close) {
22070
- animateAttributes.from.open = low;
22071
- animateAttributes.to.open = open;
22072
- animateAttributes.from.close = low;
22073
- animateAttributes.to.close = close;
22074
- if (isValidNumber$1(high)) {
22075
- animateAttributes.from.high = low;
22076
- animateAttributes.to.high = high;
22077
- }
22078
- }
22079
- else {
22080
- animateAttributes.from.open = high;
22081
- animateAttributes.to.open = open;
22082
- animateAttributes.from.close = high;
22083
- animateAttributes.to.close = close;
22084
- if (isValidNumber$1(low)) {
22085
- animateAttributes.from.low = high;
22086
- animateAttributes.to.low = low;
22087
- }
22088
- }
22089
- }
22090
- return animateAttributes;
22091
- };
22092
- };
22093
- const scaleOut = () => {
22094
- return (graphic) => {
22095
- const finalAttribute = graphic.getFinalAttribute();
22096
- const { x, y, open, high, low, close } = finalAttribute;
22097
- const animateAttributes = { from: { x, y }, to: { x, y } };
22098
- if (isValidNumber$1(open) && isValidNumber$1(close)) {
22099
- if (open > close) {
22100
- animateAttributes.from.open = open;
22101
- animateAttributes.to.open = low;
22102
- animateAttributes.from.close = close;
22103
- animateAttributes.to.close = low;
22104
- if (isValidNumber$1(high)) {
22105
- animateAttributes.from.high = high;
22106
- animateAttributes.to.high = low;
22107
- }
22108
- }
22109
- else {
22110
- animateAttributes.from.open = open;
22111
- animateAttributes.to.open = high;
22112
- animateAttributes.from.close = close;
22113
- animateAttributes.to.close = high;
22114
- if (isValidNumber$1(low)) {
22115
- animateAttributes.from.low = low;
22116
- animateAttributes.to.low = high;
22117
- }
22118
- }
22119
- }
22120
- return animateAttributes;
22121
- };
22527
+ const transform = (options, upstreamData, parameters) => {
22528
+ var _a, _b;
22529
+ const size = isFunction$1(options.size) ? options.size() : options.size;
22530
+ if (options.size = size, !size || isNil$1(size[0]) || isNil$1(size[1]) || size[0] <= 0 || size[1] <= 0) {
22531
+ return Logger.getInstance().info("Wordcloud size dimensions must be greater than 0"), [];
22532
+ }
22533
+ if (options.size = [Math.ceil(size[0]), Math.ceil(size[1])], options.image || Logger.getInstance().error("Imagecloud: image source must be specified."), options.onBeforeLayout && options.onBeforeLayout(), !upstreamData || 0 === upstreamData.length) return [];
22534
+ let layoutConstructor;
22535
+ switch (null !== (_b = null === (_a = options.layoutConfig) || void 0 === _a ? void 0 : _a.layoutMode) && void 0 !== _b ? _b : "spiral") {
22536
+ case "grid":
22537
+ layoutConstructor = GridLayout;
22538
+ break;
22539
+ case "stack":
22540
+ layoutConstructor = StackLayout;
22541
+ break;
22542
+ default:
22543
+ layoutConstructor = SpiralLayout;
22544
+ }
22545
+ const layout = new layoutConstructor(options);
22546
+ return layout.layout(upstreamData), layout.unfinished() ? {
22547
+ progressive: layout
22548
+ } : layout.output();
22122
22549
  };
22123
- class CandlestickScaleIn extends ACustomAnimate {
22550
+
22551
+ class AxialRotateAnimation extends ACustomAnimate {
22124
22552
  constructor(from, to, duration, easing, params) {
22553
+ var _a;
22125
22554
  super(from, to, duration, easing, params);
22555
+ this._rotations = (_a = params === null || params === void 0 ? void 0 : params.rotation) !== null && _a !== void 0 ? _a : 1;
22126
22556
  }
22127
22557
  onBind() {
22128
- super.onBind();
22129
- const finalAttribute = this.target.getFinalAttribute();
22130
- if (finalAttribute) {
22131
- this.target.setAttributes(finalAttribute);
22558
+ this._scaleX = this.target.attribute.scaleX;
22559
+ if (!isValidNumber$1(this._rotations)) {
22560
+ this.valid = false;
22132
22561
  }
22133
- const { from, to } = this.computeAttribute();
22134
- this.propKeys = Object.keys(to).filter(key => to[key] != null);
22135
- this.animate.reSyncProps();
22136
- this.from = from;
22137
- this.to = to;
22138
- this.target.setAttributes(this.from);
22139
- }
22140
- computeAttribute() {
22141
- const attr = scaleIn()(this.target, this.params, this.params.options);
22142
- return attr;
22143
22562
  }
22144
22563
  onUpdate(end, ratio, out) {
22145
- const attribute = this.target.attribute;
22146
- this.propKeys.forEach(key => {
22147
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
22148
- });
22149
- this.target.setAttributes(attribute);
22150
- }
22151
- }
22152
- class CandlestickScaleOut extends ACustomAnimate {
22153
- constructor(from, to, duration, easing, params) {
22154
- super(from, to, duration, easing, params);
22155
- }
22156
- onBind() {
22157
22564
  var _a;
22158
- if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
22159
- this.target.setAttributes(this.params.diffAttrs);
22565
+ if (this.valid === false) {
22566
+ return;
22160
22567
  }
22161
- const { from, to } = this.computeAttribute();
22162
- this.propKeys = Object.keys(to).filter(key => to[key] != null);
22163
- this.animate.reSyncProps();
22164
- this.from = from;
22165
- this.to = to;
22166
- this.target.setAttributes(this.from);
22167
- }
22168
- computeAttribute() {
22169
- const attr = scaleOut()(this.target, this.params, this.params.options);
22170
- return attr;
22568
+ if (end) {
22569
+ out.scaleX = this._scaleX;
22570
+ return;
22571
+ }
22572
+ const currentAngle = this._rotations * 360 * ratio;
22573
+ const currentAngleInRadians = (currentAngle * Math.PI) / 180;
22574
+ const scaleX = Math.abs(Math.cos(currentAngleInRadians)) * ((_a = this._scaleX) !== null && _a !== void 0 ? _a : 1);
22575
+ this.target.attribute.scaleX = scaleX;
22576
+ this.target.addUpdatePositionTag();
22577
+ this.target.addUpdateShapeAndBoundsTag();
22171
22578
  }
22172
- onUpdate(end, ratio, out) {
22173
- const attribute = this.target.attribute;
22174
- this.propKeys.forEach(key => {
22175
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
22176
- });
22177
- this.target.setAttributes(attribute);
22579
+ }
22580
+ function imageCloudPresetAnimation(params, preset) {
22581
+ switch (preset) {
22582
+ case 'axialRotate':
22583
+ return [
22584
+ {
22585
+ custom: AxialRotateAnimation,
22586
+ customParameters: {
22587
+ rotation: 1
22588
+ },
22589
+ duration: vchart.DEFAULT_ANIMATION_CONFIG.appear.duration
22590
+ },
22591
+ {
22592
+ channel: {
22593
+ y: {
22594
+ from: (datum, element) => {
22595
+ return params.height() + element.getFinalAttribute().y;
22596
+ }
22597
+ },
22598
+ fillOpacity: {
22599
+ from: 0,
22600
+ to: 1
22601
+ }
22602
+ },
22603
+ easing: 'sineInOut'
22604
+ }
22605
+ ];
22606
+ case 'growIn':
22607
+ return {
22608
+ channel: {
22609
+ scaleX: {
22610
+ from: 0,
22611
+ to: 1
22612
+ },
22613
+ scaleY: {
22614
+ from: 0,
22615
+ to: 1
22616
+ },
22617
+ x: { from: () => params.center().x },
22618
+ y: { from: () => params.center().y }
22619
+ },
22620
+ duration: vchart.DEFAULT_ANIMATION_CONFIG.appear.duration
22621
+ };
22622
+ case 'scaleIn':
22623
+ return { type: 'scaleIn', duration: vchart.DEFAULT_ANIMATION_CONFIG.appear.duration };
22624
+ case 'fadeIn':
22625
+ default:
22626
+ return { type: 'fadeIn', easing: 'linear', duration: vchart.DEFAULT_ANIMATION_CONFIG.appear.duration };
22178
22627
  }
22179
22628
  }
22180
- const registerCandlestickScaleAnimation = () => {
22181
- AnimateExecutor.registerBuiltInAnimate('candlestickScaleIn', CandlestickScaleIn);
22182
- AnimateExecutor.registerBuiltInAnimate('candlestickScaleOut', CandlestickScaleOut);
22629
+ const registerImageCloudAnimation = () => {
22630
+ vchart.Factory.registerAnimation('imageCloud', (params, preset) => ({
22631
+ appear: imageCloudPresetAnimation(params, preset),
22632
+ enter: imageCloudPresetAnimation(params, preset),
22633
+ exit: { type: 'fadeOut' },
22634
+ disappear: { type: 'fadeOut' }
22635
+ }));
22183
22636
  };
22184
22637
 
22185
- const CANDLESTICK_CHART_TYPE = 'candlestick';
22186
- const CANDLESTICK_SERIES_TYPE = 'candlestick';
22187
- var CANDLESTICK_TOOLTIP_KEYS;
22188
- (function (CANDLESTICK_TOOLTIP_KEYS) {
22189
- CANDLESTICK_TOOLTIP_KEYS["OPEN"] = "open";
22190
- CANDLESTICK_TOOLTIP_KEYS["HIGH"] = "high";
22191
- CANDLESTICK_TOOLTIP_KEYS["LOW"] = "low";
22192
- CANDLESTICK_TOOLTIP_KEYS["CLOSE"] = "close";
22193
- CANDLESTICK_TOOLTIP_KEYS["SERIES_FIELD"] = "seriesField";
22194
- })(CANDLESTICK_TOOLTIP_KEYS || (CANDLESTICK_TOOLTIP_KEYS = {}));
22195
- var CandlestickMarkNameEnum;
22196
- (function (CandlestickMarkNameEnum) {
22197
- CandlestickMarkNameEnum["candlestick"] = "candlestick";
22198
- })(CandlestickMarkNameEnum || (CandlestickMarkNameEnum = {}));
22199
- const CandlestickSeriesMark = Object.assign(Object.assign({}, vchart.baseSeriesMark), { ["candlestick"]: { name: "candlestick", type: 'candlestick' } });
22200
-
22201
- class CandlestickSeriesTooltipHelper extends vchart.BaseSeriesTooltipHelper {
22638
+ class ImageCloudTooltipHelper extends vchart.BaseSeriesTooltipHelper {
22202
22639
  constructor() {
22203
22640
  super(...arguments);
22204
- this.getContentKey = (contentType) => (datum) => {
22205
- switch (contentType) {
22206
- case CANDLESTICK_TOOLTIP_KEYS.OPEN: {
22207
- const openField = this.series.getOpenField();
22208
- return openField;
22209
- }
22210
- case CANDLESTICK_TOOLTIP_KEYS.HIGH: {
22211
- const highField = this.series.getHighField();
22212
- return highField;
22213
- }
22214
- case CANDLESTICK_TOOLTIP_KEYS.LOW: {
22215
- const lowField = this.series.getLowField();
22216
- return lowField;
22217
- }
22218
- case CANDLESTICK_TOOLTIP_KEYS.CLOSE: {
22219
- const closeField = this.series.getCloseField();
22220
- return closeField;
22221
- }
22222
- case CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD: {
22223
- const seriesField = this.series.getSeriesField();
22224
- return seriesField;
22225
- }
22226
- }
22227
- return null;
22641
+ this.markTooltipKeyCallback = (datum) => {
22642
+ var _a, _b;
22643
+ return (_b = (_a = this.series) === null || _a === void 0 ? void 0 : _a.getMarkData(datum)) === null || _b === void 0 ? void 0 : _b[this.series.getDimensionField()[0]];
22228
22644
  };
22229
- this.getContentValue = (contentType) => (datum) => {
22230
- switch (contentType) {
22231
- case CANDLESTICK_TOOLTIP_KEYS.OPEN: {
22232
- const openField = this.series.getOpenField();
22233
- return datum[openField];
22234
- }
22235
- case CANDLESTICK_TOOLTIP_KEYS.HIGH: {
22236
- const highField = this.series.getHighField();
22237
- return datum[highField];
22238
- }
22239
- case CANDLESTICK_TOOLTIP_KEYS.LOW: {
22240
- const lowField = this.series.getLowField();
22241
- return datum[lowField];
22242
- }
22243
- case CANDLESTICK_TOOLTIP_KEYS.CLOSE: {
22244
- const closeField = this.series.getCloseField();
22245
- return datum[closeField];
22246
- }
22247
- case CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD: {
22248
- const seriesField = this.series.getSeriesField();
22249
- return datum[seriesField];
22250
- }
22645
+ this.markTooltipValueCallback = (datum) => {
22646
+ var _a, _b;
22647
+ const { measureFields } = this._seriesCacheInfo;
22648
+ const data = (_a = this.series) === null || _a === void 0 ? void 0 : _a.getMarkData(datum);
22649
+ if (measureFields[0] && data) {
22650
+ return (_b = data[measureFields[0]]) !== null && _b !== void 0 ? _b : datum.value;
22251
22651
  }
22252
- return null;
22652
+ return undefined;
22253
22653
  };
22254
- this.shapeColorCallback = (datum) => {
22255
- return this.series.getMarkInName('candlestick').getAttribute('stroke', datum);
22654
+ this.dimensionTooltipTitleCallback = (datum) => {
22655
+ var _a;
22656
+ const { dimensionFields } = this._seriesCacheInfo;
22657
+ const data = (_a = this.series) === null || _a === void 0 ? void 0 : _a.getMarkData(datum);
22658
+ if (dimensionFields[0] && data) {
22659
+ return data[dimensionFields[0]];
22660
+ }
22661
+ return undefined;
22256
22662
  };
22257
22663
  }
22258
- getDefaultContentList(activeType) {
22259
- return [
22260
- {
22261
- key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.OPEN),
22262
- value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.OPEN)
22263
- },
22264
- {
22265
- key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.HIGH),
22266
- value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.HIGH)
22267
- },
22268
- {
22269
- key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.LOW),
22270
- value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.LOW)
22271
- },
22272
- {
22273
- key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.CLOSE),
22274
- value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.CLOSE)
22275
- },
22276
- {
22277
- key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD),
22278
- value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD)
22279
- }
22280
- ];
22664
+ get defaultShapeType() {
22665
+ return 'square';
22281
22666
  }
22282
22667
  }
22283
22668
 
22284
- const getCandlestickTheme = () => {
22285
- const res = {
22286
- rising: {
22287
- style: {
22288
- boxFill: '#FF0000',
22289
- stroke: '#FF0000'
22290
- }
22291
- },
22292
- falling: {
22293
- style: {
22294
- boxFill: '#00AA00',
22295
- stroke: '#00AA00'
22296
- }
22297
- },
22298
- doji: {
22299
- style: {
22300
- boxFill: '#000000',
22301
- stroke: '#000000'
22302
- }
22303
- },
22304
- candlestick: {
22305
- style: {
22306
- lineWidth: 1
22307
- }
22308
- }
22309
- };
22310
- return res;
22311
- };
22312
- const candlestick = getCandlestickTheme();
22313
-
22314
- class CandlestickSeries extends vchart.CartesianSeries {
22669
+ class ImageCloudSeries extends vchart.BaseSeries {
22315
22670
  constructor() {
22316
22671
  super(...arguments);
22317
- this.type = CANDLESTICK_SERIES_TYPE;
22318
- this._mergedStyles = {
22319
- rising: {},
22320
- falling: {},
22321
- doji: {}
22322
- };
22672
+ this.type = IMAGE_CLOUD_SERIES_TYPE;
22323
22673
  }
22324
- getOpenField() {
22325
- return this._openField;
22674
+ setValueField(field) {
22675
+ if (isValid$1(field)) {
22676
+ this._valueField = field;
22677
+ }
22326
22678
  }
22327
- getHighField() {
22328
- return this._highField;
22679
+ setAttrFromSpec() {
22680
+ super.setAttrFromSpec();
22681
+ this._nameField = this._spec.nameField;
22682
+ this._valueField = this._spec.valueField;
22683
+ this._urlField = this._spec.urlField;
22329
22684
  }
22330
- getLowField() {
22331
- return this._lowField;
22685
+ initMark() {
22686
+ var _a;
22687
+ if ((_a = this._spec.imageMask) === null || _a === void 0 ? void 0 : _a.visible) {
22688
+ this._maskMark = this._createMark(imageCloudSeriesMark.imageMask, {
22689
+ dataView: false,
22690
+ skipBeforeLayouted: true
22691
+ });
22692
+ }
22693
+ this._imageMark = this._createMark(imageCloudSeriesMark.image, {
22694
+ key: datum => `${datum[vchart.DEFAULT_DATA_KEY]}-${datum.frequency}`,
22695
+ isSeriesMark: true,
22696
+ skipBeforeLayouted: true
22697
+ });
22332
22698
  }
22333
- getCloseField() {
22334
- return this._closeField;
22699
+ initMarkStyle() {
22700
+ this._initImageMarkStyle();
22701
+ this._initMaskMarkStyle();
22702
+ }
22703
+ _initImageMarkStyle() {
22704
+ var _a, _b;
22705
+ if (!this._imageMark) {
22706
+ return;
22707
+ }
22708
+ this._imageMark.setTransform([
22709
+ Object.assign({ type: 'imagecloud' }, this._imageCloudTransformOption())
22710
+ ]);
22711
+ this.setMarkStyle(this._imageMark, {
22712
+ x: (datum) => datum.x,
22713
+ y: (datum) => datum.y,
22714
+ width: (datum) => datum.width,
22715
+ height: (datum) => datum.height,
22716
+ visible: (datum) => datum.visible,
22717
+ angle: (datum) => datum.angle,
22718
+ clipConfig: (datum) => datum.clipConfig,
22719
+ image: (datum) => datum[this._urlField],
22720
+ scaleCenter: ['50%', '50%']
22721
+ }, 'normal', vchart.AttributeLevel.Series);
22722
+ const isMasked = ((_a = this._spec.layoutConfig) === null || _a === void 0 ? void 0 : _a.placement) === 'masked';
22723
+ if (isMasked) {
22724
+ this.setMarkStyle(this._imageMark, {
22725
+ globalCompositeOperation: 'source-atop'
22726
+ }, 'normal', vchart.AttributeLevel.Series);
22727
+ this.setMarkStyle(this._rootMark, {
22728
+ width: () => this._region.getLayoutRect().width,
22729
+ height: () => this._region.getLayoutRect().height,
22730
+ globalCompositeOperation: 'destination-in',
22731
+ clip: true,
22732
+ drawMode: 1
22733
+ }, 'normal', vchart.AttributeLevel.Series);
22734
+ }
22735
+ if (((_b = this._spec.layoutConfig) === null || _b === void 0 ? void 0 : _b.layoutMode) === 'stack') {
22736
+ this.setMarkStyle(this._imageMark, {
22737
+ stroke: 'white',
22738
+ lineWidth: 2,
22739
+ shadowBlur: 6,
22740
+ shadowColor: 'grey'
22741
+ }, 'normal', vchart.AttributeLevel.Series);
22742
+ }
22743
+ }
22744
+ isFillingImage(datum) {
22745
+ return datum._frequency > 1;
22746
+ }
22747
+ _initMaskMarkStyle() {
22748
+ if (!this._maskMark) {
22749
+ return;
22750
+ }
22751
+ this._maskMark.setMarkConfig({ interactive: false });
22752
+ this.setMarkStyle(this._maskMark, {
22753
+ width: () => {
22754
+ return this._region.getLayoutRect().width;
22755
+ },
22756
+ height: () => {
22757
+ return this._region.getLayoutRect().height;
22758
+ }
22759
+ }, 'normal', vchart.AttributeLevel.Series);
22335
22760
  }
22336
- getBoxFill() {
22337
- return this._boxFill;
22761
+ initTooltip() {
22762
+ this._tooltipHelper = new ImageCloudTooltipHelper(this);
22763
+ this._imageMark && this._tooltipHelper.activeTriggerSet.mark.add(this._imageMark);
22338
22764
  }
22339
- getStrokeColor() {
22340
- return this._strokeColor;
22765
+ _imageCloudTransformOption() {
22766
+ var _a;
22767
+ return {
22768
+ size: () => {
22769
+ const { width, height } = this._region.getLayoutRect();
22770
+ return [width, height];
22771
+ },
22772
+ image: { field: this._urlField },
22773
+ weight: { field: this._valueField },
22774
+ imageConfig: {
22775
+ imageSize: this._spec.imageSize,
22776
+ imageSizeRange: this._spec.imageSizeRange,
22777
+ padding: (_a = this._spec.image) === null || _a === void 0 ? void 0 : _a.padding
22778
+ },
22779
+ ratio: this._spec.ratio,
22780
+ mask: this._spec.maskShape,
22781
+ maskConfig: this._spec.imageMask,
22782
+ layoutConfig: this._spec.layoutConfig,
22783
+ createCanvas: vchart.vglobal.createCanvas.bind(vchart.vglobal),
22784
+ createImage,
22785
+ onUpdateMaskCanvas: ((inputImage, maskImage) => {
22786
+ var _a;
22787
+ if (inputImage && this._maskMark) {
22788
+ this._maskMark
22789
+ .getProduct()
22790
+ .getChildren()
22791
+ .forEach((element) => {
22792
+ element.setAttribute('background', inputImage);
22793
+ });
22794
+ }
22795
+ if (maskImage && ((_a = this._spec.layoutConfig) === null || _a === void 0 ? void 0 : _a.placement) === 'masked') {
22796
+ this._rootMark.getProduct().setAttribute('background', maskImage);
22797
+ }
22798
+ }).bind(this),
22799
+ onLayoutFinished: () => {
22800
+ var _a, _b;
22801
+ return (_b = (_a = this._option.globalInstance
22802
+ .getChart()
22803
+ .getOption()
22804
+ .performanceHook) === null || _a === void 0 ? void 0 : _a.afterWordcloudShapeDraw) === null || _b === void 0 ? void 0 : _b.call(_a, this._option.globalInstance);
22805
+ }
22806
+ };
22341
22807
  }
22342
- setAttrFromSpec() {
22343
- var _a, _b, _c, _d, _e, _f, _g, _h;
22344
- super.setAttrFromSpec();
22345
- const spec = this._spec;
22346
- const CandlestickStyle = (_b = (_a = spec.candlestick) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
22347
- this._openField = spec.openField;
22348
- this._highField = spec.highField;
22349
- this._lowField = spec.lowField;
22350
- this._closeField = spec.closeField;
22351
- this._boxWidth = CandlestickStyle.boxWidth;
22352
- this._boxFill = CandlestickStyle.boxFill;
22353
- this._strokeColor = CandlestickStyle.strokeColor;
22354
- this._buildMergedStyles(CandlestickStyle, (_d = (_c = spec.rising) === null || _c === void 0 ? void 0 : _c.style) !== null && _d !== void 0 ? _d : {}, (_f = (_e = spec.falling) === null || _e === void 0 ? void 0 : _e.style) !== null && _f !== void 0 ? _f : {}, (_h = (_g = spec.doji) === null || _g === void 0 ? void 0 : _g.style) !== null && _h !== void 0 ? _h : {});
22808
+ _buildMarkAttributeContext() {
22809
+ super._buildMarkAttributeContext();
22810
+ this._markAttributeContext.isFillingImage = this.isFillingImage.bind(this);
22355
22811
  }
22356
- initMark() {
22357
- this._candlestickMark = this._createMark(CandlestickSeries.mark.candlestick, {
22358
- groupKey: this._seriesField,
22359
- isSeriesMark: true
22812
+ initAnimation() {
22813
+ [this._imageMark].forEach(mark => {
22814
+ var _a, _b;
22815
+ if (mark) {
22816
+ const appearPreset = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.animationAppear) === null || _b === void 0 ? void 0 : _b.preset;
22817
+ const params = {
22818
+ center: () => {
22819
+ const { width, height } = this._region.getLayoutRect();
22820
+ return { x: width / 2, y: height / 2 };
22821
+ },
22822
+ height: () => {
22823
+ const { height } = this._region.getLayoutRect();
22824
+ return height;
22825
+ }
22826
+ };
22827
+ mark.setAnimationConfig(vchart.animationConfig(vchart.Factory.getAnimationInKey('imageCloud')(params, appearPreset), vchart.userAnimationConfig("image", this._spec, this._markAttributeContext)));
22828
+ }
22360
22829
  });
22361
22830
  }
22362
- initMarkStyle() {
22831
+ getDimensionField() {
22363
22832
  var _a;
22364
- const candlestickMark = this._candlestickMark;
22365
- if (candlestickMark) {
22366
- const CandlestickStyles = {
22367
- fill: (datum) => {
22368
- const boxFill = this.mergeStyle(datum).boxFill;
22369
- return boxFill;
22370
- },
22371
- stroke: (datum) => {
22372
- const strokeColor = this.mergeStyle(datum).stroke;
22373
- return strokeColor;
22374
- },
22375
- lineWidth: (datum) => {
22376
- const lineWidth = this.mergeStyle(datum).lineWidth;
22377
- return lineWidth;
22378
- },
22379
- boxWidth: (_a = this._boxWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth.bind(this),
22380
- x: this.dataToPositionX.bind(this)
22381
- };
22382
- candlestickMark.setGlyphConfig({});
22383
- this.setMarkStyle(candlestickMark, CandlestickStyles, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
22384
- }
22833
+ return [(_a = this._nameField) !== null && _a !== void 0 ? _a : this._spec.urlField];
22385
22834
  }
22386
- initCandlestickMarkStyle() {
22387
- var _a;
22388
- const candlestickMark = this._candlestickMark;
22389
- const axisHelper = this._yAxisHelper;
22390
- if (candlestickMark && axisHelper) {
22391
- const { dataToPosition } = axisHelper;
22392
- const scale = (_a = axisHelper === null || axisHelper === void 0 ? void 0 : axisHelper.getScale) === null || _a === void 0 ? void 0 : _a.call(axisHelper, 0);
22393
- this.setMarkStyle(candlestickMark, {
22394
- open: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._openField), {
22395
- bandPosition: this._bandPosition
22396
- }), scale),
22397
- high: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._highField), {
22398
- bandPosition: this._bandPosition
22399
- }), scale),
22400
- low: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._lowField), {
22401
- bandPosition: this._bandPosition
22402
- }), scale),
22403
- close: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._closeField), {
22404
- bandPosition: this._bandPosition
22405
- }), scale)
22406
- }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
22407
- }
22835
+ getMeasureField() {
22836
+ return [this._valueField];
22408
22837
  }
22409
- init(option) {
22410
- super.init(option);
22411
- this.initCandlestickMarkStyle();
22838
+ getStatisticFields() {
22839
+ const fields = [];
22840
+ fields.push({ key: this._nameField, operations: ['values'] });
22841
+ fields.push({ key: this._valueField, operations: ['max', 'min'] });
22842
+ return fields;
22412
22843
  }
22413
- _initAnimationSpec(config = {}) {
22414
- const newConfig = merge({}, config);
22415
- ['appear', 'enter', 'update', 'exit', 'disappear'].forEach(state => {
22416
- if (newConfig[state] && newConfig[state].type === 'scaleIn') {
22417
- newConfig[state].type = 'candlestickScaleIn';
22418
- }
22419
- else if (newConfig[state] && newConfig[state].type === 'scaleOut') {
22420
- newConfig[state].type = 'candlestickScaleOut';
22421
- }
22422
- });
22423
- return newConfig;
22844
+ getActiveMarks() {
22845
+ return [this._imageMark];
22424
22846
  }
22425
- initAnimation() {
22847
+ getMarkData(datum) {
22426
22848
  var _a;
22427
- const animationParams = vchart.getGroupAnimationParams(this);
22428
- if (this._candlestickMark) {
22429
- const newDefaultConfig = this._initAnimationSpec((_a = vchart.Factory.getAnimationInKey('scaleInOut')) === null || _a === void 0 ? void 0 : _a());
22430
- const newConfig = this._initAnimationSpec(vchart.userAnimationConfig(CANDLESTICK_SERIES_TYPE, this._spec, this._markAttributeContext));
22431
- this._candlestickMark.setAnimationConfig(vchart.animationConfig(newDefaultConfig, newConfig, animationParams));
22432
- }
22849
+ return (_a = datum === null || datum === void 0 ? void 0 : datum.datum) !== null && _a !== void 0 ? _a : datum;
22433
22850
  }
22434
- initTooltip() {
22435
- this._tooltipHelper = new CandlestickSeriesTooltipHelper(this);
22436
- this._candlestickMark && this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark);
22851
+ getGroupFields() {
22852
+ return [];
22437
22853
  }
22438
- _buildMergedStyles(baseStyle, risingStyle, fallingStyle, dojiStyle) {
22439
- this._mergedStyles.rising = merge({}, baseStyle, risingStyle);
22440
- this._mergedStyles.falling = merge({}, baseStyle, fallingStyle);
22441
- this._mergedStyles.doji = merge({}, baseStyle, dojiStyle);
22854
+ dataToPosition(data) {
22855
+ return null;
22442
22856
  }
22443
- mergeStyle(datum) {
22444
- const open = this.getDatumPositionValues(datum, this._openField)[0];
22445
- const close = this.getDatumPositionValues(datum, this._closeField)[0];
22446
- if (open < close) {
22447
- return this._mergedStyles.rising;
22448
- }
22449
- else if (open > close) {
22450
- return this._mergedStyles.falling;
22451
- }
22452
- else {
22453
- return this._mergedStyles.doji;
22454
- }
22857
+ dataToPositionX(data) {
22858
+ var _a;
22859
+ return (_a = this.dataToPosition(data)) === null || _a === void 0 ? void 0 : _a.x;
22455
22860
  }
22456
- _getMarkWidth() {
22457
- if (this._autoBoxWidth) {
22458
- return this._autoBoxWidth;
22459
- }
22460
- const bandAxisHelper = this._xAxisHelper;
22461
- const xField = this._fieldX;
22462
- const innerBandWidth = bandAxisHelper.getBandwidth(xField.length - 1);
22463
- const autoBoxWidth = innerBandWidth / xField.length;
22464
- this._autoBoxWidth = autoBoxWidth;
22465
- return this._autoBoxWidth;
22861
+ dataToPositionY(data) {
22862
+ var _a;
22863
+ return (_a = this.dataToPosition(data)) === null || _a === void 0 ? void 0 : _a.y;
22466
22864
  }
22467
- onLayoutEnd() {
22468
- super.onLayoutEnd();
22469
- this._autoBoxWidth = null;
22865
+ valueToPosition(value1, value2) {
22866
+ return null;
22470
22867
  }
22471
- getActiveMarks() {
22472
- return [this._candlestickMark];
22868
+ getStackGroupFields() {
22869
+ return [];
22870
+ }
22871
+ getStackValueField() {
22872
+ return '';
22473
22873
  }
22474
22874
  }
22475
- CandlestickSeries.type = CANDLESTICK_SERIES_TYPE;
22476
- CandlestickSeries.builtInTheme = { candlestick };
22477
- CandlestickSeries.mark = CandlestickSeriesMark;
22478
- const registerCandlestickSeries = () => {
22479
- registerCandlestickMark();
22480
- vchart.registerSymbolMark();
22481
- vchart.registerScaleInOutAnimation();
22482
- vchart.registerCartesianBandAxis();
22483
- vchart.registerCartesianLinearAxis();
22484
- registerCandlestickScaleAnimation();
22485
- vchart.Factory.registerSeries(CandlestickSeries.type, CandlestickSeries);
22875
+ ImageCloudSeries.type = IMAGE_CLOUD_SERIES_TYPE;
22876
+ ImageCloudSeries.mark = imageCloudSeriesMark;
22877
+ const registerImageCloudSeries = () => {
22878
+ vchart.registerImageMark();
22879
+ registerImageCloudAnimation();
22880
+ vchart.Factory.registerSeries(ImageCloudSeries.type, ImageCloudSeries);
22881
+ vchart.Factory.registerGrammarTransform('imagecloud', {
22882
+ transform: transform
22883
+ });
22486
22884
  };
22487
22885
 
22488
- class CandlestickChart extends vchart.BaseChart {
22489
- _setModelOption() {
22490
- this._modelOption.getDimensionInfo = vchart.getCartesianDimensionInfo;
22491
- this._modelOption.getDimensionInfoByValue = vchart.getDimensionInfoByValue;
22492
- this._modelOption.getRectByDimensionData = vchart.getCartesianCrosshairRect;
22886
+ class ImageCloudChart extends vchart.BaseChart {
22887
+ constructor() {
22888
+ super(...arguments);
22889
+ this.transformerConstructor = ImageCloudChart.transformerConstructor;
22890
+ this.type = IMAGE_CLOUD_CHART_TYPE;
22891
+ this.seriesType = IMAGE_CLOUD_SERIES_TYPE;
22493
22892
  }
22494
22893
  }
22495
- CandlestickChart.type = CANDLESTICK_CHART_TYPE;
22496
- CandlestickChart.seriesType = CANDLESTICK_SERIES_TYPE;
22497
- CandlestickChart.transformerConstructor = CandlestickChartSpecTransformer;
22498
- const registerCandlestickChart = () => {
22499
- vchart.registerDimensionTooltipProcessor();
22500
- vchart.registerMarkTooltipProcessor();
22501
- vchart.registerDimensionEvents();
22502
- vchart.registerDimensionHover();
22503
- registerCandlestickSeries();
22504
- vchart.Factory.registerChart(CandlestickChart.type, CandlestickChart);
22894
+ ImageCloudChart.type = IMAGE_CLOUD_CHART_TYPE;
22895
+ ImageCloudChart.seriesType = IMAGE_CLOUD_SERIES_TYPE;
22896
+ ImageCloudChart.transformerConstructor = ImageCloudChartSpecTransformer;
22897
+ const registerImageCloudChart = () => {
22898
+ registerImageCloudSeries();
22899
+ vchart.Factory.registerChart(ImageCloudChart.type, ImageCloudChart);
22505
22900
  };
22506
22901
 
22507
22902
  const GROUP_ATTRIBUTES = ["x", "y", "dx", "dy", "scaleX", "scaleY", "angle", "anchor", "postMatrix", "visible", "clip", "pickable", "childrenPickable", "zIndex", "cursor"];
@@ -25576,8 +25971,12 @@
25576
25971
  exports.BarLinkComponent = BarLinkComponent;
25577
25972
  exports.CandlestickChart = CandlestickChart;
25578
25973
  exports.CandlestickChartSpecTransformer = CandlestickChartSpecTransformer;
25974
+ exports.CandlestickSeries = CandlestickSeries;
25975
+ exports.CombinationCandlestickChart = CombinationCandlestickChart;
25976
+ exports.CombinationCandlestickChart_TYPE = CombinationCandlestickChart_TYPE;
25579
25977
  exports.ConversionFunnelChart = ConversionFunnelChart;
25580
25978
  exports.ConversionFunnelSeries = ConversionFunnelSeries;
25979
+ exports.DEFAULT_STROKE_COLOR = DEFAULT_STROKE_COLOR;
25581
25980
  exports.DefaultBandWidth = DefaultBandWidth;
25582
25981
  exports.Funnel3dChart = Funnel3dChart;
25583
25982
  exports.Funnel3dSeries = Funnel3dSeries;
@@ -25621,6 +26020,8 @@
25621
26020
  exports.registerBar3dSeries = registerBar3dSeries;
25622
26021
  exports.registerBarLink = registerBarLink;
25623
26022
  exports.registerCandlestickChart = registerCandlestickChart;
26023
+ exports.registerCandlestickSeries = registerCandlestickSeries;
26024
+ exports.registerCombinationCandlestickChart = registerCombinationCandlestickChart;
25624
26025
  exports.registerConversionFunnelChart = registerConversionFunnelChart;
25625
26026
  exports.registerFunnel3dChart = registerFunnel3dChart;
25626
26027
  exports.registerFunnel3dSeries = registerFunnel3dSeries;
@@ -25646,6 +26047,7 @@
25646
26047
  exports.registerWordCloudShape3dChart = registerWordCloudShape3dChart;
25647
26048
  exports.registerWordCloudShape3dSeries = registerWordCloudShape3dSeries;
25648
26049
  exports.svgSourceMap = svgSourceMap;
26050
+ exports.transformCandlestickSeriesSpec = transformCandlestickSeriesSpec;
25649
26051
  exports.unregisterSVGSource = unregisterSVGSource;
25650
26052
 
25651
26053
  }));