@visactor/vchart-extension 2.0.3-alpha.0 → 2.0.3-alpha.2

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 (134) hide show
  1. package/build/index.js +506 -407
  2. package/build/index.min.js +2 -2
  3. package/cjs/charts/axis-3d/axis-3d-mixin.js +48 -1
  4. package/cjs/charts/axis-3d/axis-3d-mixin.js.map +1 -1
  5. package/cjs/charts/axis-3d/linear-axis.js +2 -1
  6. package/cjs/charts/axis-3d/util.js +9 -8
  7. package/cjs/charts/axis-3d/util.js.map +1 -1
  8. package/cjs/charts/bar-3d/constant.js +1 -2
  9. package/cjs/charts/compare-sankey/compare-sankey-sub-data.d.ts +9 -0
  10. package/cjs/charts/compare-sankey/compare-sankey-sub-data.js +38 -0
  11. package/cjs/charts/compare-sankey/compare-sankey-sub-data.js.map +1 -0
  12. package/cjs/charts/compare-sankey/compare-sankey-sub-nodes.d.ts +2 -0
  13. package/cjs/charts/compare-sankey/compare-sankey-sub-nodes.js +20 -0
  14. package/cjs/charts/compare-sankey/compare-sankey-sub-nodes.js.map +1 -0
  15. package/cjs/charts/compare-sankey/compare-sankey-transformer.d.ts +6 -0
  16. package/cjs/charts/compare-sankey/compare-sankey-transformer.js +22 -0
  17. package/cjs/charts/compare-sankey/compare-sankey-transformer.js.map +1 -0
  18. package/cjs/charts/compare-sankey/compare-sankey.d.ts +35 -0
  19. package/cjs/charts/compare-sankey/compare-sankey.js +187 -0
  20. package/cjs/charts/compare-sankey/compare-sankey.js.map +1 -0
  21. package/cjs/charts/compare-sankey/constants.d.ts +1 -0
  22. package/cjs/charts/compare-sankey/constants.js +2 -0
  23. package/cjs/charts/compare-sankey/constants.js.map +1 -0
  24. package/cjs/charts/compare-sankey/index.d.ts +2 -0
  25. package/cjs/charts/compare-sankey/index.js +21 -0
  26. package/cjs/charts/compare-sankey/index.js.map +1 -0
  27. package/cjs/charts/compare-sankey/interface.d.ts +23 -0
  28. package/cjs/charts/{sequence-analysis → compare-sankey}/interface.js +1 -1
  29. package/cjs/charts/compare-sankey/interface.js.map +1 -0
  30. package/cjs/charts/compare-sankey/util.d.ts +1 -0
  31. package/cjs/charts/compare-sankey/util.js +2 -0
  32. package/cjs/charts/compare-sankey/util.js.map +1 -0
  33. package/cjs/charts/conversion-funnel/constants.js +2 -1
  34. package/cjs/charts/funnel-3d/constant.d.ts +0 -2
  35. package/cjs/charts/funnel-3d/index.js +1 -2
  36. package/cjs/charts/funnel-3d/series.d.ts +0 -2
  37. package/cjs/charts/image-cloud/image-cloud-transformer.js +2 -1
  38. package/cjs/charts/image-cloud/image-cloud.js +1 -1
  39. package/cjs/charts/image-cloud/index.js +1 -1
  40. package/cjs/charts/image-cloud/interface.js +1 -1
  41. package/cjs/charts/image-cloud/series/constant.d.ts +0 -2
  42. package/cjs/charts/image-cloud/series/image-cloud.d.ts +0 -2
  43. package/cjs/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
  44. package/cjs/charts/pictogram/element-select-by-graphic-name.js +1 -1
  45. package/cjs/charts/pictogram/index.js +1 -1
  46. package/cjs/charts/pictogram/interface.js +1 -1
  47. package/cjs/charts/pictogram/series/constant.d.ts +0 -2
  48. package/cjs/charts/pictogram/series/pictogram.d.ts +0 -2
  49. package/cjs/charts/pie-3d/constant.d.ts +0 -2
  50. package/cjs/charts/pie-3d/series.d.ts +0 -2
  51. package/cjs/charts/ranking-list/ranking-list-transformer.d.ts +6 -0
  52. package/cjs/charts/ranking-list/ranking-list-transformer.js +2 -1
  53. package/cjs/charts/ranking-list/ranking-list-transformer.js.map +1 -1
  54. package/cjs/index.d.ts +1 -1
  55. package/cjs/index.js +3 -3
  56. package/cjs/index.js.map +1 -1
  57. package/esm/charts/axis-3d/axis-3d-mixin.js +48 -2
  58. package/esm/charts/axis-3d/axis-3d-mixin.js.map +1 -1
  59. package/esm/charts/axis-3d/linear-axis.js +2 -1
  60. package/esm/charts/axis-3d/util.js +9 -8
  61. package/esm/charts/axis-3d/util.js.map +1 -1
  62. package/esm/charts/bar-3d/constant.js +1 -2
  63. package/esm/charts/compare-sankey/compare-sankey-sub-data.d.ts +9 -0
  64. package/esm/charts/compare-sankey/compare-sankey-sub-data.js +33 -0
  65. package/esm/charts/compare-sankey/compare-sankey-sub-data.js.map +1 -0
  66. package/esm/charts/compare-sankey/compare-sankey-sub-nodes.d.ts +2 -0
  67. package/esm/charts/compare-sankey/compare-sankey-sub-nodes.js +12 -0
  68. package/esm/charts/compare-sankey/compare-sankey-sub-nodes.js.map +1 -0
  69. package/esm/charts/compare-sankey/compare-sankey-transformer.d.ts +6 -0
  70. package/esm/charts/compare-sankey/compare-sankey-transformer.js +14 -0
  71. package/esm/charts/compare-sankey/compare-sankey-transformer.js.map +1 -0
  72. package/esm/charts/compare-sankey/compare-sankey.d.ts +35 -0
  73. package/esm/charts/compare-sankey/compare-sankey.js +184 -0
  74. package/esm/charts/compare-sankey/compare-sankey.js.map +1 -0
  75. package/esm/charts/compare-sankey/constants.d.ts +1 -0
  76. package/esm/charts/compare-sankey/constants.js +2 -0
  77. package/esm/charts/compare-sankey/constants.js.map +1 -0
  78. package/esm/charts/compare-sankey/index.d.ts +2 -0
  79. package/esm/charts/compare-sankey/index.js +4 -0
  80. package/esm/charts/compare-sankey/index.js.map +1 -0
  81. package/esm/charts/compare-sankey/interface.d.ts +23 -0
  82. package/esm/charts/compare-sankey/interface.js +2 -0
  83. package/esm/charts/compare-sankey/interface.js.map +1 -0
  84. package/esm/charts/compare-sankey/util.d.ts +1 -0
  85. package/esm/charts/compare-sankey/util.js +2 -0
  86. package/esm/charts/compare-sankey/util.js.map +1 -0
  87. package/esm/charts/conversion-funnel/constants.js +2 -1
  88. package/esm/charts/funnel-3d/constant.d.ts +0 -2
  89. package/esm/charts/funnel-3d/index.js +1 -2
  90. package/esm/charts/funnel-3d/series.d.ts +0 -2
  91. package/esm/charts/image-cloud/image-cloud-transformer.js +2 -1
  92. package/esm/charts/image-cloud/image-cloud.js +1 -1
  93. package/esm/charts/image-cloud/index.js +1 -1
  94. package/esm/charts/image-cloud/interface.js +1 -1
  95. package/esm/charts/image-cloud/series/constant.d.ts +0 -2
  96. package/esm/charts/image-cloud/series/image-cloud.d.ts +0 -2
  97. package/esm/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
  98. package/esm/charts/pictogram/element-select-by-graphic-name.js +1 -1
  99. package/esm/charts/pictogram/index.js +1 -1
  100. package/esm/charts/pictogram/interface.js +1 -1
  101. package/esm/charts/pictogram/series/constant.d.ts +0 -2
  102. package/esm/charts/pictogram/series/pictogram.d.ts +0 -2
  103. package/esm/charts/pie-3d/constant.d.ts +0 -2
  104. package/esm/charts/pie-3d/series.d.ts +0 -2
  105. package/esm/charts/ranking-list/ranking-list-transformer.d.ts +6 -0
  106. package/esm/charts/ranking-list/ranking-list-transformer.js +2 -1
  107. package/esm/charts/ranking-list/ranking-list-transformer.js.map +1 -1
  108. package/esm/index.d.ts +1 -1
  109. package/esm/index.js +2 -2
  110. package/esm/index.js.map +1 -1
  111. package/package.json +9 -9
  112. package/cjs/charts/sequence-analysis/constant.d.ts +0 -3
  113. package/cjs/charts/sequence-analysis/constant.js +0 -7
  114. package/cjs/charts/sequence-analysis/constant.js.map +0 -1
  115. package/cjs/charts/sequence-analysis/interface.d.ts +0 -40
  116. package/cjs/charts/sequence-analysis/interface.js.map +0 -1
  117. package/cjs/charts/sequence-analysis/sequence-analysis-transformer.d.ts +0 -4
  118. package/cjs/charts/sequence-analysis/sequence-analysis-transformer.js +0 -266
  119. package/cjs/charts/sequence-analysis/sequence-analysis-transformer.js.map +0 -1
  120. package/cjs/charts/sequence-analysis/sequence-analysis.d.ts +0 -16
  121. package/cjs/charts/sequence-analysis/sequence-analysis.js +0 -34
  122. package/cjs/charts/sequence-analysis/sequence-analysis.js.map +0 -1
  123. package/esm/charts/sequence-analysis/constant.d.ts +0 -3
  124. package/esm/charts/sequence-analysis/constant.js +0 -6
  125. package/esm/charts/sequence-analysis/constant.js.map +0 -1
  126. package/esm/charts/sequence-analysis/interface.d.ts +0 -40
  127. package/esm/charts/sequence-analysis/interface.js +0 -2
  128. package/esm/charts/sequence-analysis/interface.js.map +0 -1
  129. package/esm/charts/sequence-analysis/sequence-analysis-transformer.d.ts +0 -4
  130. package/esm/charts/sequence-analysis/sequence-analysis-transformer.js +0 -258
  131. package/esm/charts/sequence-analysis/sequence-analysis-transformer.js.map +0 -1
  132. package/esm/charts/sequence-analysis/sequence-analysis.d.ts +0 -16
  133. package/esm/charts/sequence-analysis/sequence-analysis.js +0 -28
  134. package/esm/charts/sequence-analysis/sequence-analysis.js.map +0 -1
package/build/index.js CHANGED
@@ -722,6 +722,12 @@
722
722
  return t => (d.setTime(aVal * (1 - t) + bVal * t), d);
723
723
  }
724
724
 
725
+ function toValidNumber(v) {
726
+ if (isValidNumber$1(v)) return v;
727
+ const value = +v;
728
+ return isValidNumber$1(value) ? value : 0;
729
+ }
730
+
725
731
  const fakeRandom = () => {
726
732
  let i = -1;
727
733
  const arr = [0, .1, .2, .3, .4, .5, .6, .7, .8, .9];
@@ -2989,6 +2995,7 @@
2989
2995
  options: {
2990
2996
  direction: 'y',
2991
2997
  orient: 'negative',
2998
+ excludeChannels: ['x'],
2992
2999
  point: (datum, graphic) => {
2993
3000
  const channelAttr = graphic.getGraphicAttribute('y');
2994
3001
  const barSpace = spec.height / (spec.pageSize + 1);
@@ -3009,7 +3016,7 @@
3009
3016
  options: {
3010
3017
  direction: 'y',
3011
3018
  orient: 'negative',
3012
- excludeChannels: ['y'],
3019
+ excludeChannels: ['x'],
3013
3020
  point: (datum, graphic) => {
3014
3021
  const channelAttr = graphic.getGraphicAttribute('y');
3015
3022
  return { y: channelAttr + (spec.height / (spec.pageSize + 1)) * Math.min(spec.scrollSize, spec.pageSize) };
@@ -4754,371 +4761,6 @@
4754
4761
  }
4755
4762
  };
4756
4763
 
4757
- class SequenceAnalysisChartSpecTransformer extends vchart.CommonChartSpecTransformer {
4758
- transformSpec(spec) {
4759
- var _a;
4760
- delete spec.type;
4761
- spec.type = 'common';
4762
- spec.data = [
4763
- {
4764
- id: 'eventData',
4765
- values: spec.eventData
4766
- },
4767
- {
4768
- id: 'actionData',
4769
- values: spec.actionData
4770
- },
4771
- {
4772
- id: 'patternData',
4773
- values: spec.patternData
4774
- }
4775
- ];
4776
- const { eventData } = spec;
4777
- const { mode, mediumConnection = false, actionTarget = false, stepMediumMap } = spec;
4778
- spec.series = [
4779
- {
4780
- type: 'link',
4781
- dataId: mode === 'time' ? 'actionData' : 'patternData',
4782
- dotSeriesIndex: 1,
4783
- fromField: 'from',
4784
- toField: 'to',
4785
- seriesField: 'pattern_type',
4786
- imageLabelField: mode === 'time' && actionTarget ? 'user_image' : '',
4787
- allowExtend: mode === 'step' && !mediumConnection,
4788
- linkType: mode === 'step' && mediumConnection ? 'curve' : 'line',
4789
- arrow: {
4790
- style: {
4791
- visible: mode === 'time' && actionTarget
4792
- }
4793
- },
4794
- link: {
4795
- state: {
4796
- custom_unSelected: {
4797
- strokeOpacity: 0.5,
4798
- stroke: 'grey'
4799
- }
4800
- },
4801
- style: {
4802
- visible: mode === 'step' || actionTarget
4803
- }
4804
- },
4805
- imageLabel: {
4806
- visible: mode === 'time' && actionTarget,
4807
- style: {
4808
- width: 40,
4809
- height: 40
4810
- }
4811
- }
4812
- },
4813
- {
4814
- type: 'dot',
4815
- xField: mode === 'time' ? 'time_stamp' : mediumConnection ? 'medium_type' : 'step',
4816
- yField: 'user_id',
4817
- titleField: 'user_id',
4818
- seriesField: 'action_type',
4819
- linearMode: mode === 'time',
4820
- dataIndex: 0,
4821
- highLightSeriesGroup: '',
4822
- title: {
4823
- visible: false,
4824
- style: {
4825
- fill: 'rgba(46, 47, 50)'
4826
- }
4827
- },
4828
- grid: {
4829
- style: {
4830
- visible: false
4831
- }
4832
- },
4833
- dot: {
4834
- state: {
4835
- custom_unSelected: {
4836
- fillOpacity: 0.5,
4837
- fill: 'grey'
4838
- }
4839
- }
4840
- },
4841
- symbol: {
4842
- visible: false
4843
- }
4844
- }
4845
- ];
4846
- spec.series.forEach((s) => {
4847
- if (s.type === 'link') {
4848
- s.dotSeriesSpec = spec.series[s.dotSeriesIndex];
4849
- }
4850
- });
4851
- const tickData = [];
4852
- const timeCountMap = {};
4853
- eventData.forEach(user => {
4854
- user.dots.forEach(e => {
4855
- if (timeCountMap[e.time_stamp]) {
4856
- timeCountMap[e.time_stamp] += e.action_count;
4857
- }
4858
- else {
4859
- timeCountMap[e.time_stamp] = e.action_count;
4860
- }
4861
- });
4862
- });
4863
- Object.keys(timeCountMap)
4864
- .sort((a, b) => Number(a) - Number(b))
4865
- .forEach(key => {
4866
- tickData.push({
4867
- time_stamp: Number(key),
4868
- action_count: timeCountMap[key]
4869
- });
4870
- });
4871
- const axes = [];
4872
- if (mode === 'step') {
4873
- if (mediumConnection) {
4874
- axes.push({
4875
- orient: 'top',
4876
- type: 'band',
4877
- id: 'top_medium'
4878
- });
4879
- }
4880
- else {
4881
- axes.push({
4882
- orient: 'top',
4883
- type: 'band',
4884
- id: 'top_medium',
4885
- label: {
4886
- formatMethod: (label) => {
4887
- return {
4888
- type: 'rich',
4889
- text: [
4890
- {
4891
- text: `${stepMediumMap[label].medium_type}... `,
4892
- fontSize: 12
4893
- },
4894
- {
4895
- text: `+${stepMediumMap[label].count}`,
4896
- fontSize: 12,
4897
- background: 'grey',
4898
- backgroundOpacity: 0.4,
4899
- backgroundCornerRadius: 5
4900
- }
4901
- ]
4902
- };
4903
- }
4904
- }
4905
- });
4906
- axes.push({
4907
- orient: 'bottom',
4908
- id: 'bottom_step',
4909
- type: 'band',
4910
- bandPadding: 0
4911
- });
4912
- }
4913
- }
4914
- else {
4915
- axes.push({
4916
- orient: 'top',
4917
- type: 'time',
4918
- id: 'top_count',
4919
- label: {
4920
- dataFilter: (datum) => {
4921
- const minData = datum[0].rawValue;
4922
- const minValue = datum[0].value;
4923
- const maxData = datum[datum.length - 1].rawValue;
4924
- const maxValue = datum[datum.length - 1].value;
4925
- return tickData
4926
- .filter(t => t.time_stamp >= minData && t.time_stamp <= maxData)
4927
- .map(t => ({
4928
- id: t.time_stamp,
4929
- label: t.action_count,
4930
- value: ((t.time_stamp - minData) / (maxData - minData)) * (maxValue - minValue) + minValue,
4931
- rawValue: t.time_stamp
4932
- }));
4933
- },
4934
- formatMethod: (label, datum) => {
4935
- if (datum === null || datum === void 0 ? void 0 : datum.rawValue) {
4936
- return timeCountMap[datum.rawValue];
4937
- }
4938
- return label;
4939
- }
4940
- },
4941
- tick: {
4942
- visible: false
4943
- },
4944
- grid: {
4945
- visible: false
4946
- },
4947
- innerOffset: {
4948
- left: 50,
4949
- right: 50
4950
- }
4951
- });
4952
- axes.push({
4953
- orient: 'bottom',
4954
- id: 'bottom_time',
4955
- type: 'time',
4956
- layers: [
4957
- {
4958
- tickStep: 28800,
4959
- timeFormat: '%Y%m%d'
4960
- },
4961
- {
4962
- tickStep: 28800,
4963
- timeFormat: '%H:%M'
4964
- }
4965
- ],
4966
- label: {
4967
- dataFilter: (datum) => {
4968
- const minData = datum[0].rawValue;
4969
- const minValue = datum[0].value;
4970
- const maxData = datum[datum.length - 1].rawValue;
4971
- const maxValue = datum[datum.length - 1].value;
4972
- return tickData
4973
- .filter(t => t.time_stamp >= minData && t.time_stamp <= maxData)
4974
- .map(t => ({
4975
- id: t.time_stamp,
4976
- label: t.time_stamp,
4977
- value: ((t.time_stamp - minData) / (maxData - minData)) * (maxValue - minValue) + minValue,
4978
- rawValue: t.time_stamp
4979
- }));
4980
- }
4981
- },
4982
- tick: {
4983
- visible: false
4984
- },
4985
- grid: {
4986
- visible: false
4987
- },
4988
- innerOffset: {
4989
- left: 50,
4990
- right: 50
4991
- }
4992
- });
4993
- }
4994
- spec.axes = [
4995
- ...axes,
4996
- {
4997
- orient: 'left',
4998
- type: 'band',
4999
- domainLine: {
5000
- visible: false
5001
- },
5002
- tick: {
5003
- visible: false
5004
- },
5005
- label: {
5006
- formatMethod: label => {
5007
- return {
5008
- type: 'rich',
5009
- text: [{ image: spec.userImageMap[label], width: 40, height: 40 }]
5010
- };
5011
- }
5012
- },
5013
- grid: {
5014
- visible: true,
5015
- style: {
5016
- lineDash: [3, 3]
5017
- }
5018
- }
5019
- }
5020
- ];
5021
- spec.dataZoom = [
5022
- {
5023
- orient: 'bottom',
5024
- axisIndex: 0,
5025
- filterMode: 'filter'
5026
- }
5027
- ];
5028
- spec.scrollBar = [
5029
- {
5030
- orient: 'right',
5031
- axisIndex: spec.axes.length - 1,
5032
- filterMode: 'axis',
5033
- start: 0,
5034
- end: 0.8
5035
- },
5036
- {
5037
- orient: 'bottom',
5038
- axisIndex: 0,
5039
- linkedAxisIndex: mediumConnection && mode === 'step' ? undefined : 1,
5040
- filterMode: 'axis',
5041
- start: 0,
5042
- end: 0.8
5043
- }
5044
- ];
5045
- spec.crosshair = {
5046
- xField: {
5047
- visible: true,
5048
- line: {
5049
- type: 'rect',
5050
- width: 20,
5051
- style: {
5052
- fill: 'rgb(240,242,245)'
5053
- }
5054
- },
5055
- bindingAxesIndex: [0, 1]
5056
- },
5057
- yField: {
5058
- visible: true,
5059
- bindingAxesIndex: [spec.axes.length - 1],
5060
- line: {
5061
- type: 'rect'
5062
- }
5063
- }
5064
- };
5065
- if (mode === 'time') {
5066
- spec.markLine = tickData.map(t => ({
5067
- zIndex: -1,
5068
- x: t.time_stamp,
5069
- endSymbol: {
5070
- visible: false
5071
- },
5072
- label: {
5073
- visible: false
5074
- }
5075
- }));
5076
- }
5077
- spec.tooltip = {
5078
- visible: false
5079
- };
5080
- spec.animation = false;
5081
- (_a = spec.customTransformSpec) === null || _a === void 0 ? void 0 : _a.call(spec, spec);
5082
- super.transformSpec(spec);
5083
- }
5084
- }
5085
-
5086
- class SequenceAnalysis extends vchart.BaseChart {
5087
- constructor() {
5088
- super(...arguments);
5089
- this.type = 'sequenceAnalysis';
5090
- this.transformerConstructor = SequenceAnalysisChartSpecTransformer;
5091
- }
5092
- init() {
5093
- if (!this.isValid()) {
5094
- return;
5095
- }
5096
- super.init();
5097
- }
5098
- isValid() {
5099
- var _a, _b, _c, _d;
5100
- const { eventData, type } = this._spec;
5101
- if (type !== 'sequenceAnalysis') {
5102
- (_b = (_a = this._option).onError) === null || _b === void 0 ? void 0 : _b.call(_a, 'Type is required');
5103
- return false;
5104
- }
5105
- if (!eventData) {
5106
- (_d = (_c = this._option).onError) === null || _d === void 0 ? void 0 : _d.call(_c, 'Data is required');
5107
- return false;
5108
- }
5109
- return true;
5110
- }
5111
- }
5112
- SequenceAnalysis.type = 'sequenceAnalysis';
5113
- SequenceAnalysis.view = 'singleDefault';
5114
- SequenceAnalysis.transformerConstructor = SequenceAnalysisChartSpecTransformer;
5115
- const registerSequenceAnalysis = (option) => {
5116
- const vchartConstructor = (option === null || option === void 0 ? void 0 : option.VChart) || vchart.VChart;
5117
- if (vchartConstructor) {
5118
- vchartConstructor.useChart([SequenceAnalysis, vchart.CommonChart]);
5119
- }
5120
- };
5121
-
5122
4764
  class Bar3dChartSpecTransformer extends vchart.BarChartSpecTransformer {
5123
4765
  _getDefaultSeriesSpec(spec) {
5124
4766
  const seriesSpec = super._getDefaultSeriesSpec(spec);
@@ -10575,9 +10217,9 @@
10575
10217
  setWidthHeightWithoutTransform(aabbBounds) {
10576
10218
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
10577
10219
  }
10578
- setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context) {
10220
+ setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
10579
10221
  this.setAttributes(params, forceUpdateTag, context), this.animates && this.animates.forEach(animate => {
10580
- Object.keys(params).forEach(key => {
10222
+ (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach(key => {
10581
10223
  animate.preventAttr(key);
10582
10224
  });
10583
10225
  });
@@ -10748,7 +10390,7 @@
10748
10390
  });
10749
10391
  } else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
10750
10392
  type: AttributeUpdateType.STATE
10751
- });
10393
+ }), this.finalAttribute && Object.assign(this.finalAttribute, attrs);
10752
10394
  this._emitCustomEvent("afterStateUpdate", {
10753
10395
  type: AttributeUpdateType.STATE
10754
10396
  });
@@ -11141,7 +10783,7 @@
11141
10783
  }
11142
10784
  removeChild(child) {
11143
10785
  const data = super.removeChild(child);
11144
- return child.stage = null, this.getGraphicService().onRemove(child), this.addUpdateBoundTag(), data;
10786
+ return this.getGraphicService().onRemove(child), child.stage = null, this.addUpdateBoundTag(), data;
11145
10787
  }
11146
10788
  removeAllChild(deep = !1) {
11147
10789
  this.forEachChildren(child => {
@@ -13842,9 +13484,10 @@
13842
13484
  return super.needUpdateTag(key, POLYGON_UPDATE_TAG_KEY);
13843
13485
  }
13844
13486
  toCustomPath() {
13845
- const points = this.attribute.points,
13846
- path = new CustomPath2D();
13847
- return points.forEach((point, index) => {
13487
+ let path = super.toCustomPath();
13488
+ if (path) return path;
13489
+ const points = this.attribute.points;
13490
+ return path = new CustomPath2D(), points.forEach((point, index) => {
13848
13491
  0 === index ? path.moveTo(point.x, point.y) : path.lineTo(point.x, point.y);
13849
13492
  }), path.closePath(), path;
13850
13493
  }
@@ -18234,7 +17877,7 @@
18234
17877
  return this._animateCount;
18235
17878
  }
18236
17879
  constructor() {
18237
- super(), this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
17880
+ super(), this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this._animationEndFlag = !0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
18238
17881
  }
18239
17882
  isRunning() {
18240
17883
  return !this.paused && this._animateCount > 0;
@@ -18263,10 +17906,11 @@
18263
17906
  }
18264
17907
  tick(delta) {
18265
17908
  if (this.paused) return;
17909
+ this._animationEndFlag && (this._animationEndFlag = !1, this.emit("animationStart"));
18266
17910
  const scaledDelta = delta * this._playSpeed;
18267
17911
  this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
18268
17912
  animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0) : animate.status !== AnimateStatus.RUNNING && animate.status !== AnimateStatus.INITIAL || animate.advance(scaledDelta);
18269
- }), 0 === this._animateCount && this.emit("animationEnd");
17913
+ }), 0 === this._animateCount && (this._animationEndFlag = !0, this.emit("animationEnd"));
18270
17914
  }
18271
17915
  clear() {
18272
17916
  this.forEachAccessAnimate(animate => {
@@ -18330,7 +17974,9 @@
18330
17974
  return this._timeline;
18331
17975
  }
18332
17976
  bind(target) {
18333
- return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
17977
+ return this.target = target, this.target.animates || (this.target.animates = new Map()), this.target.animates.set(this.id, this), this.onRemove(() => {
17978
+ this.stop(), this.target.animates.delete(this.id);
17979
+ }), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
18334
17980
  }
18335
17981
  to(props, duration = 300, easing = "linear") {
18336
17982
  const step = new Step(AnimateStepType.to, props, duration, easing);
@@ -18544,8 +18190,8 @@
18544
18190
  }
18545
18191
  init() {
18546
18192
  this.interval = 16, this.status = STATUS.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
18547
- this.initHandler();
18548
- }), application.global.env && this.initHandler();
18193
+ this.initHandler(!1);
18194
+ }), application.global.env && this.initHandler(!1);
18549
18195
  }
18550
18196
  addTimeline(timeline) {
18551
18197
  this.timelines.push(timeline);
@@ -18556,10 +18202,11 @@
18556
18202
  getTimelines() {
18557
18203
  return this.timelines;
18558
18204
  }
18559
- initHandler() {
18560
- this.setupTickHandler();
18205
+ initHandler(force = !1) {
18206
+ this.setupTickHandler(force);
18561
18207
  }
18562
- setupTickHandler() {
18208
+ setupTickHandler(force = !1) {
18209
+ if (!force && this.tickerHandler) return !0;
18563
18210
  const handler = new RAFTickHandler();
18564
18211
  return this.tickerHandler && this.tickerHandler.release(), this.tickerHandler = handler, !0;
18565
18212
  }
@@ -18610,7 +18257,7 @@
18610
18257
  return this.status = STATUS.RUNNING, this.tickerHandler.tick(0, this.handleTick), !0;
18611
18258
  }
18612
18259
  stop() {
18613
- this.status = STATUS.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
18260
+ this.status = STATUS.INITIAL, this.setupTickHandler(!0), this.lastFrameTime = -1;
18614
18261
  }
18615
18262
  trySyncTickStatus() {
18616
18263
  this.status === STATUS.INITIAL && this.timelines.some(timeline => timeline.isRunning()) ? this.start() : this.status === STATUS.RUNNING && this.timelines.every(timeline => !timeline.isRunning()) && this.stop();
@@ -18620,7 +18267,8 @@
18620
18267
  this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
18621
18268
  }
18622
18269
  checkSkip(delta) {
18623
- if ("performance" === this.stage.params.optimize.tickRenderMode) return !1;
18270
+ var _a, _b, _c;
18271
+ if ("performance" === (null === (_c = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.params) || void 0 === _b ? void 0 : _b.optimize) || void 0 === _c ? void 0 : _c.tickRenderMode)) return !1;
18624
18272
  return delta < this.interval + 2 * (Math.random() - .5) * this._jitter;
18625
18273
  }
18626
18274
  }
@@ -18871,10 +18519,11 @@
18871
18519
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
18872
18520
  var _a, _b, _c, _d;
18873
18521
  if (custom && customType) {
18874
- const customParams = this.resolveValue(customParameters, graphic, {
18522
+ const customParams = Object.assign({
18875
18523
  width: graphic.stage.width,
18876
- height: graphic.stage.height
18877
- }),
18524
+ height: graphic.stage.height,
18525
+ group: this._target.parent
18526
+ }, this.resolveValue(customParameters, graphic)),
18878
18527
  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;
18879
18528
  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);
18880
18529
  } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
@@ -19092,6 +18741,14 @@
19092
18741
  state.executor.stop();
19093
18742
  }), this.stateList = null;
19094
18743
  }
18744
+ reApplyState(state) {
18745
+ var _a;
18746
+ const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
18747
+ if (stateInfo) {
18748
+ const stateList = this.stateList.slice();
18749
+ stateInfo.executor.stop(), this.stateList = stateList, stateInfo.executor.execute(stateInfo.animationConfig);
18750
+ }
18751
+ }
19095
18752
  }
19096
18753
 
19097
18754
  class GraphicStateExtension {
@@ -19122,11 +18779,20 @@
19122
18779
  applyUnhighlightState(animationConfig, callback) {
19123
18780
  return this._getAnimationStateManager(this).applyUnhighlightState(animationConfig, callback), this;
19124
18781
  }
19125
- stopAnimationState(state, type) {
19126
- return this._getAnimationStateManager(this).stopState(state, type), this;
18782
+ stopAnimationState(state, type, deep = !1) {
18783
+ return this._getAnimationStateManager(this).stopState(state, type), deep && this.isContainer && this.forEachChildren(child => {
18784
+ child.stopAnimationState(state, type, deep);
18785
+ }), this;
19127
18786
  }
19128
18787
  clearAnimationStates() {
19129
- return this._getAnimationStateManager(this).clearState(), this;
18788
+ const stateManager = this._animationStateManager;
18789
+ return stateManager && stateManager.clearState(), this;
18790
+ }
18791
+ reApplyAnimationState(state, deep = !1) {
18792
+ const stateManager = this._animationStateManager;
18793
+ return stateManager && stateManager.reApplyState(state), deep && this.isContainer && this.forEachChildren(child => {
18794
+ child.reApplyAnimationState(state, deep);
18795
+ }), this;
19130
18796
  }
19131
18797
  static extend(graphic) {
19132
18798
  return new GraphicStateExtension()._getAnimationStateManager(graphic), graphic;
@@ -19139,7 +18805,6 @@
19139
18805
  }
19140
18806
  animate(params) {
19141
18807
  var _a, _b, _c;
19142
- this.animates || (this.animates = new Map());
19143
18808
  const animate = new Animate(null == params ? void 0 : params.id, null !== (_b = null !== (_a = null == params ? void 0 : params.timeline) && void 0 !== _a ? _a : this.stage && this.stage.getTimeline()) && void 0 !== _b ? _b : defaultTimeline, null == params ? void 0 : params.slience);
19144
18809
  if (animate.bind(this), params) {
19145
18810
  const {
@@ -19149,9 +18814,7 @@
19149
18814
  } = params;
19150
18815
  null != onStart && animate.onStart(onStart), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove);
19151
18816
  }
19152
- return this.animates.set(animate.id, animate), animate.onRemove(() => {
19153
- animate.stop(), this.animates.delete(animate.id);
19154
- }), null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
18817
+ return null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
19155
18818
  }
19156
18819
  createTimeline() {
19157
18820
  return new DefaultTimeline();
@@ -19182,6 +18845,21 @@
19182
18845
  getGraphicAttribute(key, prev = !1) {
19183
18846
  return !prev && this.finalAttribute ? this.finalAttribute[key] : this.attribute[key];
19184
18847
  }
18848
+ pauseAnimation(deep = !1) {
18849
+ this.animates && this.animates.forEach(animate => animate.pause()), deep && this.isContainer && this.forEachChildren(child => {
18850
+ child.pauseAnimation(deep);
18851
+ });
18852
+ }
18853
+ resumeAnimation(deep = !1) {
18854
+ this.animates && this.animates.forEach(animate => animate.resume()), deep && this.isContainer && this.forEachChildren(child => {
18855
+ child.resumeAnimation(deep);
18856
+ });
18857
+ }
18858
+ stopAnimation(deep = !1) {
18859
+ this.animates && this.animates.forEach(animate => animate.stop()), deep && this.isContainer && this.forEachChildren(child => {
18860
+ child.stopAnimation(deep);
18861
+ });
18862
+ }
19185
18863
  }
19186
18864
 
19187
18865
  function registerAnimate() {
@@ -19190,7 +18868,7 @@
19190
18868
 
19191
18869
  class ACustomAnimate extends Step {
19192
18870
  constructor(customFrom, customTo, duration, easing, params) {
19193
- super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params;
18871
+ super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params, this.from = customFrom, this.to = customTo;
19194
18872
  }
19195
18873
  update(end, ratio, out) {
19196
18874
  if (this.onStart(), !this.props || !this.propKeys) return;
@@ -19383,17 +19061,6 @@
19383
19061
  items,
19384
19062
  scale: axis._scale.clone()
19385
19063
  };
19386
- if (!ignoreGrid) {
19387
- attrs.grid = {
19388
- type: 'line',
19389
- start: { x: 0, y: 0 },
19390
- end,
19391
- items: items[0],
19392
- verticalFactor: axis._axisStyle.verticalFactor,
19393
- depth: depthZ,
19394
- length: !ignoreGrid ? regionSize.height : 0
19395
- };
19396
- }
19397
19064
  const directionStr = (_a = axis.directionStr) !== null && _a !== void 0 ? _a : 'r2l';
19398
19065
  let anchor3d = [0, 0];
19399
19066
  let alpha = -Math.PI / 2;
@@ -19406,6 +19073,20 @@
19406
19073
  attrs.z = z;
19407
19074
  attrs.alpha = alpha;
19408
19075
  attrs.anchor3d = anchor3d;
19076
+ if (!ignoreGrid) {
19077
+ attrs.grid = {
19078
+ type: 'line',
19079
+ start: { x: 0, y: 0 },
19080
+ end,
19081
+ items: items[0],
19082
+ verticalFactor: axis._axisStyle.verticalFactor,
19083
+ depth: depthZ,
19084
+ length: !ignoreGrid ? regionSize.height : 0,
19085
+ alpha,
19086
+ z,
19087
+ anchor3d
19088
+ };
19089
+ }
19409
19090
  return attrs;
19410
19091
  };
19411
19092
 
@@ -19415,7 +19096,59 @@
19415
19096
  }
19416
19097
  _afterUpdateAttribute(attrs, ignoreGrid) {
19417
19098
  const isZ = vchart.isZAxis(this._orient);
19099
+ const isX = vchart.isXAxis(this._orient);
19100
+ const isY = vchart.isYAxis(this._orient);
19101
+ let regionHeight = 0;
19102
+ let regionWidth = 0;
19103
+ if (!ignoreGrid) {
19104
+ const regions = this.getRegions();
19105
+ let { x: minX, y: minY } = regions[0].getLayoutStartPoint();
19106
+ let maxX = minX + regions[0].getLayoutRect().width;
19107
+ let maxY = minY + regions[0].getLayoutRect().height;
19108
+ for (let index = 1; index < regions.length; index++) {
19109
+ const region = regions[index];
19110
+ const { x, y } = region.getLayoutStartPoint();
19111
+ const { width, height } = region.getLayoutRect();
19112
+ minX = Math.min(minX, x);
19113
+ maxX = Math.max(maxX, width + x);
19114
+ minY = Math.min(minY, y);
19115
+ maxY = Math.max(maxY, height + y);
19116
+ }
19117
+ regionHeight = Math.abs(maxY - minY);
19118
+ regionWidth = Math.abs(maxX - minX);
19119
+ }
19120
+ let gridLength = 0;
19121
+ let axisLength = 0;
19122
+ const { width, height } = this.getLayoutRect();
19123
+ let end = { x: 0, y: 0 };
19124
+ if (isX) {
19125
+ end = { x: width, y: 0 };
19126
+ gridLength = regionHeight;
19127
+ axisLength = width;
19128
+ }
19129
+ else if (isY) {
19130
+ end = { x: 0, y: height };
19131
+ gridLength = regionWidth;
19132
+ axisLength = height;
19133
+ }
19134
+ const depth = this.layout3dBox ? this.layout3dBox.length : 0;
19418
19135
  if (!isZ) {
19136
+ const items = this.getLabelItems(axisLength);
19137
+ attrs.grid = {
19138
+ length: gridLength
19139
+ };
19140
+ attrs.start = { x: 0, y: 0 };
19141
+ attrs.text = this._spec.title.text || this._dataFieldText;
19142
+ attrs.maxWidth = this._getTitleLimit(isX);
19143
+ attrs.items = items;
19144
+ attrs.grid = {
19145
+ type: 'line',
19146
+ start: { x: 0, y: 0 },
19147
+ end,
19148
+ items: items[0],
19149
+ depth,
19150
+ length: gridLength
19151
+ };
19419
19152
  return attrs;
19420
19153
  }
19421
19154
  return getUpdateAttributeOfZAxis(this, ignoreGrid);
@@ -20296,6 +20029,80 @@
20296
20029
  })(ImageCloudMarkNameEnum || (ImageCloudMarkNameEnum = {}));
20297
20030
  const imageCloudSeriesMark = Object.assign(Object.assign({}, vchart.baseSeriesMark), { ["image"]: { name: "image", type: "image" }, ["imageMask"]: { name: "imageMask", type: "rect" } });
20298
20031
 
20032
+ const calculateNodeValue = subTree => {
20033
+ let sum = 0;
20034
+ return subTree.forEach((node, index) => {
20035
+ var _a;
20036
+ isNil$1(node.value) && ((null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) ? node.value = calculateNodeValue(node.children) : node.value = 0), sum += Math.abs(node.value);
20037
+ }), sum;
20038
+ };
20039
+ function makeHierarchicNodes(originalNodes, nodeKeyFunc, nodes = [], nodeMap = {}, originalLinks) {
20040
+ calculateNodeValue(originalNodes);
20041
+ const doSubTree = (subTree, depth, parents) => {
20042
+ subTree.forEach((node, index) => {
20043
+ const nodeKey = nodeKeyFunc ? nodeKeyFunc(node) : parents ? `${parents[parents.length - 1].key}-${index}` : `${depth}-${index}`,
20044
+ nodeValue = isNil$1(node.value) ? 0 : toValidNumber(node.value);
20045
+ if (nodeMap[nodeKey]) nodeMap[nodeKey].value = void 0;else {
20046
+ const nodeElement = {
20047
+ depth: depth,
20048
+ datum: node,
20049
+ index: index,
20050
+ key: nodeKey,
20051
+ value: nodeValue,
20052
+ sourceLinks: [],
20053
+ targetLinks: []
20054
+ };
20055
+ nodeMap[nodeKey] = nodeElement, nodes.push(nodeElement);
20056
+ }
20057
+ parents && originalLinks && originalLinks.push({
20058
+ source: parents[parents.length - 1].key,
20059
+ target: nodeKey,
20060
+ value: nodeValue,
20061
+ parents: parents
20062
+ }), node.children && node.children.length && doSubTree(node.children, depth + 1, parents ? parents.concat([nodeMap[nodeKey]]) : [nodeMap[nodeKey]]);
20063
+ });
20064
+ };
20065
+ return doSubTree(originalNodes, 0, null), nodes;
20066
+ }
20067
+ function computeHierarchicNodeLinks(originalNodes, nodeKeyFunc) {
20068
+ const nodes = [],
20069
+ links = [],
20070
+ nodeMap = {},
20071
+ linkMap = {},
20072
+ originalLinks = [];
20073
+ return makeHierarchicNodes(originalNodes, nodeKeyFunc, nodes, nodeMap, originalLinks), originalLinks.forEach((link, index) => {
20074
+ const key = `${link.source}-${link.target}`,
20075
+ linkDatum = pickWithout(link, ["parents"]);
20076
+ if (linkDatum.parents = link.parents.map(node => pickWithout(node, ["sourceLinks", "targetLinks"])), linkMap[key]) return linkMap[key].value += toValidNumber(link.value), void linkMap[key].datum.push(linkDatum);
20077
+ const linkElement = {
20078
+ index: index,
20079
+ key: `${link.source}-${link.target}`,
20080
+ source: link.source,
20081
+ target: link.target,
20082
+ datum: [linkDatum],
20083
+ value: link.value,
20084
+ parents: link.parents.map(parent => parent.key)
20085
+ };
20086
+ links.push(linkElement), nodeMap[link.source].sourceLinks.push(linkElement), nodeMap[link.target].targetLinks.push(linkElement), linkMap[key] = linkElement;
20087
+ }), {
20088
+ nodes: nodes,
20089
+ links: links,
20090
+ nodeMap: nodeMap
20091
+ };
20092
+ }
20093
+ function computeNodeValues(nodes) {
20094
+ for (let i = 0, len = nodes.length; i < len; i++) {
20095
+ const node = nodes[i];
20096
+ node.value = Math.max(isNil$1(node.value) ? 0 : toValidNumber(node.value), node.sourceLinks.reduce((sum, link) => {
20097
+ var _a;
20098
+ return sum + (null !== (_a = toValidNumber(link.value)) && void 0 !== _a ? _a : 0);
20099
+ }, 0), node.targetLinks.reduce((sum, link) => {
20100
+ var _a;
20101
+ return sum + (null !== (_a = toValidNumber(link.value)) && void 0 !== _a ? _a : 0);
20102
+ }, 0));
20103
+ }
20104
+ }
20105
+
20299
20106
  const shapes = {
20300
20107
  triangleForward: triangleForward,
20301
20108
  triangleUpright: triangle,
@@ -22247,6 +22054,297 @@
22247
22054
  vchart.Factory.registerChart(ImageCloudChart.type, ImageCloudChart);
22248
22055
  };
22249
22056
 
22057
+ class CompareSankeyChartSpecTransformer extends vchart.SankeyChartSpecTransformer {
22058
+ transformSpec(spec) {
22059
+ super.transformSpec(spec);
22060
+ }
22061
+ _getDefaultSeriesSpec(spec) {
22062
+ const seriesSpec = super._getDefaultSeriesSpec(spec);
22063
+ seriesSpec.subNodeGap = spec.subNodeGap;
22064
+ seriesSpec.compareNodeColor = spec.compareNodeColor;
22065
+ seriesSpec.compareLinkColor = spec.compareLinkColor;
22066
+ seriesSpec.activeLink = spec.activeLink;
22067
+ return seriesSpec;
22068
+ }
22069
+ }
22070
+
22071
+ const compareSankeySubNodes = (data) => {
22072
+ const viewData = data[0];
22073
+ if (!viewData.latestData) {
22074
+ return [];
22075
+ }
22076
+ const subData = Object.keys(viewData.latestData);
22077
+ if (!subData.length) {
22078
+ return {};
22079
+ }
22080
+ const subNodes = [];
22081
+ subData.forEach(key => {
22082
+ subNodes.push(...viewData.latestData[key].nodes);
22083
+ });
22084
+ return [{ nodes: subNodes }];
22085
+ };
22086
+
22087
+ const compareSankeySubData = (data, opt) => {
22088
+ var _a;
22089
+ const viewData = data[0];
22090
+ if (!((_a = viewData.latestData) === null || _a === void 0 ? void 0 : _a.length)) {
22091
+ return {};
22092
+ }
22093
+ const rawDataTree = opt.rawData().latestData[0];
22094
+ const subNodeGap = opt.subNodeGap;
22095
+ const keyFunc = isFunction$1(opt.nodeKey) ? opt.nodeKey : opt.nodeKey ? field(opt.nodeKey) : null;
22096
+ const subNodeMap = {};
22097
+ rawDataTree.subNode.forEach((sunGroup) => {
22098
+ subNodeMap[sunGroup.type] = computeHierarchicNodeLinks(sunGroup.nodes, keyFunc);
22099
+ computeNodeValues(subNodeMap[sunGroup.type].nodes);
22100
+ });
22101
+ const subCount = Object.keys(subNodeMap).length;
22102
+ viewData.latestData[0].nodes.forEach((n) => {
22103
+ let path = [];
22104
+ if (n.targetLinks.length) {
22105
+ const link = n.targetLinks[0];
22106
+ path = [...link.parents];
22107
+ }
22108
+ path.push(n.key);
22109
+ let currentY = n.y0;
22110
+ const totalSize = n.y1 - n.y0 - (subCount - 1) * subNodeGap;
22111
+ const totalValue = n.value;
22112
+ rawDataTree.subNode.forEach((sunGroup) => {
22113
+ const subNode = subNodeMap[sunGroup.type].nodes.find(subN => subN.key === n.key);
22114
+ if (!subNode) {
22115
+ return;
22116
+ }
22117
+ const percent = subNode.value / totalValue;
22118
+ subNode.x0 = n.x0;
22119
+ subNode.x1 = n.x1;
22120
+ subNode.y0 = currentY;
22121
+ subNode.y1 = currentY + totalSize * percent;
22122
+ subNode.type = sunGroup.type;
22123
+ subNode.sourceNode = n;
22124
+ currentY += totalSize * percent + subNodeGap;
22125
+ });
22126
+ });
22127
+ return subNodeMap;
22128
+ };
22129
+
22130
+ class CompareSankeyChart extends vchart.SankeyChart {
22131
+ constructor() {
22132
+ super(...arguments);
22133
+ this.type = 'compareSankey';
22134
+ this.transformerConstructor = CompareSankeyChartSpecTransformer;
22135
+ }
22136
+ }
22137
+ CompareSankeyChart.type = 'compareSankey';
22138
+ CompareSankeyChart.transformerConstructor = CompareSankeyChartSpecTransformer;
22139
+ class CompareSankeySeries extends vchart.SankeySeries {
22140
+ constructor() {
22141
+ super(...arguments);
22142
+ this._fillCompareNode = (datum) => {
22143
+ var _a, _b, _c;
22144
+ if ((_a = this._spec.compareNodeColor) === null || _a === void 0 ? void 0 : _a[datum.type]) {
22145
+ return this._spec.compareNodeColor[datum.type];
22146
+ }
22147
+ return (_c = (_b = this._spec.node.style) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : this._fillByNode(datum);
22148
+ };
22149
+ this._fillActiveLink = (datum) => {
22150
+ var _a, _b, _c;
22151
+ if ((_a = this._spec.compareLinkColor) === null || _a === void 0 ? void 0 : _a[datum.type]) {
22152
+ return this._spec.compareLinkColor[datum.type];
22153
+ }
22154
+ return (_c = (_b = this._spec.link.style) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : this._fillByLink(datum);
22155
+ };
22156
+ }
22157
+ initData() {
22158
+ var _a;
22159
+ super.initData();
22160
+ const { dataSet } = this._option;
22161
+ const compareSubData = new DataView(dataSet, { name: `compare-sankey-sub-data-${this.id}-data` });
22162
+ compareSubData.parse([this.getViewData()], {
22163
+ type: 'dataview'
22164
+ });
22165
+ this._subData = compareSubData;
22166
+ const compareNodeData = new DataView(dataSet, { name: `compare-sankey-node-${this.id}-data` });
22167
+ compareNodeData.parse([compareSubData], {
22168
+ type: 'dataview'
22169
+ });
22170
+ vchart.registerDataSetInstanceTransform(this._dataSet, 'compareSankeySubData', compareSankeySubData);
22171
+ compareSubData.transform({
22172
+ type: 'compareSankeySubData',
22173
+ options: {
22174
+ rawData: () => this.getRawData(),
22175
+ valueField: this._valueField,
22176
+ nodeKey: this._spec.nodeKey,
22177
+ subNodeGap: (_a = this._spec.subNodeGap) !== null && _a !== void 0 ? _a : 2
22178
+ }
22179
+ });
22180
+ vchart.registerDataSetInstanceTransform(this._dataSet, 'compareSankeySubNodes', compareSankeySubNodes);
22181
+ compareNodeData.transform({
22182
+ type: 'compareSankeySubNodes'
22183
+ });
22184
+ this._nodesSeriesData.parse([compareNodeData], {
22185
+ type: 'dataview'
22186
+ });
22187
+ this._activeLinkData = new DataView(dataSet, { name: `compare-sankey-link-${this.id}-data` });
22188
+ }
22189
+ initEvent() {
22190
+ var _a;
22191
+ super.initEvent();
22192
+ (_a = this._activeLinkData) === null || _a === void 0 ? void 0 : _a.target.addListener('change', this.activeLinkDataUpdate.bind(this));
22193
+ }
22194
+ initMark() {
22195
+ super.initMark();
22196
+ const linkMark = this._createMark(Object.assign(Object.assign({}, vchart.SankeySeries.mark.link), { name: 'activeLink' }), {
22197
+ dataView: this._activeLinkData
22198
+ });
22199
+ if (linkMark) {
22200
+ this._activeLinkMark = linkMark;
22201
+ }
22202
+ }
22203
+ compileData() {
22204
+ var _a;
22205
+ super.compileData();
22206
+ (_a = this._activeLinkMark) === null || _a === void 0 ? void 0 : _a.compileData();
22207
+ }
22208
+ _initLinkMarkStyle() {
22209
+ super._initLinkMarkStyle();
22210
+ this._activeLinkMark.setGlyphConfig({
22211
+ direction: this.direction
22212
+ });
22213
+ this.setMarkStyle(this._activeLinkMark, {
22214
+ x0: (datum) => datum.x0,
22215
+ x1: (datum) => datum.x1,
22216
+ y0: (datum) => datum.y0,
22217
+ y1: (datum) => datum.y1,
22218
+ thickness: (datum) => datum.thickness
22219
+ }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
22220
+ this.setMarkStyle(this._activeLinkMark, {
22221
+ fill: this._fillActiveLink
22222
+ }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.User_Mark);
22223
+ }
22224
+ _initNodeMarkStyle() {
22225
+ super._initNodeMarkStyle();
22226
+ if (this._spec.compareNodeColor) {
22227
+ this.setMarkStyle(this._nodeMark, {
22228
+ fill: this._fillCompareNode
22229
+ }, 'normal', vchart.AttributeLevel.User_Mark);
22230
+ }
22231
+ }
22232
+ activeLinkDataUpdate() {
22233
+ this._activeLinkMark.getData().updateData();
22234
+ }
22235
+ _handleNodeRelatedClick(graphic) {
22236
+ const nodeDatum = vchart.getDatumOfGraphic(graphic);
22237
+ const allNodeElements = this._nodeMark.getGraphics();
22238
+ if (!allNodeElements || !allNodeElements.length) {
22239
+ return;
22240
+ }
22241
+ const allLinkElements = this._linkMark.getGraphics();
22242
+ if (!allLinkElements || !allLinkElements.length) {
22243
+ return;
22244
+ }
22245
+ allLinkElements.forEach(el => {
22246
+ el.removeState([vchart.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]);
22247
+ });
22248
+ this._highLightElements(allLinkElements, []);
22249
+ const nodeDatums = allNodeElements.map(el => vchart.getDatumOfGraphic(el));
22250
+ const pickNodeDatums = nodeDatums.filter(d => d.key === nodeDatum.key);
22251
+ const highlightLinksData = [];
22252
+ const highlightNodeKeys = [];
22253
+ this._activeTargetLink(nodeDatum, pickNodeDatums, allNodeElements, allLinkElements, highlightNodeKeys, highlightLinksData);
22254
+ this._activeSourceLink(nodeDatum, pickNodeDatums, nodeDatums, allNodeElements, highlightNodeKeys, highlightLinksData);
22255
+ this._highLightElements(allNodeElements, highlightNodeKeys);
22256
+ this._activeLinkData.parseNewData(highlightLinksData);
22257
+ this._needClear = true;
22258
+ }
22259
+ _activeTargetLink(nodeDatum, pickNodeDatums, allNodeElements, allLinkElements, highlightNodeKeys, highlightLinksData) {
22260
+ this._handleClearEmpty();
22261
+ const sourceNode = nodeDatum.sourceNode;
22262
+ const firstTarget = sourceNode.targetLinks[0];
22263
+ if (!firstTarget) {
22264
+ return;
22265
+ }
22266
+ let percent = 0;
22267
+ pickNodeDatums.forEach(n => {
22268
+ const link = n.targetLinks.find((l) => l.key === firstTarget.key);
22269
+ if (link) {
22270
+ const p = link.value / firstTarget.value;
22271
+ const key = firstTarget.key + '_' + n.type;
22272
+ const activeLink = Object.assign(Object.assign({}, firstTarget), { y0: firstTarget.y0 - firstTarget.thickness / 2 + (percent + p / 2) * firstTarget.thickness, y1: n.y0 + (p * firstTarget.thickness) / 2, thickness: p * firstTarget.thickness, key, type: n.type, [vchart.DEFAULT_DATA_INDEX]: highlightLinksData.length, [vchart.DEFAULT_DATA_KEY]: key });
22273
+ highlightLinksData.push(activeLink);
22274
+ percent += p;
22275
+ }
22276
+ });
22277
+ highlightNodeKeys.push(...firstTarget.parents, nodeDatum.key);
22278
+ const linkKeys = [];
22279
+ for (let i = 0; i < firstTarget.parents.length - 1; i++) {
22280
+ linkKeys.push(firstTarget.parents[i] + '-' + firstTarget.parents[i + 1]);
22281
+ }
22282
+ this._highLightElements(allLinkElements, linkKeys);
22283
+ }
22284
+ _activeSourceLink(nodeDatum, pickNodeDatums, allNodeDatums, allNodeElements, highlightNodeKeys, highlightLinksData) {
22285
+ this._handleClearEmpty();
22286
+ const sourceNode = nodeDatum.sourceNode;
22287
+ const sourceLinks = sourceNode.sourceLinks;
22288
+ if (!(sourceLinks === null || sourceLinks === void 0 ? void 0 : sourceLinks.length)) {
22289
+ return;
22290
+ }
22291
+ const sourceValueTemp = {};
22292
+ sourceLinks.forEach((sourceLink) => {
22293
+ highlightNodeKeys.push(sourceLink.target);
22294
+ pickNodeDatums.forEach((n, index) => {
22295
+ var _a;
22296
+ sourceValueTemp[n.type] = (_a = sourceValueTemp[n.type]) !== null && _a !== void 0 ? _a : 0;
22297
+ const link = n.sourceLinks.find((l) => l.key === sourceLink.key);
22298
+ if (link) {
22299
+ const p = link.value / n.value;
22300
+ const totalSize = n.y1 - n.y0;
22301
+ const size = totalSize * p;
22302
+ const key = sourceLink.key + '_' + n.type;
22303
+ const activeLink = Object.assign(Object.assign({}, sourceLink), { y0: n.y0 + sourceValueTemp[n.type] * totalSize + size / 2, thickness: size, key, type: n.type, [vchart.DEFAULT_DATA_INDEX]: highlightLinksData.length, [vchart.DEFAULT_DATA_KEY]: key });
22304
+ if (index === 0) {
22305
+ activeLink.y1 = sourceLink.y1 - sourceLink.thickness / 2 + size / 2;
22306
+ }
22307
+ else {
22308
+ const targetNode = allNodeDatums.find(_n => _n.key === link.target && _n.type === n.type);
22309
+ if (targetNode) {
22310
+ activeLink.y1 = targetNode.y0 + size / 2;
22311
+ }
22312
+ else {
22313
+ return;
22314
+ }
22315
+ }
22316
+ highlightLinksData.push(activeLink);
22317
+ sourceValueTemp[n.type] += p;
22318
+ }
22319
+ });
22320
+ });
22321
+ }
22322
+ _handleClearEmpty() {
22323
+ super._handleClearEmpty();
22324
+ this._activeLinkData.parseNewData([]);
22325
+ const allNodeElements = this._nodeMark.getGraphics();
22326
+ if (allNodeElements || !allNodeElements.length) {
22327
+ allNodeElements.forEach(el => {
22328
+ el.removeState(vchart.STATE_VALUE_ENUM.STATE_HOVER);
22329
+ });
22330
+ }
22331
+ const allLinkElements = this._linkMark.getGraphics();
22332
+ if (allLinkElements || !allLinkElements.length) {
22333
+ allLinkElements.forEach(el => {
22334
+ el.removeState(vchart.STATE_VALUE_ENUM.STATE_HOVER);
22335
+ });
22336
+ }
22337
+ }
22338
+ }
22339
+ const registerCompareSankeyChart = (option) => {
22340
+ vchart.registerMarkFilterTransform();
22341
+ const vchartConstructor = (option === null || option === void 0 ? void 0 : option.VChart) || vchart.VChart;
22342
+ if (vchartConstructor) {
22343
+ vchartConstructor.useChart([CompareSankeyChart]);
22344
+ vchartConstructor.useSeries([CompareSankeySeries]);
22345
+ }
22346
+ };
22347
+
22250
22348
  const GROUP_ATTRIBUTES = ["x", "y", "dx", "dy", "scaleX", "scaleY", "angle", "anchor", "postMatrix", "visible", "clip", "pickable", "childrenPickable", "zIndex", "cursor"];
22251
22349
  class AbstractComponent extends Group {
22252
22350
  constructor(attributes, options) {
@@ -25317,6 +25415,8 @@
25317
25415
  exports.Bar3dSeries = Bar3dSeries;
25318
25416
  exports.Bar3dSeriesSpecTransformer = Bar3dSeriesSpecTransformer;
25319
25417
  exports.BarLinkComponent = BarLinkComponent;
25418
+ exports.CompareSankeyChart = CompareSankeyChart;
25419
+ exports.CompareSankeySeries = CompareSankeySeries;
25320
25420
  exports.ConversionFunnelChart = ConversionFunnelChart;
25321
25421
  exports.ConversionFunnelSeries = ConversionFunnelSeries;
25322
25422
  exports.DefaultBandWidth = DefaultBandWidth;
@@ -25340,7 +25440,6 @@
25340
25440
  exports.RankingBar = RankingBar;
25341
25441
  exports.RankingList = RankingList;
25342
25442
  exports.SERIES_BREAK = SERIES_BREAK;
25343
- exports.SequenceAnalysis = SequenceAnalysis;
25344
25443
  exports.SequenceScatterKDE = SequenceScatterKDE;
25345
25444
  exports.SequenceScatterLink = SequenceScatterLink;
25346
25445
  exports.SequenceScatterPixel = SequenceScatterPixel;
@@ -25362,6 +25461,7 @@
25362
25461
  exports.registerBar3dChart = registerBar3dChart;
25363
25462
  exports.registerBar3dSeries = registerBar3dSeries;
25364
25463
  exports.registerBarLink = registerBarLink;
25464
+ exports.registerCompareSankeyChart = registerCompareSankeyChart;
25365
25465
  exports.registerConversionFunnelChart = registerConversionFunnelChart;
25366
25466
  exports.registerFunnel3dChart = registerFunnel3dChart;
25367
25467
  exports.registerFunnel3dSeries = registerFunnel3dSeries;
@@ -25377,7 +25477,6 @@
25377
25477
  exports.registerRankingBarChart = registerRankingBarChart;
25378
25478
  exports.registerRankingList = registerRankingList;
25379
25479
  exports.registerSVGSource = registerSVGSource;
25380
- exports.registerSequenceAnalysis = registerSequenceAnalysis;
25381
25480
  exports.registerSequenceScatterKDE = registerSequenceScatterKDE;
25382
25481
  exports.registerSequenceScatterLink = registerSequenceScatterLink;
25383
25482
  exports.registerSequenceScatterPixel = registerSequenceScatterPixel;