@visactor/vchart 1.7.4 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +29256 -32302
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/base-chart.js +2 -1
  6. package/cjs/chart/base-chart.js.map +1 -1
  7. package/cjs/component/axis/base-axis.d.ts +5 -2
  8. package/cjs/component/axis/base-axis.js +41 -14
  9. package/cjs/component/axis/base-axis.js.map +1 -1
  10. package/cjs/component/axis/cartesian/axis.d.ts +2 -1
  11. package/cjs/component/axis/cartesian/axis.js +10 -28
  12. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  13. package/cjs/component/axis/cartesian/time-axis.js +9 -17
  14. package/cjs/component/axis/cartesian/time-axis.js.map +1 -1
  15. package/cjs/component/axis/mixin/linear-axis-mixin.js +11 -15
  16. package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  17. package/cjs/component/axis/polar/axis.d.ts +2 -0
  18. package/cjs/component/axis/polar/axis.js +10 -26
  19. package/cjs/component/axis/polar/axis.js.map +1 -1
  20. package/cjs/component/brush/brush.js +2 -3
  21. package/cjs/component/brush/brush.js.map +1 -1
  22. package/cjs/component/data-zoom/data-zoom/data-zoom.js +26 -24
  23. package/cjs/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  24. package/cjs/component/geo/projection.js +10 -6
  25. package/cjs/component/geo/projection.js.map +1 -1
  26. package/cjs/component/marker/base-marker.js +4 -10
  27. package/cjs/component/marker/base-marker.js.map +1 -1
  28. package/cjs/component/marker/mark-area/mark-area.js +16 -15
  29. package/cjs/component/marker/mark-area/mark-area.js.map +1 -1
  30. package/cjs/component/marker/mark-line/mark-line.js +22 -21
  31. package/cjs/component/marker/mark-line/mark-line.js.map +1 -1
  32. package/cjs/component/marker/mark-point/mark-point.js +30 -26
  33. package/cjs/component/marker/mark-point/mark-point.js.map +1 -1
  34. package/cjs/core/index.d.ts +1 -1
  35. package/cjs/core/index.js +1 -1
  36. package/cjs/core/index.js.map +1 -1
  37. package/cjs/event/events/dimension/util/cartesian.js +5 -17
  38. package/cjs/event/events/dimension/util/cartesian.js.map +1 -1
  39. package/cjs/event/events/dimension/util/common.d.ts +1 -0
  40. package/cjs/event/events/dimension/util/common.js +9 -1
  41. package/cjs/event/events/dimension/util/common.js.map +1 -1
  42. package/cjs/event/events/dimension/util/polar.js +4 -17
  43. package/cjs/event/events/dimension/util/polar.js.map +1 -1
  44. package/cjs/series/area/area.js +8 -8
  45. package/cjs/series/area/area.js.map +1 -1
  46. package/cjs/series/area/interface.d.ts +2 -2
  47. package/cjs/series/area/interface.js.map +1 -1
  48. package/cjs/series/bar/bar.js +3 -3
  49. package/cjs/series/bar/bar.js.map +1 -1
  50. package/cjs/series/bar/interface.d.ts +2 -2
  51. package/cjs/series/bar/interface.js.map +1 -1
  52. package/cjs/series/circle-packing/circle-packing.js +2 -2
  53. package/cjs/series/circle-packing/circle-packing.js.map +1 -1
  54. package/cjs/series/correlation/correlation.js +30 -26
  55. package/cjs/series/correlation/correlation.js.map +1 -1
  56. package/cjs/series/dot/dot.js +2 -2
  57. package/cjs/series/dot/dot.js.map +1 -1
  58. package/cjs/series/funnel/funnel.js +8 -8
  59. package/cjs/series/funnel/funnel.js.map +1 -1
  60. package/cjs/series/line/interface.d.ts +2 -2
  61. package/cjs/series/line/interface.js.map +1 -1
  62. package/cjs/series/pie/pie.d.ts +2 -0
  63. package/cjs/series/pie/pie.js +29 -23
  64. package/cjs/series/pie/pie.js.map +1 -1
  65. package/cjs/series/rose/rose.d.ts +3 -0
  66. package/cjs/series/rose/rose.js +15 -2
  67. package/cjs/series/rose/rose.js.map +1 -1
  68. package/cjs/series/sankey/sankey.js +8 -7
  69. package/cjs/series/sankey/sankey.js.map +1 -1
  70. package/cjs/series/scatter/interface.d.ts +2 -2
  71. package/cjs/series/scatter/interface.js.map +1 -1
  72. package/cjs/series/word-cloud/base.d.ts +3 -0
  73. package/cjs/series/word-cloud/base.js +86 -73
  74. package/cjs/series/word-cloud/base.js.map +1 -1
  75. package/cjs/series/word-cloud/word-cloud-3d.d.ts +22 -1
  76. package/cjs/series/word-cloud/word-cloud-3d.js +29 -148
  77. package/cjs/series/word-cloud/word-cloud-3d.js.map +1 -1
  78. package/cjs/typings/spec/chart.d.ts +2 -1
  79. package/cjs/typings/spec/chart.js.map +1 -1
  80. package/cjs/util/model.d.ts +1 -0
  81. package/cjs/util/model.js +15 -1
  82. package/cjs/util/model.js.map +1 -1
  83. package/esm/chart/base-chart.js +2 -1
  84. package/esm/chart/base-chart.js.map +1 -1
  85. package/esm/component/axis/base-axis.d.ts +5 -2
  86. package/esm/component/axis/base-axis.js +47 -13
  87. package/esm/component/axis/base-axis.js.map +1 -1
  88. package/esm/component/axis/cartesian/axis.d.ts +2 -1
  89. package/esm/component/axis/cartesian/axis.js +9 -34
  90. package/esm/component/axis/cartesian/axis.js.map +1 -1
  91. package/esm/component/axis/cartesian/time-axis.js +9 -17
  92. package/esm/component/axis/cartesian/time-axis.js.map +1 -1
  93. package/esm/component/axis/mixin/linear-axis-mixin.js +7 -5
  94. package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  95. package/esm/component/axis/polar/axis.d.ts +2 -0
  96. package/esm/component/axis/polar/axis.js +9 -32
  97. package/esm/component/axis/polar/axis.js.map +1 -1
  98. package/esm/component/brush/brush.js +2 -3
  99. package/esm/component/brush/brush.js.map +1 -1
  100. package/esm/component/data-zoom/data-zoom/data-zoom.js +26 -24
  101. package/esm/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  102. package/esm/component/geo/projection.js +10 -6
  103. package/esm/component/geo/projection.js.map +1 -1
  104. package/esm/component/marker/base-marker.js +5 -9
  105. package/esm/component/marker/base-marker.js.map +1 -1
  106. package/esm/component/marker/mark-area/mark-area.js +16 -15
  107. package/esm/component/marker/mark-area/mark-area.js.map +1 -1
  108. package/esm/component/marker/mark-line/mark-line.js +22 -21
  109. package/esm/component/marker/mark-line/mark-line.js.map +1 -1
  110. package/esm/component/marker/mark-point/mark-point.js +30 -26
  111. package/esm/component/marker/mark-point/mark-point.js.map +1 -1
  112. package/esm/core/index.d.ts +1 -1
  113. package/esm/core/index.js +1 -1
  114. package/esm/core/index.js.map +1 -1
  115. package/esm/event/events/dimension/util/cartesian.js +7 -18
  116. package/esm/event/events/dimension/util/cartesian.js.map +1 -1
  117. package/esm/event/events/dimension/util/common.d.ts +1 -0
  118. package/esm/event/events/dimension/util/common.js +5 -0
  119. package/esm/event/events/dimension/util/common.js.map +1 -1
  120. package/esm/event/events/dimension/util/polar.js +6 -17
  121. package/esm/event/events/dimension/util/polar.js.map +1 -1
  122. package/esm/series/area/area.js +8 -8
  123. package/esm/series/area/area.js.map +1 -1
  124. package/esm/series/area/interface.d.ts +2 -2
  125. package/esm/series/area/interface.js.map +1 -1
  126. package/esm/series/bar/bar.js +3 -3
  127. package/esm/series/bar/bar.js.map +1 -1
  128. package/esm/series/bar/interface.d.ts +2 -2
  129. package/esm/series/bar/interface.js.map +1 -1
  130. package/esm/series/circle-packing/circle-packing.js +2 -2
  131. package/esm/series/circle-packing/circle-packing.js.map +1 -1
  132. package/esm/series/correlation/correlation.js +30 -26
  133. package/esm/series/correlation/correlation.js.map +1 -1
  134. package/esm/series/dot/dot.js +2 -2
  135. package/esm/series/dot/dot.js.map +1 -1
  136. package/esm/series/funnel/funnel.js +8 -8
  137. package/esm/series/funnel/funnel.js.map +1 -1
  138. package/esm/series/line/interface.d.ts +2 -2
  139. package/esm/series/line/interface.js.map +1 -1
  140. package/esm/series/pie/pie.d.ts +2 -0
  141. package/esm/series/pie/pie.js +26 -19
  142. package/esm/series/pie/pie.js.map +1 -1
  143. package/esm/series/rose/rose.d.ts +3 -0
  144. package/esm/series/rose/rose.js +15 -2
  145. package/esm/series/rose/rose.js.map +1 -1
  146. package/esm/series/sankey/sankey.js +8 -7
  147. package/esm/series/sankey/sankey.js.map +1 -1
  148. package/esm/series/scatter/interface.d.ts +2 -2
  149. package/esm/series/scatter/interface.js.map +1 -1
  150. package/esm/series/word-cloud/base.d.ts +3 -0
  151. package/esm/series/word-cloud/base.js +86 -73
  152. package/esm/series/word-cloud/base.js.map +1 -1
  153. package/esm/series/word-cloud/word-cloud-3d.d.ts +22 -1
  154. package/esm/series/word-cloud/word-cloud-3d.js +29 -153
  155. package/esm/series/word-cloud/word-cloud-3d.js.map +1 -1
  156. package/esm/typings/spec/chart.d.ts +2 -1
  157. package/esm/typings/spec/chart.js.map +1 -1
  158. package/esm/util/model.d.ts +1 -0
  159. package/esm/util/model.js +12 -0
  160. package/esm/util/model.js.map +1 -1
  161. package/package.json +9 -9
@@ -18,7 +18,7 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
18
18
  (0, vutils_2.isValid)(fontSizeRange) ? this._fontSizeRange = fontSizeRange : this._fontSizeRange = config_1.DEFAULT_FONTSIZE_RANGE;
19
19
  }
20
20
  setAttrFromSpec() {
21
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
21
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
22
22
  super.setAttrFromSpec(), this._padding = this._option.getChart().padding, this._nameField = this._spec.nameField,
23
23
  this._fontFamilyField = this._spec.fontFamilyField, this._fontWeightField = this._spec.fontWeightField,
24
24
  this._fontStyleField = this._spec.fontStyleField, this._colorHexField = this._spec.colorHexField,
@@ -28,7 +28,8 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
28
28
  this._rotateAngles = null !== (_c = this._spec.rotateAngles) && void 0 !== _c ? _c : config_1.DEFAULT_ROTATE_ANGLES,
29
29
  this.setFontSizeRange(this._spec.fontSizeRange), this._maskShape = null !== (_d = this._spec.maskShape) && void 0 !== _d ? _d : config_1.DEFAULT_MASK_SHAPE,
30
30
  this._keepAspect = this._spec.keepAspect, this._random = null !== (_e = this._spec.random) && void 0 !== _e ? _e : config_1.DEFAULT_RANDOM,
31
- this._fontPadding = null !== (_m = null !== (_h = null === (_g = null === (_f = this._spec) || void 0 === _f ? void 0 : _f.word) || void 0 === _g ? void 0 : _g.padding) && void 0 !== _h ? _h : null === (_l = null === (_k = null === (_j = this._theme) || void 0 === _j ? void 0 : _j.wordCloud) || void 0 === _k ? void 0 : _k.word) || void 0 === _l ? void 0 : _l.padding) && void 0 !== _m ? _m : config_1.DEFAULT_FONT_PADDING,
31
+ this._fontPadding = null !== (_g = null === (_f = this._spec.word) || void 0 === _f ? void 0 : _f.padding) && void 0 !== _g ? _g : config_1.DEFAULT_FONT_PADDING,
32
+ this._textField = (null === (_h = this._spec.word) || void 0 === _h ? void 0 : _h.formatMethod) ? word_cloud_1.WORD_CLOUD_TEXT : this._nameField,
32
33
  this._wordCloudConfig = Object.assign({
33
34
  drawOutOfBound: config_1.DEFAULT_DRAW_OUT_OF_BOUND,
34
35
  layoutMode: "default",
@@ -37,8 +38,7 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
37
38
  fillingSeriesField: this.getSeriesField(),
38
39
  fillingRotateAngles: config_1.DEFAULT_ROTATE_ANGLES,
39
40
  layoutMode: "default"
40
- }, null === (_o = this._spec) || void 0 === _o ? void 0 : _o.wordCloudShapeConfig),
41
- this._fillingFontPadding = null !== (_v = null !== (_r = null === (_q = null === (_p = this._spec) || void 0 === _p ? void 0 : _p.fillingWord) || void 0 === _q ? void 0 : _q.padding) && void 0 !== _r ? _r : null === (_u = null === (_t = null === (_s = this._theme) || void 0 === _s ? void 0 : _s.wordCloud) || void 0 === _t ? void 0 : _t.fillingWord) || void 0 === _u ? void 0 : _u.padding) && void 0 !== _v ? _v : config_1.DEFAULT_FONT_PADDING,
41
+ }, this._spec.wordCloudShapeConfig), this._fillingFontPadding = null !== (_k = null === (_j = this._spec.fillingWord) || void 0 === _j ? void 0 : _j.padding) && void 0 !== _k ? _k : config_1.DEFAULT_FONT_PADDING,
42
42
  this._isWordCloudShape = !config_1.SHAPE_TYPE.includes(this._maskShape), this._defaultFontFamily = this._option.getTheme().fontFamily;
43
43
  }
44
44
  initMark() {
@@ -49,11 +49,11 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
49
49
  }), this._isWordCloudShape && (this._fillingWordMark = this._createMark(BaseWordCloudSeries.mark.fillingWord));
50
50
  }
51
51
  initMarkStyle() {
52
- var _a, _b, _c, _d, _e, _f, _g;
53
- const wordMark = this._wordMark, fillingWordMark = this._fillingWordMark, textField = (null === (_a = this._spec.word) || void 0 === _a ? void 0 : _a.formatMethod) ? word_cloud_1.WORD_CLOUD_TEXT : this._nameField;
52
+ var _a, _b, _c, _d, _e;
53
+ const wordMark = this._wordMark, fillingWordMark = this._fillingWordMark, wordSpec = null !== (_a = this._spec.word) && void 0 !== _a ? _a : {};
54
54
  wordMark && (this.setMarkStyle(wordMark, {
55
55
  fill: this._colorHexField ? datum => datum[this._colorHexField] : this.getWordColorAttribute(this._seriesField, !1),
56
- text: datum => datum[textField],
56
+ text: datum => datum[this._textField],
57
57
  x: datum => datum.x,
58
58
  y: datum => datum.y,
59
59
  fontFamily: datum => datum.fontFamily,
@@ -63,10 +63,10 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
63
63
  angle: datum => datum.angle,
64
64
  visible: datum => !datum.isFillingWord
65
65
  }, "normal", constant_1.AttributeLevel.Series), this.setMarkStyle(wordMark, {
66
- fontFamily: null !== (_d = null === (_c = null === (_b = this._spec.word) || void 0 === _b ? void 0 : _b.style) || void 0 === _c ? void 0 : _c.fontFamily) && void 0 !== _d ? _d : this._defaultFontFamily
66
+ fontFamily: null !== (_c = null === (_b = wordSpec.style) || void 0 === _b ? void 0 : _b.fontFamily) && void 0 !== _c ? _c : this._defaultFontFamily
67
67
  }, "normal", constant_1.AttributeLevel.User_Mark)), fillingWordMark && (this.setMarkStyle(fillingWordMark, {
68
68
  fill: this._wordCloudShapeConfig.fillingColorHexField ? datum => datum[this._wordCloudShapeConfig.fillingColorHexField] : this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField, !0),
69
- text: datum => datum[textField],
69
+ text: datum => datum[this._textField],
70
70
  x: datum => datum.x,
71
71
  y: datum => datum.y,
72
72
  fontFamily: datum => datum.fontFamily,
@@ -76,7 +76,7 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
76
76
  angle: datum => datum.angle,
77
77
  visible: datum => datum.isFillingWord
78
78
  }, "normal", constant_1.AttributeLevel.Series), this.setMarkStyle(fillingWordMark, {
79
- fontFamily: null !== (_g = null === (_f = null === (_e = this._spec.word) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontFamily) && void 0 !== _g ? _g : this._defaultFontFamily
79
+ fontFamily: null !== (_e = null === (_d = wordSpec.style) || void 0 === _d ? void 0 : _d.fontFamily) && void 0 !== _e ? _e : this._defaultFontFamily
80
80
  }, "normal", constant_1.AttributeLevel.User_Mark)), this._trigger.registerMark(wordMark),
81
81
  this._trigger.registerMark(fillingWordMark);
82
82
  }
@@ -114,11 +114,11 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
114
114
  return 1 === colorList.length && (colorList = [ colorList[0], colorList[0] ]), datum => colorList[0];
115
115
  }
116
116
  compile() {
117
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26;
117
+ var _a, _b;
118
118
  super.compile();
119
119
  const {width: width, height: height} = this._region.getLayoutRect();
120
120
  if (!(0, vutils_1.isValidNumber)(width) || !(0, vutils_1.isValidNumber)(height) || !(height > 0 && width > 0)) return;
121
- const wordCloudTransforms = [], valueField = this._valueField, valueScale = new vscale_1.LinearScale, fontWeightRange = this._fontWeightRange, rotateAngles = this._rotateAngles, fontWeightField = this._fontWeightField, fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;
121
+ const wordCloudTransforms = [], valueField = this._valueField, valueScale = new vscale_1.LinearScale, fontWeightRange = this._fontWeightRange, rotateAngles = this._rotateAngles, fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;
122
122
  if (valueField) {
123
123
  const [minValue, maxValue] = (0, vgrammar_util_1.extent)(null === (_a = this.getViewData()) || void 0 === _a ? void 0 : _a.latestData.map((datum => +datum[valueField])));
124
124
  valueScale.domain([ minValue, maxValue ], !0).range(fontWeightRange), wordCloudTransforms.push({
@@ -135,82 +135,45 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
135
135
  type: "map",
136
136
  as: word_cloud_1.WORD_CLOUD_FILLING_ANGLE,
137
137
  callback: () => fillingRotateAngles[Math.floor(Math.random() * fillingRotateAngles.length)]
138
- }), (null === (_b = this._spec.word) || void 0 === _b ? void 0 : _b.formatMethod) && wordCloudTransforms.push({
138
+ });
139
+ const wordSpec = null !== (_b = this._spec.word) && void 0 !== _b ? _b : {};
140
+ wordSpec.formatMethod && wordCloudTransforms.push({
139
141
  type: "map",
140
142
  as: word_cloud_1.WORD_CLOUD_TEXT,
141
- callback: this._spec.word.formatMethod
142
- });
143
- const textField = (null === (_c = this._spec.word) || void 0 === _c ? void 0 : _c.formatMethod) ? word_cloud_1.WORD_CLOUD_TEXT : this._nameField;
144
- this._isWordCloudShape ? wordCloudTransforms.push({
145
- type: "wordcloudShape",
146
- dataIndexKey: constant_1.DEFAULT_DATA_KEY,
147
- size: [ width, height ],
148
- shape: this._maskShape,
149
- text: {
150
- field: (null === (_l = this._spec.word) || void 0 === _l ? void 0 : _l.formatMethod) ? word_cloud_1.WORD_CLOUD_TEXT : this._nameField
151
- },
152
- fontSize: valueField ? {
153
- field: valueField
154
- } : this._fontSizeRange[0],
155
- fontSizeRange: this._fontSizeRange,
156
- padding: this._fontPadding,
157
- rotateList: rotateAngles,
158
- fontFamily: null !== (_q = null !== (_m = this._fontFamilyField) && void 0 !== _m ? _m : null === (_p = null === (_o = this._spec.word) || void 0 === _o ? void 0 : _o.style) || void 0 === _p ? void 0 : _p.fontFamily) && void 0 !== _q ? _q : this._defaultFontFamily,
159
- fontWeight: fontWeightField ? {
160
- field: fontWeightField
161
- } : valueField ? {
162
- field: word_cloud_1.WORD_CLOUD_WEIGHT
163
- } : null,
164
- fontStyle: null !== (_r = this._fontStyleField) && void 0 !== _r ? _r : null === (_t = null === (_s = this._spec.word) || void 0 === _s ? void 0 : _s.style) || void 0 === _t ? void 0 : _t.fontStyle,
165
- fillingFontFamily: null !== (_y = null !== (_v = null === (_u = this._wordCloudShapeConfig) || void 0 === _u ? void 0 : _u.fillingFontFamilyField) && void 0 !== _v ? _v : null === (_x = null === (_w = this._spec.word) || void 0 === _w ? void 0 : _w.style) || void 0 === _x ? void 0 : _x.fontFamily) && void 0 !== _y ? _y : this._defaultFontFamily,
166
- fillingPadding: this._fillingFontPadding,
167
- fillingFontStyle: null !== (_0 = null === (_z = this._wordCloudShapeConfig) || void 0 === _z ? void 0 : _z.fillingFontStyleField) && void 0 !== _0 ? _0 : null === (_2 = null === (_1 = this._spec.word) || void 0 === _1 ? void 0 : _1.style) || void 0 === _2 ? void 0 : _2.fontStyle,
168
- fillingFontWeight: null !== (_4 = null === (_3 = this._wordCloudShapeConfig) || void 0 === _3 ? void 0 : _3.fillingFontWeightField) && void 0 !== _4 ? _4 : null === (_6 = null === (_5 = this._spec.word) || void 0 === _5 ? void 0 : _5.style) || void 0 === _6 ? void 0 : _6.fontWeight,
169
- fillingRotateList: fillingRotateAngles,
170
- fillingTimes: null === (_7 = this._wordCloudShapeConfig) || void 0 === _7 ? void 0 : _7.fillingTimes,
171
- fillingXStep: null === (_8 = this._wordCloudShapeConfig) || void 0 === _8 ? void 0 : _8.fillingXStep,
172
- fillingYStep: null === (_9 = this._wordCloudShapeConfig) || void 0 === _9 ? void 0 : _9.fillingYStep,
173
- fillingXRatioStep: null === (_10 = this._wordCloudShapeConfig) || void 0 === _10 ? void 0 : _10.fillingXRatioStep,
174
- fillingYRatioStep: null === (_11 = this._wordCloudShapeConfig) || void 0 === _11 ? void 0 : _11.fillingYRatioStep,
175
- fillingInitialOpacity: null === (_12 = this._wordCloudShapeConfig) || void 0 === _12 ? void 0 : _12.fillingInitialOpacity,
176
- fillingDeltaOpacity: null === (_13 = this._wordCloudShapeConfig) || void 0 === _13 ? void 0 : _13.fillingDeltaOpacity,
177
- fillingInitialFontSize: null === (_14 = this._wordCloudShapeConfig) || void 0 === _14 ? void 0 : _14.fillingInitialFontSize,
178
- fillingDeltaFontSize: null === (_15 = this._wordCloudShapeConfig) || void 0 === _15 ? void 0 : _15.fillingDeltaFontSize,
179
- ratio: null === (_16 = this._wordCloudShapeConfig) || void 0 === _16 ? void 0 : _16.ratio,
180
- fillingRatio: null === (_17 = this._wordCloudShapeConfig) || void 0 === _17 ? void 0 : _17.fillingRatio,
181
- removeWhiteBorder: null === (_18 = this._wordCloudShapeConfig) || void 0 === _18 ? void 0 : _18.removeWhiteBorder,
182
- textLayoutTimes: null === (_19 = this._wordCloudShapeConfig) || void 0 === _19 ? void 0 : _19.textLayoutTimes,
183
- fontSizeShrinkFactor: null === (_20 = this._wordCloudShapeConfig) || void 0 === _20 ? void 0 : _20.fontSizeShrinkFactor,
184
- stepFactor: null === (_21 = this._wordCloudShapeConfig) || void 0 === _21 ? void 0 : _21.stepFactor,
185
- layoutMode: null === (_22 = this._wordCloudShapeConfig) || void 0 === _22 ? void 0 : _22.layoutMode,
186
- importantWordCount: null === (_23 = this._wordCloudShapeConfig) || void 0 === _23 ? void 0 : _23.importantWordCount,
187
- globalShinkLimit: null === (_24 = this._wordCloudShapeConfig) || void 0 === _24 ? void 0 : _24.globalShinkLimit,
188
- fontSizeEnlargeFactor: null === (_25 = this._wordCloudShapeConfig) || void 0 === _25 ? void 0 : _25.fontSizeEnlargeFactor,
189
- fillingDeltaFontSizeFactor: null === (_26 = this._wordCloudShapeConfig) || void 0 === _26 ? void 0 : _26.fillingDeltaFontSizeFactor
190
- }) : (wordCloudTransforms.push({
191
- type: "wordcloud",
143
+ callback: wordSpec.formatMethod
144
+ }), this._isWordCloudShape ? wordCloudTransforms.push(Object.assign({
145
+ type: "wordcloudShape"
146
+ }, this._wordCloudShapeTransformOption())) : (wordCloudTransforms.push(Object.assign({
147
+ type: "wordcloud"
148
+ }, this._wordCloudTransformOption())), this._wordMark.getProduct().transform(wordCloudTransforms)),
149
+ this._data.getProduct().transform(wordCloudTransforms);
150
+ }
151
+ _wordCloudTransformOption() {
152
+ var _a, _b, _c, _d, _e;
153
+ const {width: width, height: height} = this._region.getLayoutRect(), wordStyleSpec = null !== (_b = null === (_a = this._spec.word) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {};
154
+ return {
192
155
  layoutType: (0, env_1.isTrueBrowser)(this._option.mode) ? this._wordCloudConfig.layoutMode : "fast",
193
156
  size: [ width, height ],
194
157
  shape: this._maskShape,
195
158
  dataIndexKey: constant_1.DEFAULT_DATA_KEY,
196
159
  text: {
197
- field: textField
160
+ field: this._textField
198
161
  },
199
- fontSize: valueField ? {
200
- field: valueField
162
+ fontSize: this._valueField ? {
163
+ field: this._valueField
201
164
  } : this._fontSizeRange[0],
202
165
  fontSizeRange: this._fontSizeRange,
203
166
  padding: this._fontPadding,
204
167
  rotate: {
205
168
  field: word_cloud_1.WORD_CLOUD_ANGLE
206
169
  },
207
- fontFamily: null !== (_g = null !== (_d = this._fontFamilyField) && void 0 !== _d ? _d : null === (_f = null === (_e = this._spec.word) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontFamily) && void 0 !== _g ? _g : this._defaultFontFamily,
208
- fontWeight: fontWeightField ? {
209
- field: fontWeightField
210
- } : valueField ? {
170
+ fontFamily: null !== (_d = null !== (_c = this._fontFamilyField) && void 0 !== _c ? _c : wordStyleSpec.fontFamily) && void 0 !== _d ? _d : this._defaultFontFamily,
171
+ fontWeight: this._fontWeightField ? {
172
+ field: this._fontWeightField
173
+ } : this._valueField ? {
211
174
  field: word_cloud_1.WORD_CLOUD_WEIGHT
212
175
  } : null,
213
- fontStyle: null !== (_h = this._fontStyleField) && void 0 !== _h ? _h : null === (_k = null === (_j = this._spec.word) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.fontStyle,
176
+ fontStyle: null !== (_e = this._fontStyleField) && void 0 !== _e ? _e : wordStyleSpec.fontStyle,
214
177
  randomVisible: this._random,
215
178
  clip: "clip" === this._wordCloudConfig.drawOutOfBound,
216
179
  shrink: this._wordCloudConfig.zoomToFit.shrink,
@@ -218,7 +181,57 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
218
181
  minFontSize: this._wordCloudConfig.zoomToFit.fontSizeLimitMin,
219
182
  progressiveTime: this._wordCloudConfig.progressiveTime,
220
183
  progressiveStep: this._wordCloudConfig.progressiveStep
221
- }), this._wordMark.getProduct().transform(wordCloudTransforms)), this._data.getProduct().transform(wordCloudTransforms);
184
+ };
185
+ }
186
+ _wordCloudShapeTransformOption() {
187
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
188
+ const {width: width, height: height} = this._region.getLayoutRect(), wordStyleSpec = null !== (_b = null === (_a = this._spec.word) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, wordCloudShapeConfig = null !== (_c = this._wordCloudShapeConfig) && void 0 !== _c ? _c : {}, fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;
189
+ return {
190
+ dataIndexKey: constant_1.DEFAULT_DATA_KEY,
191
+ size: [ width, height ],
192
+ shape: this._maskShape,
193
+ text: {
194
+ field: this._textField
195
+ },
196
+ fontSize: this._valueField ? {
197
+ field: this._valueField
198
+ } : this._fontSizeRange[0],
199
+ fontSizeRange: this._fontSizeRange,
200
+ padding: this._fontPadding,
201
+ rotateList: this._rotateAngles,
202
+ fontFamily: null !== (_e = null !== (_d = this._fontFamilyField) && void 0 !== _d ? _d : wordStyleSpec.fontFamily) && void 0 !== _e ? _e : this._defaultFontFamily,
203
+ fontWeight: this._fontWeightField ? {
204
+ field: this._fontWeightField
205
+ } : this._valueField ? {
206
+ field: word_cloud_1.WORD_CLOUD_WEIGHT
207
+ } : null,
208
+ fontStyle: null !== (_f = this._fontStyleField) && void 0 !== _f ? _f : wordStyleSpec.fontStyle,
209
+ fillingFontFamily: null !== (_h = null !== (_g = wordCloudShapeConfig.fillingFontFamilyField) && void 0 !== _g ? _g : wordStyleSpec.fontFamily) && void 0 !== _h ? _h : this._defaultFontFamily,
210
+ fillingPadding: this._fillingFontPadding,
211
+ fillingFontStyle: null !== (_j = wordCloudShapeConfig.fillingFontStyleField) && void 0 !== _j ? _j : wordStyleSpec.fontStyle,
212
+ fillingFontWeight: null !== (_k = wordCloudShapeConfig.fillingFontWeightField) && void 0 !== _k ? _k : wordStyleSpec.fontWeight,
213
+ fillingRotateList: fillingRotateAngles,
214
+ fillingTimes: wordCloudShapeConfig.fillingTimes,
215
+ fillingXStep: wordCloudShapeConfig.fillingXStep,
216
+ fillingYStep: wordCloudShapeConfig.fillingYStep,
217
+ fillingXRatioStep: wordCloudShapeConfig.fillingXRatioStep,
218
+ fillingYRatioStep: wordCloudShapeConfig.fillingYRatioStep,
219
+ fillingInitialOpacity: wordCloudShapeConfig.fillingInitialOpacity,
220
+ fillingDeltaOpacity: wordCloudShapeConfig.fillingDeltaOpacity,
221
+ fillingInitialFontSize: wordCloudShapeConfig.fillingInitialFontSize,
222
+ fillingDeltaFontSize: wordCloudShapeConfig.fillingDeltaFontSize,
223
+ ratio: wordCloudShapeConfig.ratio,
224
+ fillingRatio: wordCloudShapeConfig.fillingRatio,
225
+ removeWhiteBorder: wordCloudShapeConfig.removeWhiteBorder,
226
+ textLayoutTimes: wordCloudShapeConfig.textLayoutTimes,
227
+ fontSizeShrinkFactor: wordCloudShapeConfig.fontSizeShrinkFactor,
228
+ stepFactor: wordCloudShapeConfig.stepFactor,
229
+ layoutMode: wordCloudShapeConfig.layoutMode,
230
+ importantWordCount: wordCloudShapeConfig.importantWordCount,
231
+ globalShinkLimit: wordCloudShapeConfig.globalShinkLimit,
232
+ fontSizeEnlargeFactor: wordCloudShapeConfig.fontSizeEnlargeFactor,
233
+ fillingDeltaFontSizeFactor: wordCloudShapeConfig.fillingDeltaFontSizeFactor
234
+ };
222
235
  }
223
236
  getStatisticFields() {
224
237
  const fields = [];
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/series/word-cloud/base.ts"],"names":[],"mappings":";;;AAEA,6CAAiD;AACjD,6CAA2C;AAC3C,6CAA6F;AAG7F,4CAAuD;AACvD,wCAA+C;AAC/C,qCAWkB;AAQlB,iDAA6E;AAC7E,6CAA+C;AAC/C,2DAAiD;AACjD,0DAKmC;AAEnC,qDAAiD;AACjD,yEAAoE;AACpE,yCAAiD;AAEjD,gDAA6C;AAK7C,MAAa,mBAAmF,SAAQ,wBAAa;IAArH;;QAoBY,mBAAc,GAAsB,CAAC,8BAAqB,EAAE,8BAAqB,CAAC,CAAC;QAUnF,sBAAiB,GAAY,KAAK,CAAC;IA6X/C,CAAC;IAtZC,aAAa,CAAC,KAAa;QACzB,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;YAClB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;SAC1B;IACH,CAAC;IAYD,gBAAgB,CAAC,aAA+B;QAC9C,IAAI,IAAA,gBAAO,EAAC,aAAa,CAAC,EAAE;YAC1B,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;SACrC;aAAM;YACL,IAAI,CAAC,cAAc,GAAG,+BAAsB,CAAC;SAC9C;IACH,CAAC;IAkBD,eAAe;;QACb,KAAK,CAAC,eAAe,EAAE,CAAC;QAExB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC;QAGhD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QACvC,IAAI,CAAC,gBAAgB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eAAe,CAAC,IAAS;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,eAAe,CAAC,MAAW,EAAE,MAAY;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc;QAEZ,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,mBAAmB;QAEjB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,kBAAkB;QAEhB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,WAAW,CAAC,GAAQ;QAClB,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACjD,CAAC;;AA1ZH,kDA2ZC;AA1ZiB,wBAAI,GAAkB,8BAAmB,CAAC","file":"base.js","sourcesContent":["/* eslint-disable no-duplicate-imports */\nimport type { IPadding } from '@visactor/vutils';\nimport { isValidNumber } from '@visactor/vutils';\nimport { isValid } from '@visactor/vutils';\nimport { AttributeLevel, DEFAULT_DATA_KEY, DEFAULT_DATA_SERIES_FIELD } from '../../constant';\nimport type { ITextMark } from '../../mark/text';\nimport type { SeriesMarkMap } from '../interface';\nimport { SeriesMarkNameEnum } from '../interface/type';\nimport { isTrueBrowser } from '../../util/env';\nimport {\n DEFAULT_DRAW_OUT_OF_BOUND,\n DEFAULT_FONTSIZE_RANGE,\n DEFAULT_FONT_PADDING,\n DEFAULT_FONT_WEIGHT_RANGE,\n DEFAULT_MASK_SHAPE,\n DEFAULT_MIN_FONT_SIZE,\n DEFAULT_RANDOM,\n DEFAULT_ROTATE_ANGLES,\n DEFAULT_ZOOM_TO_FIT,\n SHAPE_TYPE\n} from './config';\nimport type {\n IWordCloudSeriesSpec,\n WordCloudConfigType,\n WordCloudShapeConfigType,\n WordCloudShapeType\n} from './interface';\nimport type { Datum, IPoint } from '../../typings';\nimport { animationConfig, userAnimationConfig } from '../../animation/utils';\nimport { LinearScale } from '@visactor/vscale';\nimport { extent } from '@visactor/vgrammar-util';\nimport {\n WORD_CLOUD_ANGLE,\n WORD_CLOUD_FILLING_ANGLE,\n WORD_CLOUD_TEXT,\n WORD_CLOUD_WEIGHT\n} from '../../constant/word-cloud';\nimport type { ICompilableMark } from '../../compile/mark';\nimport { BaseSeries } from '../base/base-series';\nimport { ColorOrdinalScale } from '../../scale/color-ordinal-scale';\nimport { wordCloudSeriesMark } from './constant';\nimport type { IStateAnimateSpec } from '../../animation/spec';\nimport { Factory } from '../../core/factory';\nimport type { IMark } from '../../mark/interface';\n\nexport type IBaseWordCloudSeriesSpec = Omit<IWordCloudSeriesSpec, 'type'> & { type: string };\n\nexport class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IBaseWordCloudSeriesSpec> extends BaseSeries<T> {\n static readonly mark: SeriesMarkMap = wordCloudSeriesMark;\n\n protected _nameField: string;\n protected _valueField?: string;\n setValueField(field: string) {\n if (isValid(field)) {\n this._valueField = field;\n }\n }\n\n protected _fontFamilyField: string;\n protected _fontWeightField: string;\n protected _fontStyleField: string;\n protected _colorHexField: string;\n protected _colorMode: 'linear' | 'ordinal';\n protected _colorList: string[];\n protected _rotateAngles?: number[];\n protected _fontWeightRange?: [number, number];\n\n protected _fontSizeRange?: [number, number] = [DEFAULT_MIN_FONT_SIZE, DEFAULT_MIN_FONT_SIZE];\n setFontSizeRange(fontSizeRange: [number, number]) {\n if (isValid(fontSizeRange)) {\n this._fontSizeRange = fontSizeRange;\n } else {\n this._fontSizeRange = DEFAULT_FONTSIZE_RANGE;\n }\n }\n\n protected _maskShape?: string | WordCloudShapeType;\n protected _isWordCloudShape: boolean = false;\n\n protected _keepAspect?: boolean;\n protected _random?: boolean;\n protected _fontPadding?: number;\n protected _fillingFontPadding?: number;\n protected _wordCloudConfig?: WordCloudConfigType;\n protected _wordCloudShapeConfig?: WordCloudShapeConfigType;\n\n protected _padding?: IPadding;\n protected _defaultFontFamily: string;\n\n /**\n * @override\n */\n setAttrFromSpec() {\n super.setAttrFromSpec();\n // series布局相关\n this._padding = this._option.getChart().padding;\n\n // 普通词云 & 形状词云 共有spec相关\n this._nameField = this._spec.nameField;\n this._fontFamilyField = this._spec.fontFamilyField;\n this._fontWeightField = this._spec.fontWeightField;\n this._fontStyleField = this._spec.fontStyleField;\n this._colorHexField = this._spec.colorHexField;\n this._colorMode = this._spec.colorMode ?? 'ordinal';\n this._colorList = this._spec.colorList;\n this.setValueField(this._spec.valueField);\n this._fontWeightRange = this._spec.fontWeightRange ?? DEFAULT_FONT_WEIGHT_RANGE;\n this._rotateAngles = this._spec.rotateAngles ?? DEFAULT_ROTATE_ANGLES;\n this.setFontSizeRange(this._spec.fontSizeRange);\n this._maskShape = this._spec.maskShape ?? DEFAULT_MASK_SHAPE;\n this._keepAspect = this._spec.keepAspect;\n this._random = this._spec.random ?? DEFAULT_RANDOM;\n this._fontPadding = this._spec?.word?.padding ?? this._theme?.wordCloud?.word?.padding ?? DEFAULT_FONT_PADDING;\n\n // 普通词云spec相关\n this._wordCloudConfig = {\n drawOutOfBound: DEFAULT_DRAW_OUT_OF_BOUND,\n layoutMode: 'default',\n zoomToFit: DEFAULT_ZOOM_TO_FIT,\n ...this._spec.wordCloudConfig\n };\n\n // 形状词云spec相关\n this._wordCloudShapeConfig = {\n fillingSeriesField: this.getSeriesField(),\n fillingRotateAngles: DEFAULT_ROTATE_ANGLES,\n layoutMode: 'default',\n ...this._spec?.wordCloudShapeConfig\n };\n this._fillingFontPadding =\n this._spec?.fillingWord?.padding ?? this._theme?.wordCloud?.fillingWord?.padding ?? DEFAULT_FONT_PADDING;\n\n this._isWordCloudShape = !SHAPE_TYPE.includes(this._maskShape);\n this._defaultFontFamily = this._option.getTheme().fontFamily;\n }\n\n protected _wordMark: ITextMark;\n protected _fillingWordMark: ITextMark;\n initMark(): void {\n this._wordMark = this._createMark(BaseWordCloudSeries.mark.word, {\n defaultMorphElementKey: this._seriesField,\n groupKey: this._seriesField,\n isSeriesMark: true\n }) as ITextMark;\n if (this._isWordCloudShape) {\n this._fillingWordMark = this._createMark(BaseWordCloudSeries.mark.fillingWord) as ITextMark;\n }\n }\n\n initMarkStyle() {\n const wordMark = this._wordMark;\n const fillingWordMark = this._fillingWordMark;\n const textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;\n if (wordMark) {\n this.setMarkStyle(\n wordMark,\n {\n fill: this._colorHexField\n ? (datum: Datum) => datum[this._colorHexField]\n : this.getWordColorAttribute(this._seriesField, false),\n text: (datum: Datum) => datum[textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontFamily: (datum: Datum) => datum.fontFamily,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n fontWeight: (datum: Datum) => datum.fontWeight,\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => !datum.isFillingWord\n },\n 'normal',\n AttributeLevel.Series\n );\n this.setMarkStyle(\n wordMark,\n {\n fontFamily: this._spec.word?.style?.fontFamily ?? this._defaultFontFamily\n },\n 'normal',\n AttributeLevel.User_Mark\n );\n }\n if (fillingWordMark) {\n this.setMarkStyle(\n fillingWordMark,\n {\n fill: this._wordCloudShapeConfig.fillingColorHexField\n ? (datum: Datum) => datum[this._wordCloudShapeConfig.fillingColorHexField]\n : this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField, true),\n text: (datum: Datum) => datum[textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontFamily: (datum: Datum) => datum.fontFamily,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n fontWeight: (datum: Datum) => datum.fontWeight,\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => datum.isFillingWord\n },\n 'normal',\n AttributeLevel.Series\n );\n\n this.setMarkStyle(\n fillingWordMark,\n {\n fontFamily: this._spec.word?.style?.fontFamily ?? this._defaultFontFamily\n },\n 'normal',\n AttributeLevel.User_Mark\n );\n }\n this._trigger.registerMark(wordMark);\n this._trigger.registerMark(fillingWordMark);\n }\n\n protected initTooltip() {\n super.initTooltip();\n\n this._wordMark && this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark);\n this._fillingWordMark && this._tooltipHelper.activeTriggerSet.mark.add(this._fillingWordMark);\n }\n\n initAnimation() {\n [this._wordMark, this._fillingWordMark].forEach(mark => {\n if (mark) {\n const appearPreset = (this._spec?.animationAppear as IStateAnimateSpec<any>)?.preset;\n const params = {\n animationConfig: () => mark.getAnimationConfig()?.appear?.[0]\n };\n mark.setAnimationConfig(\n animationConfig(\n Factory.getAnimationInKey('wordCloud')(params, appearPreset),\n userAnimationConfig(SeriesMarkNameEnum.word, this._spec, this._markAttributeContext)\n )\n );\n }\n });\n }\n\n protected getWordOrdinalColorScale(field: string, isFillingWord: boolean) {\n const colorList = isFillingWord ? this._wordCloudShapeConfig.fillingColorList : this._colorList;\n const colorDomain = field ? this.getViewData()?.latestData.map((datum: Datum) => datum[field]) : [];\n const colorRange = colorList ?? this._option.globalScale.getScale('color')?.range() ?? this._getDataScheme();\n return new ColorOrdinalScale().domain(colorDomain).range?.(colorRange);\n }\n\n getWordColorAttribute(field: string, isFillingWord: boolean) {\n if (this._colorMode === 'ordinal') {\n return {\n scale: this.getWordOrdinalColorScale(field, isFillingWord),\n field: this._seriesField ?? DEFAULT_DATA_SERIES_FIELD\n };\n }\n // const valueScale = new LinearScale()\n // .domain(extent(this.getViewData()?.latestData.map((datum: Datum) => datum[field])), true)\n // .range([0, 1]);\n let colorList =\n (isFillingWord ? this._colorList : this._wordCloudShapeConfig.fillingColorList) ??\n this._option.globalScale.getScale('color').range();\n // 如果用户只输入了一个 color,无法构成 colorRange,则进行兜底\n if (colorList.length === 1) {\n colorList = [colorList[0], colorList[0]];\n }\n // 颜色插值 todo@chensiji\n // const interpolate = interpolateColors(colorList)\n // return (datum: Datum) => interpolate(valueScale.scale(datum[field]))\n return (datum: Datum) => colorList[0];\n }\n\n compile(): void {\n super.compile();\n const { width, height } = this._region.getLayoutRect();\n // 非正常尺寸下不进行布局\n if (!isValidNumber(width) || !isValidNumber(height) || !(height > 0 && width > 0)) {\n return;\n }\n\n const wordCloudTransforms: any[] = [];\n const valueField = this._valueField;\n const valueScale = new LinearScale();\n const fontWeightRange = this._fontWeightRange;\n const rotateAngles = this._rotateAngles;\n const fontWeightField = this._fontWeightField;\n const fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;\n\n // fontWeight处理\n if (valueField) {\n const [minValue, maxValue] = extent(this.getViewData()?.latestData.map((datum: any) => +datum[valueField]));\n valueScale.domain([minValue, maxValue], true).range(fontWeightRange);\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_WEIGHT,\n callback: (datum: any) => {\n if (minValue === maxValue) {\n return valueScale.scale(maxValue);\n }\n return valueScale.scale(datum[valueField]);\n }\n });\n }\n\n // rotateAngles处理\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_ANGLE,\n callback: () => {\n return rotateAngles[Math.floor(Math.random() * rotateAngles.length)];\n }\n });\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_FILLING_ANGLE,\n callback: () => {\n return fillingRotateAngles[Math.floor(Math.random() * fillingRotateAngles.length)];\n }\n });\n\n // text fromat method 处理\n if (this._spec.word?.formatMethod) {\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_TEXT,\n callback: this._spec.word.formatMethod\n });\n }\n\n const textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;\n\n // 词云 transform\n if (!this._isWordCloudShape) {\n wordCloudTransforms.push({\n type: 'wordcloud',\n // TIP: 非浏览器环境下,使用 fast 布局,否则会出现兼容问题\n layoutType: !isTrueBrowser(this._option.mode) ? 'fast' : this._wordCloudConfig.layoutMode,\n size: [width, height],\n shape: this._maskShape,\n dataIndexKey: DEFAULT_DATA_KEY,\n text: { field: textField },\n fontSize: valueField ? { field: valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange,\n padding: this._fontPadding,\n rotate: { field: WORD_CLOUD_ANGLE },\n fontFamily: this._fontFamilyField ?? this._spec.word?.style?.fontFamily ?? this._defaultFontFamily,\n fontWeight: fontWeightField ? { field: fontWeightField } : valueField ? { field: WORD_CLOUD_WEIGHT } : null,\n fontStyle: this._fontStyleField ?? this._spec.word?.style?.fontStyle,\n\n randomVisible: this._random,\n clip: this._wordCloudConfig.drawOutOfBound === 'clip',\n shrink: this._wordCloudConfig.zoomToFit.shrink,\n enlarge: this._wordCloudConfig.zoomToFit.enlarge,\n minFontSize: this._wordCloudConfig.zoomToFit.fontSizeLimitMin,\n progressiveTime: this._wordCloudConfig.progressiveTime,\n progressiveStep: this._wordCloudConfig.progressiveStep\n });\n // 挂到mark的transform上\n (this._wordMark as ICompilableMark).getProduct().transform(wordCloudTransforms);\n }\n // 形状词云 transform\n else {\n wordCloudTransforms.push({\n type: 'wordcloudShape',\n // 形状词云中必须要传入dataIndexKey, 否则填充词无法绘制\n dataIndexKey: DEFAULT_DATA_KEY,\n\n size: [width, height],\n shape: this._maskShape,\n\n text: { field: this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField },\n fontSize: valueField ? { field: valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange,\n padding: this._fontPadding,\n rotateList: rotateAngles,\n fontFamily: this._fontFamilyField ?? this._spec.word?.style?.fontFamily ?? this._defaultFontFamily,\n fontWeight: fontWeightField ? { field: fontWeightField } : valueField ? { field: WORD_CLOUD_WEIGHT } : null,\n fontStyle: this._fontStyleField ?? this._spec.word?.style?.fontStyle,\n\n fillingFontFamily:\n this._wordCloudShapeConfig?.fillingFontFamilyField ??\n this._spec.word?.style?.fontFamily ??\n this._defaultFontFamily,\n fillingPadding: this._fillingFontPadding,\n fillingFontStyle: this._wordCloudShapeConfig?.fillingFontStyleField ?? this._spec.word?.style?.fontStyle,\n fillingFontWeight: this._wordCloudShapeConfig?.fillingFontWeightField ?? this._spec.word?.style?.fontWeight, // 填充词fontWeight默认不跟随valueField\n fillingRotateList: fillingRotateAngles,\n\n fillingTimes: this._wordCloudShapeConfig?.fillingTimes,\n fillingXStep: this._wordCloudShapeConfig?.fillingXStep,\n fillingYStep: this._wordCloudShapeConfig?.fillingYStep,\n fillingXRatioStep: this._wordCloudShapeConfig?.fillingXRatioStep,\n fillingYRatioStep: this._wordCloudShapeConfig?.fillingYRatioStep,\n fillingInitialOpacity: this._wordCloudShapeConfig?.fillingInitialOpacity,\n fillingDeltaOpacity: this._wordCloudShapeConfig?.fillingDeltaOpacity,\n fillingInitialFontSize: this._wordCloudShapeConfig?.fillingInitialFontSize,\n fillingDeltaFontSize: this._wordCloudShapeConfig?.fillingDeltaFontSize,\n\n ratio: this._wordCloudShapeConfig?.ratio,\n fillingRatio: this._wordCloudShapeConfig?.fillingRatio,\n removeWhiteBorder: this._wordCloudShapeConfig?.removeWhiteBorder,\n textLayoutTimes: this._wordCloudShapeConfig?.textLayoutTimes,\n fontSizeShrinkFactor: this._wordCloudShapeConfig?.fontSizeShrinkFactor,\n stepFactor: this._wordCloudShapeConfig?.stepFactor,\n layoutMode: this._wordCloudShapeConfig?.layoutMode,\n importantWordCount: this._wordCloudShapeConfig?.importantWordCount,\n globalShinkLimit: this._wordCloudShapeConfig?.globalShinkLimit,\n fontSizeEnlargeFactor: this._wordCloudShapeConfig?.fontSizeEnlargeFactor,\n fillingDeltaFontSizeFactor: this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor\n });\n }\n // 把transform挂载到data的product上\n this._data.getProduct().transform(wordCloudTransforms);\n }\n\n getStatisticFields() {\n const fields: { key: string; operations: Array<'max' | 'min' | 'values'> }[] = [];\n fields.push({ key: this._nameField, operations: ['values'] });\n fields.push({ key: this._valueField, operations: ['max', 'min'] });\n return fields;\n }\n dataToPosition(data: Datum): IPoint {\n return null;\n }\n dataToPositionX(data: any): number {\n return null;\n }\n dataToPositionY(data: any): number {\n return null;\n }\n dataToPositionZ(data: any): number {\n return null;\n }\n valueToPosition(value1: any, value2?: any): IPoint {\n return null;\n }\n\n getGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackValueField(): string {\n // do nothing\n return '';\n }\n\n onLayoutEnd(ctx: any): void {\n super.onLayoutEnd(ctx);\n this.compile();\n }\n\n getActiveMarks(): IMark[] {\n return [this._wordMark, this._fillingWordMark];\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/series/word-cloud/base.ts"],"names":[],"mappings":";;;AAEA,6CAAiD;AACjD,6CAA2C;AAC3C,6CAA6F;AAG7F,4CAAuD;AACvD,wCAA+C;AAC/C,qCAWkB;AAQlB,iDAA6E;AAC7E,6CAA+C;AAC/C,2DAAiD;AACjD,0DAKmC;AAEnC,qDAAiD;AACjD,yEAAoE;AACpE,yCAAiD;AAEjD,gDAA6C;AAK7C,MAAa,mBAAmF,SAAQ,wBAAa;IAArH;;QAqBY,mBAAc,GAAsB,CAAC,8BAAqB,EAAE,8BAAqB,CAAC,CAAC;QAUnF,sBAAiB,GAAY,KAAK,CAAC;IAoZ/C,CAAC;IA9aC,aAAa,CAAC,KAAa;QACzB,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;YAClB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;SAC1B;IACH,CAAC;IAaD,gBAAgB,CAAC,aAA+B;QAC9C,IAAI,IAAA,gBAAO,EAAC,aAAa,CAAC,EAAE;YAC1B,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;SACrC;aAAM;YACL,IAAI,CAAC,cAAc,GAAG,+BAAsB,CAAC;SAC9C;IACH,CAAC;IAkBD,eAAe;;QACb,KAAK,CAAC,eAAe,EAAE,CAAC;QAExB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC;QAGhD,IAAI,CAAC,UAAU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ACjB,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACjD,CAAC;;AAlbH,kDAmbC;AAlbiB,wBAAI,GAAkB,8BAAmB,CAAC","file":"base.js","sourcesContent":["/* eslint-disable no-duplicate-imports */\nimport type { IPadding } from '@visactor/vutils';\nimport { isValidNumber } from '@visactor/vutils';\nimport { isValid } from '@visactor/vutils';\nimport { AttributeLevel, DEFAULT_DATA_KEY, DEFAULT_DATA_SERIES_FIELD } from '../../constant';\nimport type { ITextMark } from '../../mark/text';\nimport type { SeriesMarkMap } from '../interface';\nimport { SeriesMarkNameEnum } from '../interface/type';\nimport { isTrueBrowser } from '../../util/env';\nimport {\n DEFAULT_DRAW_OUT_OF_BOUND,\n DEFAULT_FONTSIZE_RANGE,\n DEFAULT_FONT_PADDING,\n DEFAULT_FONT_WEIGHT_RANGE,\n DEFAULT_MASK_SHAPE,\n DEFAULT_MIN_FONT_SIZE,\n DEFAULT_RANDOM,\n DEFAULT_ROTATE_ANGLES,\n DEFAULT_ZOOM_TO_FIT,\n SHAPE_TYPE\n} from './config';\nimport type {\n IWordCloudSeriesSpec,\n WordCloudConfigType,\n WordCloudShapeConfigType,\n WordCloudShapeType\n} from './interface';\nimport type { Datum, IPoint } from '../../typings';\nimport { animationConfig, userAnimationConfig } from '../../animation/utils';\nimport { LinearScale } from '@visactor/vscale';\nimport { extent } from '@visactor/vgrammar-util';\nimport {\n WORD_CLOUD_ANGLE,\n WORD_CLOUD_FILLING_ANGLE,\n WORD_CLOUD_TEXT,\n WORD_CLOUD_WEIGHT\n} from '../../constant/word-cloud';\nimport type { ICompilableMark } from '../../compile/mark';\nimport { BaseSeries } from '../base/base-series';\nimport { ColorOrdinalScale } from '../../scale/color-ordinal-scale';\nimport { wordCloudSeriesMark } from './constant';\nimport type { IStateAnimateSpec } from '../../animation/spec';\nimport { Factory } from '../../core/factory';\nimport type { IMark } from '../../mark/interface';\n\nexport type IBaseWordCloudSeriesSpec = Omit<IWordCloudSeriesSpec, 'type'> & { type: string };\n\nexport class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IBaseWordCloudSeriesSpec> extends BaseSeries<T> {\n static readonly mark: SeriesMarkMap = wordCloudSeriesMark;\n\n protected _nameField: string;\n protected _valueField?: string;\n setValueField(field: string) {\n if (isValid(field)) {\n this._valueField = field;\n }\n }\n\n protected _fontFamilyField: string;\n protected _fontWeightField: string;\n protected _fontStyleField: string;\n protected _colorHexField: string;\n protected _colorMode: 'linear' | 'ordinal';\n protected _colorList: string[];\n protected _rotateAngles?: number[];\n protected _fontWeightRange?: [number, number];\n protected _textField?: string;\n\n protected _fontSizeRange?: [number, number] = [DEFAULT_MIN_FONT_SIZE, DEFAULT_MIN_FONT_SIZE];\n setFontSizeRange(fontSizeRange: [number, number]) {\n if (isValid(fontSizeRange)) {\n this._fontSizeRange = fontSizeRange;\n } else {\n this._fontSizeRange = DEFAULT_FONTSIZE_RANGE;\n }\n }\n\n protected _maskShape?: string | WordCloudShapeType;\n protected _isWordCloudShape: boolean = false;\n\n protected _keepAspect?: boolean;\n protected _random?: boolean;\n protected _fontPadding?: number;\n protected _fillingFontPadding?: number;\n protected _wordCloudConfig?: WordCloudConfigType;\n protected _wordCloudShapeConfig?: WordCloudShapeConfigType;\n\n protected _padding?: IPadding;\n protected _defaultFontFamily: string;\n\n /**\n * @override\n */\n setAttrFromSpec() {\n super.setAttrFromSpec();\n // series布局相关\n this._padding = this._option.getChart().padding;\n\n // 普通词云 & 形状词云 共有spec相关\n this._nameField = this._spec.nameField;\n this._fontFamilyField = this._spec.fontFamilyField;\n this._fontWeightField = this._spec.fontWeightField;\n this._fontStyleField = this._spec.fontStyleField;\n this._colorHexField = this._spec.colorHexField;\n this._colorMode = this._spec.colorMode ?? 'ordinal';\n this._colorList = this._spec.colorList;\n this.setValueField(this._spec.valueField);\n this._fontWeightRange = this._spec.fontWeightRange ?? DEFAULT_FONT_WEIGHT_RANGE;\n this._rotateAngles = this._spec.rotateAngles ?? DEFAULT_ROTATE_ANGLES;\n this.setFontSizeRange(this._spec.fontSizeRange);\n this._maskShape = this._spec.maskShape ?? DEFAULT_MASK_SHAPE;\n this._keepAspect = this._spec.keepAspect;\n this._random = this._spec.random ?? DEFAULT_RANDOM;\n this._fontPadding = this._spec.word?.padding ?? DEFAULT_FONT_PADDING;\n this._textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;\n // 普通词云spec相关\n this._wordCloudConfig = {\n drawOutOfBound: DEFAULT_DRAW_OUT_OF_BOUND,\n layoutMode: 'default',\n zoomToFit: DEFAULT_ZOOM_TO_FIT,\n ...this._spec.wordCloudConfig\n };\n\n // 形状词云spec相关\n this._wordCloudShapeConfig = {\n fillingSeriesField: this.getSeriesField(),\n fillingRotateAngles: DEFAULT_ROTATE_ANGLES,\n layoutMode: 'default',\n ...this._spec.wordCloudShapeConfig\n };\n this._fillingFontPadding = this._spec.fillingWord?.padding ?? DEFAULT_FONT_PADDING;\n\n this._isWordCloudShape = !SHAPE_TYPE.includes(this._maskShape);\n this._defaultFontFamily = this._option.getTheme().fontFamily;\n }\n\n protected _wordMark: ITextMark;\n protected _fillingWordMark: ITextMark;\n initMark(): void {\n this._wordMark = this._createMark(BaseWordCloudSeries.mark.word, {\n defaultMorphElementKey: this._seriesField,\n groupKey: this._seriesField,\n isSeriesMark: true\n }) as ITextMark;\n if (this._isWordCloudShape) {\n this._fillingWordMark = this._createMark(BaseWordCloudSeries.mark.fillingWord) as ITextMark;\n }\n }\n\n initMarkStyle() {\n const wordMark = this._wordMark;\n const fillingWordMark = this._fillingWordMark;\n const wordSpec = this._spec.word ?? {};\n if (wordMark) {\n this.setMarkStyle(\n wordMark,\n {\n fill: this._colorHexField\n ? (datum: Datum) => datum[this._colorHexField]\n : this.getWordColorAttribute(this._seriesField, false),\n text: (datum: Datum) => datum[this._textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontFamily: (datum: Datum) => datum.fontFamily,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n fontWeight: (datum: Datum) => datum.fontWeight,\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => !datum.isFillingWord\n },\n 'normal',\n AttributeLevel.Series\n );\n this.setMarkStyle(\n wordMark,\n {\n fontFamily: wordSpec.style?.fontFamily ?? this._defaultFontFamily\n },\n 'normal',\n AttributeLevel.User_Mark\n );\n }\n if (fillingWordMark) {\n this.setMarkStyle(\n fillingWordMark,\n {\n fill: this._wordCloudShapeConfig.fillingColorHexField\n ? (datum: Datum) => datum[this._wordCloudShapeConfig.fillingColorHexField]\n : this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField, true),\n text: (datum: Datum) => datum[this._textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontFamily: (datum: Datum) => datum.fontFamily,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n fontWeight: (datum: Datum) => datum.fontWeight,\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => datum.isFillingWord\n },\n 'normal',\n AttributeLevel.Series\n );\n\n this.setMarkStyle(\n fillingWordMark,\n {\n fontFamily: wordSpec.style?.fontFamily ?? this._defaultFontFamily\n },\n 'normal',\n AttributeLevel.User_Mark\n );\n }\n this._trigger.registerMark(wordMark);\n this._trigger.registerMark(fillingWordMark);\n }\n\n protected initTooltip() {\n super.initTooltip();\n\n this._wordMark && this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark);\n this._fillingWordMark && this._tooltipHelper.activeTriggerSet.mark.add(this._fillingWordMark);\n }\n\n initAnimation() {\n [this._wordMark, this._fillingWordMark].forEach(mark => {\n if (mark) {\n const appearPreset = (this._spec?.animationAppear as IStateAnimateSpec<any>)?.preset;\n const params = {\n animationConfig: () => mark.getAnimationConfig()?.appear?.[0]\n };\n mark.setAnimationConfig(\n animationConfig(\n Factory.getAnimationInKey('wordCloud')(params, appearPreset),\n userAnimationConfig(SeriesMarkNameEnum.word, this._spec, this._markAttributeContext)\n )\n );\n }\n });\n }\n\n protected getWordOrdinalColorScale(field: string, isFillingWord: boolean) {\n const colorList = isFillingWord ? this._wordCloudShapeConfig.fillingColorList : this._colorList;\n const colorDomain = field ? this.getViewData()?.latestData.map((datum: Datum) => datum[field]) : [];\n const colorRange = colorList ?? this._option.globalScale.getScale('color')?.range() ?? this._getDataScheme();\n return new ColorOrdinalScale().domain(colorDomain).range?.(colorRange);\n }\n\n getWordColorAttribute(field: string, isFillingWord: boolean) {\n if (this._colorMode === 'ordinal') {\n return {\n scale: this.getWordOrdinalColorScale(field, isFillingWord),\n field: this._seriesField ?? DEFAULT_DATA_SERIES_FIELD\n };\n }\n // const valueScale = new LinearScale()\n // .domain(extent(this.getViewData()?.latestData.map((datum: Datum) => datum[field])), true)\n // .range([0, 1]);\n let colorList =\n (isFillingWord ? this._colorList : this._wordCloudShapeConfig.fillingColorList) ??\n this._option.globalScale.getScale('color').range();\n // 如果用户只输入了一个 color,无法构成 colorRange,则进行兜底\n if (colorList.length === 1) {\n colorList = [colorList[0], colorList[0]];\n }\n // 颜色插值 todo@chensiji\n // const interpolate = interpolateColors(colorList)\n // return (datum: Datum) => interpolate(valueScale.scale(datum[field]))\n return (datum: Datum) => colorList[0];\n }\n\n compile(): void {\n super.compile();\n const { width, height } = this._region.getLayoutRect();\n // 非正常尺寸下不进行布局\n if (!isValidNumber(width) || !isValidNumber(height) || !(height > 0 && width > 0)) {\n return;\n }\n\n const wordCloudTransforms: any[] = [];\n const valueField = this._valueField;\n const valueScale = new LinearScale();\n const fontWeightRange = this._fontWeightRange;\n const rotateAngles = this._rotateAngles;\n const fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;\n\n // fontWeight处理\n if (valueField) {\n const [minValue, maxValue] = extent(this.getViewData()?.latestData.map((datum: any) => +datum[valueField]));\n valueScale.domain([minValue, maxValue], true).range(fontWeightRange);\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_WEIGHT,\n callback: (datum: any) => {\n if (minValue === maxValue) {\n return valueScale.scale(maxValue);\n }\n return valueScale.scale(datum[valueField]);\n }\n });\n }\n\n // rotateAngles处理\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_ANGLE,\n callback: () => {\n return rotateAngles[Math.floor(Math.random() * rotateAngles.length)];\n }\n });\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_FILLING_ANGLE,\n callback: () => {\n return fillingRotateAngles[Math.floor(Math.random() * fillingRotateAngles.length)];\n }\n });\n const wordSpec = this._spec.word ?? {};\n\n // text fromat method 处理\n if (wordSpec.formatMethod) {\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_TEXT,\n callback: wordSpec.formatMethod\n });\n }\n\n // 词云 transform\n if (!this._isWordCloudShape) {\n wordCloudTransforms.push({\n type: 'wordcloud',\n ...this._wordCloudTransformOption()\n });\n // 挂到mark的transform上\n (this._wordMark as ICompilableMark).getProduct().transform(wordCloudTransforms);\n }\n // 形状词云 transform\n else {\n wordCloudTransforms.push({\n type: 'wordcloudShape',\n // 形状词云中必须要传入dataIndexKey, 否则填充词无法绘制\n ...this._wordCloudShapeTransformOption()\n });\n }\n // 把transform挂载到data的product上\n this._data.getProduct().transform(wordCloudTransforms);\n }\n\n protected _wordCloudTransformOption(): Object {\n const { width, height } = this._region.getLayoutRect();\n const wordStyleSpec = this._spec.word?.style ?? {};\n\n return {\n // TIP: 非浏览器环境下,使用 fast 布局,否则会出现兼容问题\n layoutType: !isTrueBrowser(this._option.mode) ? 'fast' : this._wordCloudConfig.layoutMode,\n size: [width, height],\n shape: this._maskShape,\n dataIndexKey: DEFAULT_DATA_KEY,\n text: { field: this._textField },\n fontSize: this._valueField ? { field: this._valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange,\n padding: this._fontPadding,\n rotate: { field: WORD_CLOUD_ANGLE },\n fontFamily: this._fontFamilyField ?? wordStyleSpec.fontFamily ?? this._defaultFontFamily,\n fontWeight: this._fontWeightField\n ? { field: this._fontWeightField }\n : this._valueField\n ? { field: WORD_CLOUD_WEIGHT }\n : null,\n fontStyle: this._fontStyleField ?? wordStyleSpec.fontStyle,\n\n randomVisible: this._random,\n clip: this._wordCloudConfig.drawOutOfBound === 'clip',\n shrink: this._wordCloudConfig.zoomToFit.shrink,\n enlarge: this._wordCloudConfig.zoomToFit.enlarge,\n minFontSize: this._wordCloudConfig.zoomToFit.fontSizeLimitMin,\n progressiveTime: this._wordCloudConfig.progressiveTime,\n progressiveStep: this._wordCloudConfig.progressiveStep\n };\n }\n\n protected _wordCloudShapeTransformOption(): Object {\n const { width, height } = this._region.getLayoutRect();\n const wordStyleSpec = this._spec.word?.style ?? {};\n const wordCloudShapeConfig = this._wordCloudShapeConfig ?? {};\n const fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;\n\n return {\n dataIndexKey: DEFAULT_DATA_KEY,\n\n size: [width, height],\n shape: this._maskShape,\n\n text: { field: this._textField },\n fontSize: this._valueField ? { field: this._valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange,\n padding: this._fontPadding,\n rotateList: this._rotateAngles,\n fontFamily: this._fontFamilyField ?? wordStyleSpec.fontFamily ?? this._defaultFontFamily,\n fontWeight: this._fontWeightField\n ? { field: this._fontWeightField }\n : this._valueField\n ? { field: WORD_CLOUD_WEIGHT }\n : null,\n fontStyle: this._fontStyleField ?? wordStyleSpec.fontStyle,\n\n fillingFontFamily:\n wordCloudShapeConfig.fillingFontFamilyField ?? wordStyleSpec.fontFamily ?? this._defaultFontFamily,\n fillingPadding: this._fillingFontPadding,\n fillingFontStyle: wordCloudShapeConfig.fillingFontStyleField ?? wordStyleSpec.fontStyle,\n fillingFontWeight: wordCloudShapeConfig.fillingFontWeightField ?? wordStyleSpec.fontWeight, // 填充词fontWeight默认不跟随valueField\n fillingRotateList: fillingRotateAngles,\n\n fillingTimes: wordCloudShapeConfig.fillingTimes,\n fillingXStep: wordCloudShapeConfig.fillingXStep,\n fillingYStep: wordCloudShapeConfig.fillingYStep,\n fillingXRatioStep: wordCloudShapeConfig.fillingXRatioStep,\n fillingYRatioStep: wordCloudShapeConfig.fillingYRatioStep,\n fillingInitialOpacity: wordCloudShapeConfig.fillingInitialOpacity,\n fillingDeltaOpacity: wordCloudShapeConfig.fillingDeltaOpacity,\n fillingInitialFontSize: wordCloudShapeConfig.fillingInitialFontSize,\n fillingDeltaFontSize: wordCloudShapeConfig.fillingDeltaFontSize,\n\n ratio: wordCloudShapeConfig.ratio,\n fillingRatio: wordCloudShapeConfig.fillingRatio,\n removeWhiteBorder: wordCloudShapeConfig.removeWhiteBorder,\n textLayoutTimes: wordCloudShapeConfig.textLayoutTimes,\n fontSizeShrinkFactor: wordCloudShapeConfig.fontSizeShrinkFactor,\n stepFactor: wordCloudShapeConfig.stepFactor,\n layoutMode: wordCloudShapeConfig.layoutMode,\n importantWordCount: wordCloudShapeConfig.importantWordCount,\n globalShinkLimit: wordCloudShapeConfig.globalShinkLimit,\n fontSizeEnlargeFactor: wordCloudShapeConfig.fontSizeEnlargeFactor,\n fillingDeltaFontSizeFactor: wordCloudShapeConfig.fillingDeltaFontSizeFactor\n };\n }\n\n getStatisticFields() {\n const fields: { key: string; operations: Array<'max' | 'min' | 'values'> }[] = [];\n fields.push({ key: this._nameField, operations: ['values'] });\n fields.push({ key: this._valueField, operations: ['max', 'min'] });\n return fields;\n }\n dataToPosition(data: Datum): IPoint {\n return null;\n }\n dataToPositionX(data: any): number {\n return null;\n }\n dataToPositionY(data: any): number {\n return null;\n }\n dataToPositionZ(data: any): number {\n return null;\n }\n valueToPosition(value1: any, value2?: any): IPoint {\n return null;\n }\n\n getGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackValueField(): string {\n // do nothing\n return '';\n }\n\n onLayoutEnd(ctx: any): void {\n super.onLayoutEnd(ctx);\n this.compile();\n }\n\n getActiveMarks(): IMark[] {\n return [this._wordMark, this._fillingWordMark];\n }\n}\n"]}
@@ -4,7 +4,28 @@ import { BaseWordCloudSeries } from './base';
4
4
  export declare class WordCloud3dSeries<T extends IWordCloud3dSeriesSpec = IWordCloud3dSeriesSpec> extends BaseWordCloudSeries<T> {
5
5
  static readonly type: string;
6
6
  type: SeriesTypeEnum;
7
- compile(): void;
7
+ protected _wordCloudTransformOption(): {
8
+ postProjection: "StereographicProjection";
9
+ depth_3d: number;
10
+ constructor: Function;
11
+ toString(): string;
12
+ toLocaleString(): string;
13
+ valueOf(): Object;
14
+ hasOwnProperty(v: PropertyKey): boolean;
15
+ isPrototypeOf(v: Object): boolean;
16
+ propertyIsEnumerable(v: PropertyKey): boolean;
17
+ };
18
+ protected _wordCloudShapeTransformOption(): {
19
+ postProjection: "StereographicProjection";
20
+ depth_3d: number;
21
+ constructor: Function;
22
+ toString(): string;
23
+ toLocaleString(): string;
24
+ valueOf(): Object;
25
+ hasOwnProperty(v: PropertyKey): boolean;
26
+ isPrototypeOf(v: Object): boolean;
27
+ propertyIsEnumerable(v: PropertyKey): boolean;
28
+ };
8
29
  initMark(): void;
9
30
  initMarkStyle(): void;
10
31
  initAnimation(): void;