@visactor/vchart 2.1.3-alpha.4 → 2.1.3

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 (84) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +140 -49
  3. package/build/index.js +160 -52
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/index.js +1 -1
  7. package/cjs/chart/stack.js +1 -1
  8. package/cjs/chart/util.js +1 -1
  9. package/cjs/compile/compiler.d.ts +2 -0
  10. package/cjs/compile/compiler.js +23 -8
  11. package/cjs/compile/compiler.js.map +1 -1
  12. package/cjs/compile/interface/compiler.d.ts +1 -0
  13. package/cjs/compile/interface/compiler.js.map +1 -1
  14. package/cjs/compile/state-manager.js +1 -2
  15. package/cjs/component/poptip/index.js +5 -2
  16. package/cjs/component/poptip/index.js.map +1 -1
  17. package/cjs/component/util.js +2 -1
  18. package/cjs/constant/marker.js +1 -2
  19. package/cjs/constant/scroll-bar.js +2 -1
  20. package/cjs/core/factory-registry.d.ts +2 -1
  21. package/cjs/core/factory-registry.js +4 -2
  22. package/cjs/core/factory-registry.js.map +1 -1
  23. package/cjs/core/factory.d.ts +4 -1
  24. package/cjs/core/factory.js +5 -2
  25. package/cjs/core/factory.js.map +1 -1
  26. package/cjs/core/index.d.ts +1 -1
  27. package/cjs/core/index.js +2 -2
  28. package/cjs/core/index.js.map +1 -1
  29. package/cjs/core/vchart.js +9 -3
  30. package/cjs/core/vchart.js.map +1 -1
  31. package/cjs/data/transforms/funnel.js +9 -4
  32. package/cjs/data/transforms/funnel.js.map +1 -1
  33. package/cjs/interaction/interaction.d.ts +2 -0
  34. package/cjs/interaction/interaction.js +19 -11
  35. package/cjs/interaction/interaction.js.map +1 -1
  36. package/cjs/mark/glyph.d.ts +1 -1
  37. package/cjs/mark/glyph.js +7 -6
  38. package/cjs/mark/glyph.js.map +1 -1
  39. package/cjs/series/base/base-series.js +1 -1
  40. package/cjs/series/base/base-series.js.map +1 -1
  41. package/cjs/series/funnel/interface.js.map +1 -1
  42. package/cjs/series/sankey/sankey.d.ts +3 -0
  43. package/cjs/series/sankey/sankey.js +26 -16
  44. package/cjs/series/sankey/sankey.js.map +1 -1
  45. package/esm/chart/index.js +1 -1
  46. package/esm/chart/stack.js +1 -1
  47. package/esm/chart/util.js +1 -1
  48. package/esm/compile/compiler.d.ts +2 -0
  49. package/esm/compile/compiler.js +24 -7
  50. package/esm/compile/compiler.js.map +1 -1
  51. package/esm/compile/interface/compiler.d.ts +1 -0
  52. package/esm/compile/interface/compiler.js.map +1 -1
  53. package/esm/compile/state-manager.js +1 -2
  54. package/esm/component/poptip/index.js +8 -2
  55. package/esm/component/poptip/index.js.map +1 -1
  56. package/esm/component/util.js +2 -1
  57. package/esm/constant/marker.js +1 -2
  58. package/esm/constant/scroll-bar.js +2 -1
  59. package/esm/core/factory-registry.d.ts +2 -1
  60. package/esm/core/factory-registry.js +4 -2
  61. package/esm/core/factory-registry.js.map +1 -1
  62. package/esm/core/factory.d.ts +4 -1
  63. package/esm/core/factory.js +4 -2
  64. package/esm/core/factory.js.map +1 -1
  65. package/esm/core/index.d.ts +1 -1
  66. package/esm/core/index.js +2 -2
  67. package/esm/core/index.js.map +1 -1
  68. package/esm/core/vchart.js +9 -3
  69. package/esm/core/vchart.js.map +1 -1
  70. package/esm/data/transforms/funnel.js +8 -5
  71. package/esm/data/transforms/funnel.js.map +1 -1
  72. package/esm/interaction/interaction.d.ts +2 -0
  73. package/esm/interaction/interaction.js +19 -11
  74. package/esm/interaction/interaction.js.map +1 -1
  75. package/esm/mark/glyph.d.ts +1 -1
  76. package/esm/mark/glyph.js +7 -6
  77. package/esm/mark/glyph.js.map +1 -1
  78. package/esm/series/base/base-series.js +1 -1
  79. package/esm/series/base/base-series.js.map +1 -1
  80. package/esm/series/funnel/interface.js.map +1 -1
  81. package/esm/series/sankey/sankey.d.ts +3 -0
  82. package/esm/series/sankey/sankey.js +26 -15
  83. package/esm/series/sankey/sankey.js.map +1 -1
  84. package/package.json +9 -9
package/build/index.es.js CHANGED
@@ -70,7 +70,7 @@ import { linearDiscreteTicks } from '@visactor/vrender-components/axis/tick-data
70
70
  import { LineAxisGrid } from '@visactor/vrender-components/axis/grid/line';
71
71
  import { LineAxis } from '@visactor/vrender-components/axis/line';
72
72
  import { continuousTicks } from '@visactor/vrender-components/axis/tick-data/continuous';
73
- import { continuousTicks as continuousTicks$1, LineAxis as LineAxis$1, LineAxisGrid as LineAxisGrid$1, CircleAxis, CircleAxisGrid, polarAngleAxisDiscreteTicks, registerSymbolDataLabel as registerSymbolDataLabel$1, labelSmartInvert, loadScrollbar, ColorContinuousLegend, SizeContinuousLegend, LineCrosshair as LineCrosshair$1, SectorCrosshair, PolygonCrosshair, CircleCrosshair, DataZoom as DataZoom$1, ScrollBar as ScrollBar$1, Indicator as Indicator$1, MarkLine, registerMarkLineAnimate, MarkArcLine, registerMarkArcLineAnimate, Title as Title$1, MarkArea, registerMarkAreaAnimate, MarkArcArea, registerMarkArcAreaAnimate, DiscretePlayer, ContinuousPlayer, PlayerEventEnum, DataLabel as DataLabel$1, MarkPoint, registerMarkPointAnimate, Brush as Brush$1, IOperateType, loadPoptip } from '@visactor/vrender-components';
73
+ import { continuousTicks as continuousTicks$1, LineAxis as LineAxis$1, LineAxisGrid as LineAxisGrid$1, CircleAxis, CircleAxisGrid, polarAngleAxisDiscreteTicks, registerSymbolDataLabel as registerSymbolDataLabel$1, labelSmartInvert, loadScrollbar, ColorContinuousLegend, SizeContinuousLegend, LineCrosshair as LineCrosshair$1, SectorCrosshair, PolygonCrosshair, CircleCrosshair, DataZoom as DataZoom$1, ScrollBar as ScrollBar$1, Indicator as Indicator$1, MarkLine, registerMarkLineAnimate, MarkArcLine, registerMarkArcLineAnimate, Title as Title$1, MarkArea, registerMarkAreaAnimate, MarkArcArea, registerMarkArcAreaAnimate, DiscretePlayer, ContinuousPlayer, PlayerEventEnum, DataLabel as DataLabel$1, MarkPoint, registerMarkPointAnimate, Brush as Brush$1, IOperateType } from '@visactor/vrender-components';
74
74
  export { AbstractComponent, MarkPoint, Segment } from '@visactor/vrender-components';
75
75
  import { registerRectDataLabel, registerArcDataLabel, DataLabel } from '@visactor/vrender-components/label';
76
76
  import { getTextBounds, getRichTextBounds } from '@visactor/vrender-core/text';
@@ -79,6 +79,7 @@ import { DiscreteLegend as DiscreteLegend$1 } from '@visactor/vrender-components
79
79
  import { LineCrosshair } from '@visactor/vrender-components/crosshair/line';
80
80
  import { RectCrosshair } from '@visactor/vrender-components/crosshair/rect';
81
81
  import { Tag } from '@visactor/vrender-components/tag';
82
+ import { installPoptipToApp, loadPoptip } from '@visactor/vrender-components/poptip';
82
83
  import { Symbol as Symbol$1 } from '@visactor/vrender-core/graphic/symbol';
83
84
  import { GradientParser } from '@visactor/vrender-core/svg';
84
85
  import { Tooltip as Tooltip$1 } from '@visactor/vrender-components/tooltip';
@@ -11397,6 +11398,13 @@ Factory.createTooltipProcessor = (type, tooltip) => {
11397
11398
  }
11398
11399
  return new Cror(tooltip);
11399
11400
  };
11401
+ Factory._runtimePluginInstallers = factoryRegistry.runtimePluginInstallers;
11402
+ Factory.registerRuntimePluginInstaller = (type, installer) => {
11403
+ Factory._runtimePluginInstallers[type] = installer;
11404
+ };
11405
+ Factory.getRuntimePluginInstaller = (type) => {
11406
+ return Factory._runtimePluginInstallers[type];
11407
+ };
11400
11408
 
11401
11409
  function mergeTheme(target, ...sources) {
11402
11410
  return mergeSpec(transformThemeToMerge(target), ...sources.map(transformThemeToMerge));
@@ -13394,6 +13402,7 @@ const resolveVRenderApp = (appOrOptions, mode) => {
13394
13402
  };
13395
13403
  const createStageFromApp = (app, params) => app.createStage(params);
13396
13404
 
13405
+ const POPTIP_FOR_TEXT_PLUGIN_NAME = 'poptipForText';
13397
13406
  class Compiler {
13398
13407
  get stateAnimationConfig() {
13399
13408
  return this._stateAnimationConfig;
@@ -13458,8 +13467,36 @@ class Compiler {
13458
13467
  getStage() {
13459
13468
  return this._stage;
13460
13469
  }
13470
+ _dedupeStagePlugin(pluginName) {
13471
+ var _a;
13472
+ const pluginService = (_a = this._stage) === null || _a === void 0 ? void 0 : _a.pluginService;
13473
+ if (!(pluginService === null || pluginService === void 0 ? void 0 : pluginService.findPluginsByName)) {
13474
+ return;
13475
+ }
13476
+ const plugins = pluginService.findPluginsByName(pluginName);
13477
+ if (plugins.length <= 1) {
13478
+ return;
13479
+ }
13480
+ const plugin = plugins[0];
13481
+ if (pluginService.uninstall) {
13482
+ pluginService.uninstall(pluginName);
13483
+ pluginService.register(plugin);
13484
+ }
13485
+ else {
13486
+ plugins.slice(1).forEach(duplicatePlugin => {
13487
+ pluginService.unRegister(duplicatePlugin);
13488
+ });
13489
+ }
13490
+ }
13491
+ _dedupePoptipPlugin() {
13492
+ var _a;
13493
+ if (!((_a = this._option.pluginList) === null || _a === void 0 ? void 0 : _a.includes(POPTIP_FOR_TEXT_PLUGIN_NAME))) {
13494
+ return;
13495
+ }
13496
+ this._dedupeStagePlugin(POPTIP_FOR_TEXT_PLUGIN_NAME);
13497
+ }
13461
13498
  initView() {
13462
- var _a, _b, _c, _d;
13499
+ var _a, _b, _c, _d, _e;
13463
13500
  if (this._released) {
13464
13501
  return;
13465
13502
  }
@@ -13481,22 +13518,24 @@ class Compiler {
13481
13518
  modeParams
13482
13519
  });
13483
13520
  this._releaseVRenderAppRef = resolvedApp.releaseAppRef;
13521
+ (_a = this._option.runtimePluginInstallers) === null || _a === void 0 ? void 0 : _a.forEach(install => install(resolvedApp.app));
13484
13522
  try {
13485
- this._stage = createStageFromApp(resolvedApp.app, Object.assign({ background, width: this._width, height: this._height, container: (_a = this._container.dom) !== null && _a !== void 0 ? _a : null, canvas: (_b = this._container.canvas) !== null && _b !== void 0 ? _b : null, dpr, viewBox: this._option.viewBox, canvasControled: this._option.canvasControled, beforeRender: (stage) => {
13523
+ this._stage = createStageFromApp(resolvedApp.app, Object.assign({ background, width: this._width, height: this._height, container: (_b = this._container.dom) !== null && _b !== void 0 ? _b : null, canvas: (_c = this._container.canvas) !== null && _c !== void 0 ? _c : null, dpr, viewBox: this._option.viewBox, canvasControled: this._option.canvasControled, beforeRender: (stage) => {
13486
13524
  var _a, _b, _c;
13487
13525
  (_a = this._compileChart) === null || _a === void 0 ? void 0 : _a.onBeforeRender();
13488
13526
  (_c = (_b = this._option).beforeRender) === null || _c === void 0 ? void 0 : _c.call(_b, stage);
13489
13527
  }, afterRender: this._option.afterRender, disableDirtyBounds: true, autoRender: true, ticker: this._option.ticker, pluginList: this._option.pluginList, enableHtmlAttribute: this._option.enableHtmlAttribute, optimize: this._option.optimize, supportsTouchEvents: this._option.supportsTouchEvents, supportsPointerEvents: this._option.supportsPointerEvents, event: {
13490
13528
  clickInterval: clickInterval,
13491
13529
  autoPreventDefault: autoPreventDefault
13492
- }, ReactDOM: this._option.ReactDOM, autoRefresh: isValid$1(autoRefreshDpr) ? autoRefreshDpr : !isValid$1(dpr) }, ((_c = this._option.renderHooks) !== null && _c !== void 0 ? _c : {})));
13530
+ }, ReactDOM: this._option.ReactDOM, autoRefresh: isValid$1(autoRefreshDpr) ? autoRefreshDpr : !isValid$1(dpr) }, ((_d = this._option.renderHooks) !== null && _d !== void 0 ? _d : {})));
13493
13531
  }
13494
13532
  catch (error) {
13495
- (_d = this._releaseVRenderAppRef) === null || _d === void 0 ? void 0 : _d.call(this);
13533
+ (_e = this._releaseVRenderAppRef) === null || _e === void 0 ? void 0 : _e.call(this);
13496
13534
  this._releaseVRenderAppRef = undefined;
13497
13535
  throw error;
13498
13536
  }
13499
13537
  }
13538
+ this._dedupePoptipPlugin();
13500
13539
  this._stage.enableIncrementalAutoRender();
13501
13540
  this._stage.setTheme({
13502
13541
  symbol: {
@@ -19435,7 +19474,13 @@ class VChart {
19435
19474
  this._updateCurrentTheme();
19436
19475
  this._currentSize = this.getCurrentSize();
19437
19476
  const pluginList = [];
19477
+ const runtimePluginInstallers = [];
19438
19478
  if (poptip !== false) {
19479
+ const poptipInstaller = Factory.getRuntimePluginInstaller('poptipForText');
19480
+ if (poptipInstaller) {
19481
+ poptipInstaller();
19482
+ runtimePluginInstallers.push(poptipInstaller);
19483
+ }
19439
19484
  pluginList.push('poptipForText');
19440
19485
  }
19441
19486
  if (spec.type === "sankey") {
@@ -19453,7 +19498,8 @@ class VChart {
19453
19498
  dom: (_e = this._container) !== null && _e !== void 0 ? _e : 'none',
19454
19499
  canvas: renderCanvas
19455
19500
  }, Object.assign(Object.assign({ mode: this._option.mode, stage,
19456
- pluginList }, restOptions), { background: this._getBackground(), onError: this._onError }));
19501
+ pluginList,
19502
+ runtimePluginInstallers }, restOptions), { background: this._getBackground(), onError: this._onError }));
19457
19503
  this._compiler.setSize(this._currentSize.width, this._currentSize.height);
19458
19504
  this._eventDispatcher = new EventDispatcher(this, this._compiler);
19459
19505
  this._event = new Event(this._eventDispatcher, mode);
@@ -20744,7 +20790,7 @@ const lookup = (data, opt) => {
20744
20790
  });
20745
20791
  };
20746
20792
 
20747
- const version = "2.1.1";
20793
+ const version = "2.1.3";
20748
20794
 
20749
20795
  const addVChartProperty = (data, op) => {
20750
20796
  const context = op.beforeCall();
@@ -22538,6 +22584,7 @@ class BaseSeries extends BaseModel {
22538
22584
  this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
22539
22585
  });
22540
22586
  this.initMarkStyle();
22587
+ this.initMarkState();
22541
22588
  marks.forEach(mark => {
22542
22589
  mark.commit(false);
22543
22590
  });
@@ -28547,11 +28594,28 @@ class Interaction {
28547
28594
  getStatedGraphics(trigger) {
28548
28595
  return this._stateGraphicsByTrigger.get(trigger);
28549
28596
  }
28597
+ _getMarkById(trigger) {
28598
+ const markById = new Map();
28599
+ trigger.getMarks().forEach(mark => {
28600
+ if (mark) {
28601
+ markById.set(mark.id, mark);
28602
+ }
28603
+ });
28604
+ return markById;
28605
+ }
28606
+ _hasAnimationByGraphicState(graphic, markById) {
28607
+ var _a, _b, _c;
28608
+ const mark = (_b = (_a = graphic.parent) === null || _a === void 0 ? void 0 : _a.mark) !== null && _b !== void 0 ? _b : markById.get(graphic.context.markId);
28609
+ return !!((_c = mark === null || mark === void 0 ? void 0 : mark.hasAnimationByState) === null || _c === void 0 ? void 0 : _c.call(mark, 'state'));
28610
+ }
28550
28611
  updateStates(trigger, newStatedGraphics, prevStatedGraphics, state, reverseState) {
28551
28612
  if (this._disableTriggerEvent) {
28552
28613
  return [];
28553
28614
  }
28554
28615
  if (!newStatedGraphics || !newStatedGraphics.length) {
28616
+ if (prevStatedGraphics && prevStatedGraphics.length) {
28617
+ this.clearAllStatesOfTrigger(trigger, state, reverseState);
28618
+ }
28555
28619
  return [];
28556
28620
  }
28557
28621
  if (state && reverseState) {
@@ -28575,42 +28639,36 @@ class Interaction {
28575
28639
  }
28576
28640
  toggleReverseStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, reverseState) {
28577
28641
  const markIdByState = trigger.getMarkIdByState();
28642
+ const markById = this._getMarkById(trigger);
28578
28643
  prevStatedGraphics.forEach(g => {
28579
- var _a;
28580
28644
  const hasReverse = reverseState && markIdByState[reverseState] && markIdByState[reverseState].includes(g.context.markId);
28581
28645
  if (hasReverse) {
28582
- const m = (_a = g.parent) === null || _a === void 0 ? void 0 : _a.mark;
28583
- const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
28646
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
28584
28647
  addGraphicState(g, reverseState, true, hasAnimation);
28585
28648
  }
28586
28649
  });
28587
28650
  newStatedGraphics.forEach(g => {
28588
- var _a;
28589
28651
  const hasReverse = reverseState && markIdByState[reverseState] && markIdByState[reverseState].includes(g.context.markId);
28590
28652
  if (hasReverse) {
28591
- const m = (_a = g.parent) === null || _a === void 0 ? void 0 : _a.mark;
28592
- const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
28653
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
28593
28654
  removeGraphicState(g, reverseState, hasAnimation);
28594
28655
  }
28595
28656
  });
28596
28657
  }
28597
28658
  toggleStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, state) {
28598
28659
  const markIdByState = trigger.getMarkIdByState();
28660
+ const markById = this._getMarkById(trigger);
28599
28661
  prevStatedGraphics.forEach(g => {
28600
- var _a;
28601
28662
  const hasState = state && markIdByState[state] && markIdByState[state].includes(g.context.markId);
28602
28663
  if (hasState) {
28603
- const m = (_a = g.parent) === null || _a === void 0 ? void 0 : _a.mark;
28604
- const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
28664
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
28605
28665
  removeGraphicState(g, state, hasAnimation);
28606
28666
  }
28607
28667
  });
28608
28668
  newStatedGraphics.forEach(g => {
28609
- var _a;
28610
28669
  const hasState = state && markIdByState[state] && markIdByState[state].includes(g.context.markId);
28611
28670
  if (hasState) {
28612
- const m = (_a = g.parent) === null || _a === void 0 ? void 0 : _a.mark;
28613
- const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
28671
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
28614
28672
  addGraphicState(g, state, true, hasAnimation);
28615
28673
  }
28616
28674
  });
@@ -36098,7 +36156,7 @@ const GLYPH_STATE_ATTRIBUTE_UPDATE_TYPE = 2;
36098
36156
  class GlyphMark extends BaseMark {
36099
36157
  constructor() {
36100
36158
  super(...arguments);
36101
- this._setStateOfGraphic = (g) => {
36159
+ this._setStateOfGraphic = (g, hasAnimation) => {
36102
36160
  g.clearStates();
36103
36161
  if (g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update) {
36104
36162
  g.glyphStateProxy = (stateName, nexStates) => {
@@ -36114,7 +36172,7 @@ class GlyphMark extends BaseMark {
36114
36172
  }
36115
36173
  return glyphAttrs;
36116
36174
  };
36117
- g.useStates(g.context.states);
36175
+ g.useStates(g.context.states, hasAnimation);
36118
36176
  }
36119
36177
  };
36120
36178
  }
@@ -36193,12 +36251,13 @@ class GlyphMark extends BaseMark {
36193
36251
  _createGraphic(attrs = {}) {
36194
36252
  const glyph = createGlyph(attrs);
36195
36253
  glyph.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(glyph);
36196
- glyph.addEventListener('afterAttributeUpdate', (event) => {
36197
- var _a;
36198
- if (((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.type) === GLYPH_STATE_ATTRIBUTE_UPDATE_TYPE) {
36254
+ const onAttributeUpdate = glyph.onAttributeUpdate.bind(glyph);
36255
+ glyph.onAttributeUpdate = (context) => {
36256
+ onAttributeUpdate(context);
36257
+ if ((context === null || context === void 0 ? void 0 : context.type) === GLYPH_STATE_ATTRIBUTE_UPDATE_TYPE) {
36199
36258
  this._syncInheritedStyleAttrs(glyph, glyph.attribute);
36200
36259
  }
36201
- });
36260
+ };
36202
36261
  const subMarks = this._subMarks;
36203
36262
  if (subMarks) {
36204
36263
  const subGraphics = [];
@@ -47176,14 +47235,26 @@ const funnel = (originData, op) => {
47176
47235
  if (!data || data.length === 0) {
47177
47236
  return data;
47178
47237
  }
47179
- const { asTransformRatio, asReachRatio, asHeightRatio, asValueRatio, asNextValueRatio, asLastValueRatio, asLastValue, asCurrentValue, asNextValue, } = op;
47238
+ const { asTransformRatio, asReachRatio, asHeightRatio, asValueRatio, asNextValueRatio, asLastValueRatio, asLastValue, asCurrentValue, asNextValue } = op;
47180
47239
  const valueField = resolveOptionValue$2(op.valueField);
47181
47240
  const heightVisual = (_a = resolveOptionValue$2(op.heightVisual)) !== null && _a !== void 0 ? _a : false;
47182
47241
  const isCone = (_b = resolveOptionValue$2(op.isCone)) !== null && _b !== void 0 ? _b : true;
47183
47242
  const range = resolveOptionValue$2(op.range);
47184
- const max = data.reduce((m, d) => Math.max(m, Number.parseFloat(d[valueField]) || -Infinity), -Infinity);
47185
- const min = data.reduce((m, d) => Math.min(m, Number.parseFloat(d[valueField]) || Infinity), Infinity);
47186
- const rangeArr = [(_c = range === null || range === void 0 ? void 0 : range.min) !== null && _c !== void 0 ? _c : min, (_d = range === null || range === void 0 ? void 0 : range.max) !== null && _d !== void 0 ? _d : max];
47243
+ const max = data.reduce((m, d) => {
47244
+ const value = Number.parseFloat(d[valueField]);
47245
+ return isValidNumber$1(value) ? Math.max(m, value) : m;
47246
+ }, -Infinity);
47247
+ const rangeMin = (_c = range === null || range === void 0 ? void 0 : range.min) !== null && _c !== void 0 ? _c : 0;
47248
+ const rangeMax = (_d = range === null || range === void 0 ? void 0 : range.max) !== null && _d !== void 0 ? _d : max;
47249
+ const getValueRatio = (value) => {
47250
+ if (!isValidNumber$1(value) || !isValidNumber$1(rangeMin) || !isValidNumber$1(rangeMax)) {
47251
+ return 0;
47252
+ }
47253
+ if (rangeMin === rangeMax) {
47254
+ return value < rangeMin ? 0 : 1;
47255
+ }
47256
+ return clamp$1((value - rangeMin) / (rangeMax - rangeMin), 0, 1);
47257
+ };
47187
47258
  data.forEach((d, i) => {
47188
47259
  var _a, _b;
47189
47260
  const currentValue = Number.parseFloat(d[valueField]);
@@ -47191,15 +47262,16 @@ const funnel = (originData, op) => {
47191
47262
  const nextValue = Number.parseFloat((_b = data[i + 1]) === null || _b === void 0 ? void 0 : _b[valueField]);
47192
47263
  const transformRatio = !isValidNumber$1(nextValue * currentValue) || currentValue === 0 ? 0 : nextValue / currentValue;
47193
47264
  const reachRatio = !isValidNumber$1(currentValue * lastValue) || lastValue === 0 ? 0 : currentValue / lastValue;
47265
+ const valueRatio = getValueRatio(currentValue);
47194
47266
  asLastValue && (d[asLastValue] = lastValue);
47195
47267
  asNextValue && (d[asNextValue] = nextValue);
47196
47268
  asTransformRatio && (d[asTransformRatio] = transformRatio);
47197
47269
  asReachRatio && (d[asReachRatio] = i === 0 ? 1 : reachRatio);
47198
47270
  asHeightRatio && (d[asHeightRatio] = heightVisual === true ? transformRatio : 1 / data.length);
47199
- asValueRatio && (d[asValueRatio] = currentValue / rangeArr[1]);
47271
+ asValueRatio && (d[asValueRatio] = valueRatio);
47200
47272
  asNextValueRatio &&
47201
- (d[asNextValueRatio] = i === data.length - 1 ? (isCone ? 0 : d[asValueRatio]) : nextValue / rangeArr[1]);
47202
- asLastValueRatio && (d[asLastValueRatio] = i === 0 ? 1 : lastValue / rangeArr[1]);
47273
+ (d[asNextValueRatio] = i === data.length - 1 ? (isCone ? 0 : d[asValueRatio]) : getValueRatio(nextValue));
47274
+ asLastValueRatio && (d[asLastValueRatio] = i === 0 ? 1 : getValueRatio(lastValue));
47203
47275
  asCurrentValue && (d[asCurrentValue] = currentValue);
47204
47276
  });
47205
47277
  return data;
@@ -49390,18 +49462,18 @@ class SankeySeries extends CartesianSeries {
49390
49462
  highlightNodes.push(linkDatum.target);
49391
49463
  }
49392
49464
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
49393
- addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
49465
+ addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasLinkStateAnimation());
49394
49466
  }
49395
49467
  else if (linkDatum.target === nodeDatum.key) {
49396
49468
  if (!highlightNodes.includes(linkDatum.source)) {
49397
49469
  highlightNodes.push(linkDatum.source);
49398
49470
  }
49399
49471
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
49400
- addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
49472
+ addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasLinkStateAnimation());
49401
49473
  }
49402
49474
  else {
49403
49475
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
49404
- addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
49476
+ addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
49405
49477
  }
49406
49478
  });
49407
49479
  }
@@ -49421,11 +49493,11 @@ class SankeySeries extends CartesianSeries {
49421
49493
  allLinkElements.forEach(linkEl => {
49422
49494
  if (linkEl === graphic) {
49423
49495
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
49424
- addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 });
49496
+ addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 }, true, this._hasLinkStateAnimation());
49425
49497
  }
49426
49498
  else {
49427
49499
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
49428
- addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
49500
+ addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
49429
49501
  }
49430
49502
  });
49431
49503
  }
@@ -49539,11 +49611,11 @@ class SankeySeries extends CartesianSeries {
49539
49611
  const linkDatum = getDatumOfGraphic(linkEl);
49540
49612
  if (highlightLinks.includes((_a = linkDatum.key) !== null && _a !== void 0 ? _a : linkDatum.index)) {
49541
49613
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
49542
- addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
49614
+ addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasLinkStateAnimation());
49543
49615
  }
49544
49616
  else {
49545
49617
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
49546
- addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
49618
+ addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
49547
49619
  }
49548
49620
  });
49549
49621
  }
@@ -49592,7 +49664,7 @@ class SankeySeries extends CartesianSeries {
49592
49664
  }, 0);
49593
49665
  const ratio = val / linkDatum.value;
49594
49666
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
49595
- addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio });
49667
+ addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio }, true, this._hasLinkStateAnimation());
49596
49668
  return;
49597
49669
  }
49598
49670
  if (upSelectedLink) {
@@ -49605,11 +49677,11 @@ class SankeySeries extends CartesianSeries {
49605
49677
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
49606
49678
  addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
49607
49679
  ratio: upSelectedLink.value / linkDatum.value
49608
- });
49680
+ }, true, this._hasLinkStateAnimation());
49609
49681
  return;
49610
49682
  }
49611
49683
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
49612
- addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
49684
+ addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
49613
49685
  return;
49614
49686
  });
49615
49687
  if (this._nodeMark) {
@@ -49677,7 +49749,7 @@ class SankeySeries extends CartesianSeries {
49677
49749
  const originalDatum = linkDatum.datum;
49678
49750
  if (linkDatum.source === curLinkDatum.source && linkDatum.target === curLinkDatum.target) {
49679
49751
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
49680
- addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 });
49752
+ addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 }, true, this._hasLinkStateAnimation());
49681
49753
  return;
49682
49754
  }
49683
49755
  const selectedDatum = originalDatum
@@ -49705,7 +49777,7 @@ class SankeySeries extends CartesianSeries {
49705
49777
  }, 0);
49706
49778
  const ratio = val / linkDatum.value;
49707
49779
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
49708
- addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio });
49780
+ addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio }, true, this._hasLinkStateAnimation());
49709
49781
  return;
49710
49782
  }
49711
49783
  const upSelectedLink = upstreamLinks.find((upLink) => upLink.source === linkDatum.source && upLink.target === linkDatum.target);
@@ -49719,11 +49791,11 @@ class SankeySeries extends CartesianSeries {
49719
49791
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
49720
49792
  addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
49721
49793
  ratio: upSelectedLink.value / linkDatum.value
49722
- });
49794
+ }, true, this._hasLinkStateAnimation());
49723
49795
  return;
49724
49796
  }
49725
49797
  removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
49726
- addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
49798
+ addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
49727
49799
  return;
49728
49800
  });
49729
49801
  this._highLightElements(allNodeElements, highlightNodes);
@@ -49735,6 +49807,16 @@ class SankeySeries extends CartesianSeries {
49735
49807
  var _a;
49736
49808
  return (_a = this._spec.direction) !== null && _a !== void 0 ? _a : 'horizontal';
49737
49809
  }
49810
+ _hasStateAnimation(mark) {
49811
+ var _a;
49812
+ return isAnimationEnabledForSeries(this) && !!((_a = mark === null || mark === void 0 ? void 0 : mark.hasAnimationByState) === null || _a === void 0 ? void 0 : _a.call(mark, 'state'));
49813
+ }
49814
+ _hasLinkStateAnimation() {
49815
+ return this._hasStateAnimation(this._linkMark);
49816
+ }
49817
+ _hasNodeStateAnimation() {
49818
+ return this._hasStateAnimation(this._nodeMark);
49819
+ }
49738
49820
  getCategoryField() {
49739
49821
  return this._categoryField;
49740
49822
  }
@@ -50028,10 +50110,10 @@ class SankeySeries extends CartesianSeries {
50028
50110
  graphics.forEach(g => {
50029
50111
  removeGraphicState(g, [STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]);
50030
50112
  if (highlightNodes.includes(getDatumOfGraphic(g).key)) {
50031
- addGraphicState(g, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
50113
+ addGraphicState(g, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasNodeStateAnimation());
50032
50114
  }
50033
50115
  else {
50034
- addGraphicState(g, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
50116
+ addGraphicState(g, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasNodeStateAnimation());
50035
50117
  }
50036
50118
  });
50037
50119
  }
@@ -64996,8 +65078,17 @@ const registerGridLayout = () => {
64996
65078
  Factory.registerLayout(GridLayout.type, GridLayout);
64997
65079
  };
64998
65080
 
65081
+ const installPoptip = (app) => {
65082
+ if (app) {
65083
+ installPoptipToApp(app);
65084
+ }
65085
+ else {
65086
+ loadPoptip();
65087
+ }
65088
+ };
64999
65089
  const registerPoptip = () => {
65000
- loadPoptip();
65090
+ Factory.registerRuntimePluginInstaller('poptipForText', installPoptip);
65091
+ installPoptip();
65001
65092
  };
65002
65093
 
65003
65094
  const TOOLTIP_PREFIX = 'vchart-tooltip';