wordcloud.src.js 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295
  1. /**
  2. * @license Highcharts JS v8.1.2 (2020-06-16)
  3. *
  4. * (c) 2016-2019 Highsoft AS
  5. * Authors: Jon Arild Nygard
  6. *
  7. * License: www.highcharts.com/license
  8. */
  9. 'use strict';
  10. (function (factory) {
  11. if (typeof module === 'object' && module.exports) {
  12. factory['default'] = factory;
  13. module.exports = factory;
  14. } else if (typeof define === 'function' && define.amd) {
  15. define('highcharts/modules/wordcloud', ['highcharts'], function (Highcharts) {
  16. factory(Highcharts);
  17. factory.Highcharts = Highcharts;
  18. return factory;
  19. });
  20. } else {
  21. factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
  22. }
  23. }(function (Highcharts) {
  24. var _modules = Highcharts ? Highcharts._modules : {};
  25. function _registerModule(obj, path, args, fn) {
  26. if (!obj.hasOwnProperty(path)) {
  27. obj[path] = fn.apply(null, args);
  28. }
  29. }
  30. _registerModule(_modules, 'mixins/draw-point.js', [], function () {
  31. /* *
  32. *
  33. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  34. *
  35. * */
  36. var isFn = function (x) {
  37. return typeof x === 'function';
  38. };
  39. /* eslint-disable no-invalid-this, valid-jsdoc */
  40. /**
  41. * Handles the drawing of a component.
  42. * Can be used for any type of component that reserves the graphic property, and
  43. * provides a shouldDraw on its context.
  44. *
  45. * @private
  46. * @function draw
  47. * @param {DrawPointParams} params
  48. * Parameters.
  49. *
  50. * @todo add type checking.
  51. * @todo export this function to enable usage
  52. */
  53. var draw = function draw(params) {
  54. var _a;
  55. var component = this, graphic = component.graphic, animatableAttribs = params.animatableAttribs, onComplete = params.onComplete, css = params.css, renderer = params.renderer, animation = (_a = component.series) === null || _a === void 0 ? void 0 : _a.options.animation;
  56. if (component.shouldDraw()) {
  57. if (!graphic) {
  58. component.graphic = graphic =
  59. renderer[params.shapeType](params.shapeArgs)
  60. .add(params.group);
  61. }
  62. graphic
  63. .css(css)
  64. .attr(params.attribs)
  65. .animate(animatableAttribs, params.isNew ? false : animation, onComplete);
  66. }
  67. else if (graphic) {
  68. var destroy = function () {
  69. component.graphic = graphic = graphic.destroy();
  70. if (isFn(onComplete)) {
  71. onComplete();
  72. }
  73. };
  74. // animate only runs complete callback if something was animated.
  75. if (Object.keys(animatableAttribs).length) {
  76. graphic.animate(animatableAttribs, void 0, function () {
  77. destroy();
  78. });
  79. }
  80. else {
  81. destroy();
  82. }
  83. }
  84. };
  85. /**
  86. * An extended version of draw customized for points.
  87. * It calls additional methods that is expected when rendering a point.
  88. * @private
  89. * @param {Highcharts.Dictionary<any>} params Parameters
  90. */
  91. var drawPoint = function drawPoint(params) {
  92. var point = this, attribs = params.attribs = params.attribs || {};
  93. // Assigning class in dot notation does go well in IE8
  94. // eslint-disable-next-line dot-notation
  95. attribs['class'] = point.getClassName();
  96. // Call draw to render component
  97. draw.call(point, params);
  98. };
  99. return drawPoint;
  100. });
  101. _registerModule(_modules, 'mixins/polygon.js', [_modules['parts/Globals.js'], _modules['parts/Utilities.js']], function (H, U) {
  102. /* *
  103. *
  104. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  105. *
  106. * */
  107. /**
  108. * @private
  109. * @interface Highcharts.PolygonPointObject
  110. */ /**
  111. * @name Highcharts.PolygonPointObject#0
  112. * @type {number}
  113. */ /**
  114. * @name Highcharts.PolygonPointObject#1
  115. * @type {number}
  116. */
  117. /**
  118. * @private
  119. * @interface Highcharts.PolygonObject
  120. * @extends Array<Highcharts.PolygonPointObject>
  121. */ /**
  122. * @name Highcharts.PolygonObject#axes
  123. * @type {Array<PolygonPointObject>}
  124. */
  125. var find = U.find, isArray = U.isArray, isNumber = U.isNumber;
  126. var deg2rad = H.deg2rad;
  127. /* eslint-disable no-invalid-this, valid-jsdoc */
  128. /**
  129. * Alternative solution to correctFloat.
  130. * E.g Highcharts.correctFloat(123, 2) returns 120, when it should be 123.
  131. *
  132. * @private
  133. * @function correctFloat
  134. * @param {number} number
  135. * @param {number} [precision]
  136. * @return {number}
  137. */
  138. var correctFloat = function (number, precision) {
  139. var p = isNumber(precision) ? precision : 14, magnitude = Math.pow(10, p);
  140. return Math.round(number * magnitude) / magnitude;
  141. };
  142. /**
  143. * Calculates the normals to a line between two points.
  144. *
  145. * @private
  146. * @function getNormals
  147. * @param {Highcharts.PolygonPointObject} p1
  148. * Start point for the line. Array of x and y value.
  149. * @param {Highcharts.PolygonPointObject} p2
  150. * End point for the line. Array of x and y value.
  151. * @return {Highcharts.PolygonObject}
  152. * Returns the two normals in an array.
  153. */
  154. var getNormals = function getNormal(p1, p2) {
  155. var dx = p2[0] - p1[0], // x2 - x1
  156. dy = p2[1] - p1[1]; // y2 - y1
  157. return [
  158. [-dy, dx],
  159. [dy, -dx]
  160. ];
  161. };
  162. /**
  163. * Calculates the dot product of two coordinates. The result is a scalar value.
  164. *
  165. * @private
  166. * @function dotProduct
  167. * @param {Highcharts.PolygonPointObject} a
  168. * The x and y coordinates of the first point.
  169. *
  170. * @param {Highcharts.PolygonPointObject} b
  171. * The x and y coordinates of the second point.
  172. *
  173. * @return {number}
  174. * Returns the dot product of a and b.
  175. */
  176. var dotProduct = function dotProduct(a, b) {
  177. var ax = a[0], ay = a[1], bx = b[0], by = b[1];
  178. return ax * bx + ay * by;
  179. };
  180. /**
  181. * Projects a polygon onto a coordinate.
  182. *
  183. * @private
  184. * @function project
  185. * @param {Highcharts.PolygonObject} polygon
  186. * Array of points in a polygon.
  187. * @param {Highcharts.PolygonPointObject} target
  188. * The coordinate of pr
  189. * @return {Highcharts.RangeObject}
  190. */
  191. var project = function project(polygon, target) {
  192. var products = polygon.map(function (point) {
  193. return dotProduct(point, target);
  194. });
  195. return {
  196. min: Math.min.apply(this, products),
  197. max: Math.max.apply(this, products)
  198. };
  199. };
  200. /**
  201. * Rotates a point clockwise around the origin.
  202. *
  203. * @private
  204. * @function rotate2DToOrigin
  205. * @param {Highcharts.PolygonPointObject} point
  206. * The x and y coordinates for the point.
  207. * @param {number} angle
  208. * The angle of rotation.
  209. * @return {Highcharts.PolygonPointObject}
  210. * The x and y coordinate for the rotated point.
  211. */
  212. var rotate2DToOrigin = function (point, angle) {
  213. var x = point[0], y = point[1], rad = deg2rad * -angle, cosAngle = Math.cos(rad), sinAngle = Math.sin(rad);
  214. return [
  215. correctFloat(x * cosAngle - y * sinAngle),
  216. correctFloat(x * sinAngle + y * cosAngle)
  217. ];
  218. };
  219. /**
  220. * Rotate a point clockwise around another point.
  221. *
  222. * @private
  223. * @function rotate2DToPoint
  224. * @param {Highcharts.PolygonPointObject} point
  225. * The x and y coordinates for the point.
  226. * @param {Highcharts.PolygonPointObject} origin
  227. * The point to rotate around.
  228. * @param {number} angle
  229. * The angle of rotation.
  230. * @return {Highcharts.PolygonPointObject}
  231. * The x and y coordinate for the rotated point.
  232. */
  233. var rotate2DToPoint = function (point, origin, angle) {
  234. var x = point[0] - origin[0], y = point[1] - origin[1], rotated = rotate2DToOrigin([x, y], angle);
  235. return [
  236. rotated[0] + origin[0],
  237. rotated[1] + origin[1]
  238. ];
  239. };
  240. /**
  241. * @private
  242. */
  243. var isAxesEqual = function (axis1, axis2) {
  244. return (axis1[0] === axis2[0] &&
  245. axis1[1] === axis2[1]);
  246. };
  247. /**
  248. * @private
  249. */
  250. var getAxesFromPolygon = function (polygon) {
  251. var points, axes = polygon.axes;
  252. if (!isArray(axes)) {
  253. axes = [];
  254. points = points = polygon.concat([polygon[0]]);
  255. points.reduce(function findAxis(p1, p2) {
  256. var normals = getNormals(p1, p2), axis = normals[0]; // Use the left normal as axis.
  257. // Check that the axis is unique.
  258. if (!find(axes, function (existing) {
  259. return isAxesEqual(existing, axis);
  260. })) {
  261. axes.push(axis);
  262. }
  263. // Return p2 to be used as p1 in next iteration.
  264. return p2;
  265. });
  266. polygon.axes = axes;
  267. }
  268. return axes;
  269. };
  270. /**
  271. * @private
  272. */
  273. var getAxes = function (polygon1, polygon2) {
  274. // Get the axis from both polygons.
  275. var axes1 = getAxesFromPolygon(polygon1), axes2 = getAxesFromPolygon(polygon2);
  276. return axes1.concat(axes2);
  277. };
  278. /**
  279. * @private
  280. */
  281. var getPolygon = function (x, y, width, height, rotation) {
  282. var origin = [x, y], left = x - (width / 2), right = x + (width / 2), top = y - (height / 2), bottom = y + (height / 2), polygon = [
  283. [left, top],
  284. [right, top],
  285. [right, bottom],
  286. [left, bottom]
  287. ];
  288. return polygon.map(function (point) {
  289. return rotate2DToPoint(point, origin, -rotation);
  290. });
  291. };
  292. /**
  293. * @private
  294. */
  295. var getBoundingBoxFromPolygon = function (points) {
  296. return points.reduce(function (obj, point) {
  297. var x = point[0], y = point[1];
  298. obj.left = Math.min(x, obj.left);
  299. obj.right = Math.max(x, obj.right);
  300. obj.bottom = Math.max(y, obj.bottom);
  301. obj.top = Math.min(y, obj.top);
  302. return obj;
  303. }, {
  304. left: Number.MAX_VALUE,
  305. right: -Number.MAX_VALUE,
  306. bottom: -Number.MAX_VALUE,
  307. top: Number.MAX_VALUE
  308. });
  309. };
  310. /**
  311. * @private
  312. */
  313. var isPolygonsOverlappingOnAxis = function (axis, polygon1, polygon2) {
  314. var projection1 = project(polygon1, axis), projection2 = project(polygon2, axis), isOverlapping = !(projection2.min > projection1.max ||
  315. projection2.max < projection1.min);
  316. return !isOverlapping;
  317. };
  318. /**
  319. * Checks wether two convex polygons are colliding by using the Separating Axis
  320. * Theorem.
  321. *
  322. * @private
  323. * @function isPolygonsColliding
  324. * @param {Highcharts.PolygonObject} polygon1
  325. * First polygon.
  326. *
  327. * @param {Highcharts.PolygonObject} polygon2
  328. * Second polygon.
  329. *
  330. * @return {boolean}
  331. * Returns true if they are colliding, otherwise false.
  332. */
  333. var isPolygonsColliding = function isPolygonsColliding(polygon1, polygon2) {
  334. var axes = getAxes(polygon1, polygon2), overlappingOnAllAxes = !find(axes, function (axis) {
  335. return isPolygonsOverlappingOnAxis(axis, polygon1, polygon2);
  336. });
  337. return overlappingOnAllAxes;
  338. };
  339. /**
  340. * @private
  341. */
  342. var movePolygon = function (deltaX, deltaY, polygon) {
  343. return polygon.map(function (point) {
  344. return [
  345. point[0] + deltaX,
  346. point[1] + deltaY
  347. ];
  348. });
  349. };
  350. var collision = {
  351. getBoundingBoxFromPolygon: getBoundingBoxFromPolygon,
  352. getPolygon: getPolygon,
  353. isPolygonsColliding: isPolygonsColliding,
  354. movePolygon: movePolygon,
  355. rotate2DToOrigin: rotate2DToOrigin,
  356. rotate2DToPoint: rotate2DToPoint
  357. };
  358. return collision;
  359. });
  360. _registerModule(_modules, 'modules/wordcloud.src.js', [_modules['parts/Globals.js'], _modules['parts/Utilities.js'], _modules['mixins/draw-point.js'], _modules['mixins/polygon.js']], function (H, U, drawPoint, polygon) {
  361. /* *
  362. *
  363. * Experimental Highcharts module which enables visualization of a word cloud.
  364. *
  365. * (c) 2016-2020 Highsoft AS
  366. * Authors: Jon Arild Nygard
  367. *
  368. * License: www.highcharts.com/license
  369. *
  370. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  371. * */
  372. var extend = U.extend, find = U.find, isArray = U.isArray, isNumber = U.isNumber, isObject = U.isObject, merge = U.merge, seriesType = U.seriesType;
  373. var noop = H.noop, getBoundingBoxFromPolygon = polygon.getBoundingBoxFromPolygon, getPolygon = polygon.getPolygon, isPolygonsColliding = polygon.isPolygonsColliding, movePolygon = polygon.movePolygon, Series = H.Series;
  374. /**
  375. * Detects if there is a collision between two rectangles.
  376. *
  377. * @private
  378. * @function isRectanglesIntersecting
  379. *
  380. * @param {Highcharts.PolygonBoxObject} r1
  381. * First rectangle.
  382. *
  383. * @param {Highcharts.PolygonBoxObject} r2
  384. * Second rectangle.
  385. *
  386. * @return {boolean}
  387. * Returns true if the rectangles overlap.
  388. */
  389. function isRectanglesIntersecting(r1, r2) {
  390. return !(r2.left > r1.right ||
  391. r2.right < r1.left ||
  392. r2.top > r1.bottom ||
  393. r2.bottom < r1.top);
  394. }
  395. /**
  396. * Detects if a word collides with any previously placed words.
  397. *
  398. * @private
  399. * @function intersectsAnyWord
  400. *
  401. * @param {Highcharts.Point} point
  402. * Point which the word is connected to.
  403. *
  404. * @param {Array<Highcharts.Point>} points
  405. * Previously placed points to check against.
  406. *
  407. * @return {boolean}
  408. * Returns true if there is collision.
  409. */
  410. function intersectsAnyWord(point, points) {
  411. var intersects = false, rect = point.rect, polygon = point.polygon, lastCollidedWith = point.lastCollidedWith, isIntersecting = function (p) {
  412. var result = isRectanglesIntersecting(rect, p.rect);
  413. if (result &&
  414. (point.rotation % 90 || p.rotation % 90)) {
  415. result = isPolygonsColliding(polygon, p.polygon);
  416. }
  417. return result;
  418. };
  419. // If the point has already intersected a different point, chances are they
  420. // are still intersecting. So as an enhancement we check this first.
  421. if (lastCollidedWith) {
  422. intersects = isIntersecting(lastCollidedWith);
  423. // If they no longer intersects, remove the cache from the point.
  424. if (!intersects) {
  425. delete point.lastCollidedWith;
  426. }
  427. }
  428. // If not already found, then check if we can find a point that is
  429. // intersecting.
  430. if (!intersects) {
  431. intersects = !!find(points, function (p) {
  432. var result = isIntersecting(p);
  433. if (result) {
  434. point.lastCollidedWith = p;
  435. }
  436. return result;
  437. });
  438. }
  439. return intersects;
  440. }
  441. /**
  442. * Gives a set of cordinates for an Archimedian Spiral.
  443. *
  444. * @private
  445. * @function archimedeanSpiral
  446. *
  447. * @param {number} attempt
  448. * How far along the spiral we have traversed.
  449. *
  450. * @param {Highcharts.WordcloudSpiralParamsObject} [params]
  451. * Additional parameters.
  452. *
  453. * @return {boolean|Highcharts.PositionObject}
  454. * Resulting coordinates, x and y. False if the word should be dropped from the
  455. * visualization.
  456. */
  457. function archimedeanSpiral(attempt, params) {
  458. var field = params.field, result = false, maxDelta = (field.width * field.width) + (field.height * field.height), t = attempt * 0.8; // 0.2 * 4 = 0.8. Enlarging the spiral.
  459. // Emergency brake. TODO make spiralling logic more foolproof.
  460. if (attempt <= 10000) {
  461. result = {
  462. x: t * Math.cos(t),
  463. y: t * Math.sin(t)
  464. };
  465. if (!(Math.min(Math.abs(result.x), Math.abs(result.y)) < maxDelta)) {
  466. result = false;
  467. }
  468. }
  469. return result;
  470. }
  471. /**
  472. * Gives a set of cordinates for an rectangular spiral.
  473. *
  474. * @private
  475. * @function squareSpiral
  476. *
  477. * @param {number} attempt
  478. * How far along the spiral we have traversed.
  479. *
  480. * @param {Highcharts.WordcloudSpiralParamsObject} [params]
  481. * Additional parameters.
  482. *
  483. * @return {boolean|Highcharts.PositionObject}
  484. * Resulting coordinates, x and y. False if the word should be dropped from the
  485. * visualization.
  486. */
  487. function squareSpiral(attempt, params) {
  488. var a = attempt * 4, k = Math.ceil((Math.sqrt(a) - 1) / 2), t = 2 * k + 1, m = Math.pow(t, 2), isBoolean = function (x) {
  489. return typeof x === 'boolean';
  490. }, result = false;
  491. t -= 1;
  492. if (attempt <= 10000) {
  493. if (isBoolean(result) && a >= m - t) {
  494. result = {
  495. x: k - (m - a),
  496. y: -k
  497. };
  498. }
  499. m -= t;
  500. if (isBoolean(result) && a >= m - t) {
  501. result = {
  502. x: -k,
  503. y: -k + (m - a)
  504. };
  505. }
  506. m -= t;
  507. if (isBoolean(result)) {
  508. if (a >= m - t) {
  509. result = {
  510. x: -k + (m - a),
  511. y: k
  512. };
  513. }
  514. else {
  515. result = {
  516. x: k,
  517. y: k - (m - a - t)
  518. };
  519. }
  520. }
  521. result.x *= 5;
  522. result.y *= 5;
  523. }
  524. return result;
  525. }
  526. /**
  527. * Gives a set of cordinates for an rectangular spiral.
  528. *
  529. * @private
  530. * @function rectangularSpiral
  531. *
  532. * @param {number} attempt
  533. * How far along the spiral we have traversed.
  534. *
  535. * @param {Highcharts.WordcloudSpiralParamsObject} [params]
  536. * Additional parameters.
  537. *
  538. * @return {boolean|Higcharts.PositionObject}
  539. * Resulting coordinates, x and y. False if the word should be dropped from the
  540. * visualization.
  541. */
  542. function rectangularSpiral(attempt, params) {
  543. var result = squareSpiral(attempt, params), field = params.field;
  544. if (result) {
  545. result.x *= field.ratioX;
  546. result.y *= field.ratioY;
  547. }
  548. return result;
  549. }
  550. /**
  551. * @private
  552. * @function getRandomPosition
  553. *
  554. * @param {number} size
  555. * Random factor.
  556. *
  557. * @return {number}
  558. * Random position.
  559. */
  560. function getRandomPosition(size) {
  561. return Math.round((size * (Math.random() + 0.5)) / 2);
  562. }
  563. /**
  564. * Calculates the proper scale to fit the cloud inside the plotting area.
  565. *
  566. * @private
  567. * @function getScale
  568. *
  569. * @param {number} targetWidth
  570. * Width of target area.
  571. *
  572. * @param {number} targetHeight
  573. * Height of target area.
  574. *
  575. * @param {object} field
  576. * The playing field.
  577. *
  578. * @param {Highcharts.Series} series
  579. * Series object.
  580. *
  581. * @return {number}
  582. * Returns the value to scale the playing field up to the size of the target
  583. * area.
  584. */
  585. function getScale(targetWidth, targetHeight, field) {
  586. var height = Math.max(Math.abs(field.top), Math.abs(field.bottom)) * 2, width = Math.max(Math.abs(field.left), Math.abs(field.right)) * 2, scaleX = width > 0 ? 1 / width * targetWidth : 1, scaleY = height > 0 ? 1 / height * targetHeight : 1;
  587. return Math.min(scaleX, scaleY);
  588. }
  589. /**
  590. * Calculates what is called the playing field. The field is the area which all
  591. * the words are allowed to be positioned within. The area is proportioned to
  592. * match the target aspect ratio.
  593. *
  594. * @private
  595. * @function getPlayingField
  596. *
  597. * @param {number} targetWidth
  598. * Width of the target area.
  599. *
  600. * @param {number} targetHeight
  601. * Height of the target area.
  602. *
  603. * @param {Array<Highcharts.Point>} data
  604. * Array of points.
  605. *
  606. * @param {object} data.dimensions
  607. * The height and width of the word.
  608. *
  609. * @return {object}
  610. * The width and height of the playing field.
  611. */
  612. function getPlayingField(targetWidth, targetHeight, data) {
  613. var info = data.reduce(function (obj, point) {
  614. var dimensions = point.dimensions, x = Math.max(dimensions.width, dimensions.height);
  615. // Find largest height.
  616. obj.maxHeight = Math.max(obj.maxHeight, dimensions.height);
  617. // Find largest width.
  618. obj.maxWidth = Math.max(obj.maxWidth, dimensions.width);
  619. // Sum up the total maximum area of all the words.
  620. obj.area += x * x;
  621. return obj;
  622. }, {
  623. maxHeight: 0,
  624. maxWidth: 0,
  625. area: 0
  626. }),
  627. /**
  628. * Use largest width, largest height, or root of total area to give size
  629. * to the playing field.
  630. */
  631. x = Math.max(info.maxHeight, // Have enough space for the tallest word
  632. info.maxWidth, // Have enough space for the broadest word
  633. // Adjust 15% to account for close packing of words
  634. Math.sqrt(info.area) * 0.85), ratioX = targetWidth > targetHeight ? targetWidth / targetHeight : 1, ratioY = targetHeight > targetWidth ? targetHeight / targetWidth : 1;
  635. return {
  636. width: x * ratioX,
  637. height: x * ratioY,
  638. ratioX: ratioX,
  639. ratioY: ratioY
  640. };
  641. }
  642. /**
  643. * Calculates a number of degrees to rotate, based upon a number of orientations
  644. * within a range from-to.
  645. *
  646. * @private
  647. * @function getRotation
  648. *
  649. * @param {number} [orientations]
  650. * Number of orientations.
  651. *
  652. * @param {number} [index]
  653. * Index of point, used to decide orientation.
  654. *
  655. * @param {number} [from]
  656. * The smallest degree of rotation.
  657. *
  658. * @param {number} [to]
  659. * The largest degree of rotation.
  660. *
  661. * @return {boolean|number}
  662. * Returns the resulting rotation for the word. Returns false if invalid input
  663. * parameters.
  664. */
  665. function getRotation(orientations, index, from, to) {
  666. var result = false, // Default to false
  667. range, intervals, orientation;
  668. // Check if we have valid input parameters.
  669. if (isNumber(orientations) &&
  670. isNumber(index) &&
  671. isNumber(from) &&
  672. isNumber(to) &&
  673. orientations > 0 &&
  674. index > -1 &&
  675. to > from) {
  676. range = to - from;
  677. intervals = range / (orientations - 1 || 1);
  678. orientation = index % orientations;
  679. result = from + (orientation * intervals);
  680. }
  681. return result;
  682. }
  683. /**
  684. * Calculates the spiral positions and store them in scope for quick access.
  685. *
  686. * @private
  687. * @function getSpiral
  688. *
  689. * @param {Function} fn
  690. * The spiral function.
  691. *
  692. * @param {object} params
  693. * Additional parameters for the spiral.
  694. *
  695. * @return {Function}
  696. * Function with access to spiral positions.
  697. */
  698. function getSpiral(fn, params) {
  699. var length = 10000, i, arr = [];
  700. for (i = 1; i < length; i++) {
  701. arr.push(fn(i, params)); // @todo unnecessary amount of precaclulation
  702. }
  703. return function (attempt) {
  704. return attempt <= length ? arr[attempt - 1] : false;
  705. };
  706. }
  707. /**
  708. * Detects if a word is placed outside the playing field.
  709. *
  710. * @private
  711. * @function outsidePlayingField
  712. *
  713. * @param {Highcharts.PolygonBoxObject} rect
  714. * The word box.
  715. *
  716. * @param {Highcharts.WordcloudFieldObject} field
  717. * The width and height of the playing field.
  718. *
  719. * @return {boolean}
  720. * Returns true if the word is placed outside the field.
  721. */
  722. function outsidePlayingField(rect, field) {
  723. var playingField = {
  724. left: -(field.width / 2),
  725. right: field.width / 2,
  726. top: -(field.height / 2),
  727. bottom: field.height / 2
  728. };
  729. return !(playingField.left < rect.left &&
  730. playingField.right > rect.right &&
  731. playingField.top < rect.top &&
  732. playingField.bottom > rect.bottom);
  733. }
  734. /**
  735. * Check if a point intersects with previously placed words, or if it goes
  736. * outside the field boundaries. If a collision, then try to adjusts the
  737. * position.
  738. *
  739. * @private
  740. * @function intersectionTesting
  741. *
  742. * @param {Highcharts.Point} point
  743. * Point to test for intersections.
  744. *
  745. * @param {Highcharts.WordcloudTestOptionsObject} options
  746. * Options object.
  747. *
  748. * @return {boolean|Highcharts.PositionObject}
  749. * Returns an object with how much to correct the positions. Returns false if
  750. * the word should not be placed at all.
  751. */
  752. function intersectionTesting(point, options) {
  753. var placed = options.placed, field = options.field, rectangle = options.rectangle, polygon = options.polygon, spiral = options.spiral, attempt = 1, delta = {
  754. x: 0,
  755. y: 0
  756. },
  757. // Make a copy to update values during intersection testing.
  758. rect = point.rect = extend({}, rectangle);
  759. point.polygon = polygon;
  760. point.rotation = options.rotation;
  761. /* while w intersects any previously placed words:
  762. do {
  763. move w a little bit along a spiral path
  764. } while any part of w is outside the playing field and
  765. the spiral radius is still smallish */
  766. while (delta !== false &&
  767. (intersectsAnyWord(point, placed) ||
  768. outsidePlayingField(rect, field))) {
  769. delta = spiral(attempt);
  770. if (isObject(delta)) {
  771. // Update the DOMRect with new positions.
  772. rect.left = rectangle.left + delta.x;
  773. rect.right = rectangle.right + delta.x;
  774. rect.top = rectangle.top + delta.y;
  775. rect.bottom = rectangle.bottom + delta.y;
  776. point.polygon = movePolygon(delta.x, delta.y, polygon);
  777. }
  778. attempt++;
  779. }
  780. return delta;
  781. }
  782. /**
  783. * Extends the playing field to have enough space to fit a given word.
  784. *
  785. * @private
  786. * @function extendPlayingField
  787. *
  788. * @param {Highcharts.WordcloudFieldObject} field
  789. * The width, height and ratios of a playing field.
  790. *
  791. * @param {Highcharts.PolygonBoxObject} rectangle
  792. * The bounding box of the word to add space for.
  793. *
  794. * @return {Highcharts.WordcloudFieldObject}
  795. * Returns the extended playing field with updated height and width.
  796. */
  797. function extendPlayingField(field, rectangle) {
  798. var height, width, ratioX, ratioY, x, extendWidth, extendHeight, result;
  799. if (isObject(field) && isObject(rectangle)) {
  800. height = (rectangle.bottom - rectangle.top);
  801. width = (rectangle.right - rectangle.left);
  802. ratioX = field.ratioX;
  803. ratioY = field.ratioY;
  804. // Use the same variable to extend both the height and width.
  805. x = ((width * ratioX) > (height * ratioY)) ? width : height;
  806. // Multiply variable with ratios to preserve aspect ratio.
  807. extendWidth = x * ratioX;
  808. extendHeight = x * ratioY;
  809. // Calculate the size of the new field after adding space for the word.
  810. result = merge(field, {
  811. // Add space on the left and right.
  812. width: field.width + (extendWidth * 2),
  813. // Add space on the top and bottom.
  814. height: field.height + (extendHeight * 2)
  815. });
  816. }
  817. else {
  818. result = field;
  819. }
  820. // Return the new extended field.
  821. return result;
  822. }
  823. /**
  824. * If a rectangle is outside a give field, then the boundaries of the field is
  825. * adjusted accordingly. Modifies the field object which is passed as the first
  826. * parameter.
  827. *
  828. * @private
  829. * @function updateFieldBoundaries
  830. *
  831. * @param {Highcharts.WordcloudFieldObject} field
  832. * The bounding box of a playing field.
  833. *
  834. * @param {Highcharts.PolygonBoxObject} rectangle
  835. * The bounding box for a placed point.
  836. *
  837. * @return {Highcharts.WordcloudFieldObject}
  838. * Returns a modified field object.
  839. */
  840. function updateFieldBoundaries(field, rectangle) {
  841. // @todo improve type checking.
  842. if (!isNumber(field.left) || field.left > rectangle.left) {
  843. field.left = rectangle.left;
  844. }
  845. if (!isNumber(field.right) || field.right < rectangle.right) {
  846. field.right = rectangle.right;
  847. }
  848. if (!isNumber(field.top) || field.top > rectangle.top) {
  849. field.top = rectangle.top;
  850. }
  851. if (!isNumber(field.bottom) || field.bottom < rectangle.bottom) {
  852. field.bottom = rectangle.bottom;
  853. }
  854. return field;
  855. }
  856. /**
  857. * A word cloud is a visualization of a set of words, where the size and
  858. * placement of a word is determined by how it is weighted.
  859. *
  860. * @sample highcharts/demo/wordcloud
  861. * Word Cloud chart
  862. *
  863. * @extends plotOptions.column
  864. * @excluding allAreas, boostThreshold, clip, colorAxis, compare,
  865. * compareBase, crisp, cropTreshold, dataGrouping, dataLabels,
  866. * depth, dragDrop, edgeColor, findNearestPointBy,
  867. * getExtremesFromAll, grouping, groupPadding, groupZPadding,
  868. * joinBy, maxPointWidth, minPointLength, navigatorOptions,
  869. * negativeColor, pointInterval, pointIntervalUnit, pointPadding,
  870. * pointPlacement, pointRange, pointStart, pointWidth, pointStart,
  871. * pointWidth, shadow, showCheckbox, showInNavigator,
  872. * softThreshold, stacking, threshold, zoneAxis, zones,
  873. * dataSorting
  874. * @product highcharts
  875. * @since 6.0.0
  876. * @requires modules/wordcloud
  877. * @optionparent plotOptions.wordcloud
  878. */
  879. var wordCloudOptions = {
  880. /**
  881. * If there is no space for a word on the playing field, then this option
  882. * will allow the playing field to be extended to fit the word. If false
  883. * then the word will be dropped from the visualization.
  884. *
  885. * NB! This option is currently not decided to be published in the API, and
  886. * is therefore marked as private.
  887. *
  888. * @private
  889. */
  890. allowExtendPlayingField: true,
  891. animation: {
  892. /** @internal */
  893. duration: 500
  894. },
  895. borderWidth: 0,
  896. clip: false,
  897. colorByPoint: true,
  898. /**
  899. * A threshold determining the minimum font size that can be applied to a
  900. * word.
  901. */
  902. minFontSize: 1,
  903. /**
  904. * The word with the largest weight will have a font size equal to this
  905. * value. The font size of a word is the ratio between its weight and the
  906. * largest occuring weight, multiplied with the value of maxFontSize.
  907. */
  908. maxFontSize: 25,
  909. /**
  910. * This option decides which algorithm is used for placement, and rotation
  911. * of a word. The choice of algorith is therefore a crucial part of the
  912. * resulting layout of the wordcloud. It is possible for users to add their
  913. * own custom placement strategies for use in word cloud. Read more about it
  914. * in our
  915. * [documentation](https://www.highcharts.com/docs/chart-and-series-types/word-cloud-series#custom-placement-strategies)
  916. *
  917. * @validvalue: ["center", "random"]
  918. */
  919. placementStrategy: 'center',
  920. /**
  921. * Rotation options for the words in the wordcloud.
  922. *
  923. * @sample highcharts/plotoptions/wordcloud-rotation
  924. * Word cloud with rotation
  925. */
  926. rotation: {
  927. /**
  928. * The smallest degree of rotation for a word.
  929. */
  930. from: 0,
  931. /**
  932. * The number of possible orientations for a word, within the range of
  933. * `rotation.from` and `rotation.to`. Must be a number larger than 0.
  934. */
  935. orientations: 2,
  936. /**
  937. * The largest degree of rotation for a word.
  938. */
  939. to: 90
  940. },
  941. showInLegend: false,
  942. /**
  943. * Spiral used for placing a word after the initial position experienced a
  944. * collision with either another word or the borders.
  945. * It is possible for users to add their own custom spiralling algorithms
  946. * for use in word cloud. Read more about it in our
  947. * [documentation](https://www.highcharts.com/docs/chart-and-series-types/word-cloud-series#custom-spiralling-algorithm)
  948. *
  949. * @validvalue: ["archimedean", "rectangular", "square"]
  950. */
  951. spiral: 'rectangular',
  952. /**
  953. * CSS styles for the words.
  954. *
  955. * @type {Highcharts.CSSObject}
  956. * @default {"fontFamily":"sans-serif", "fontWeight": "900"}
  957. */
  958. style: {
  959. /** @ignore-option */
  960. fontFamily: 'sans-serif',
  961. /** @ignore-option */
  962. fontWeight: '900',
  963. /** @ignore-option */
  964. whiteSpace: 'nowrap'
  965. },
  966. tooltip: {
  967. followPointer: true,
  968. pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.weight}</b><br/>'
  969. }
  970. };
  971. // Properties of the WordCloud series.
  972. var wordCloudSeries = {
  973. animate: Series.prototype.animate,
  974. animateDrilldown: noop,
  975. animateDrillupFrom: noop,
  976. setClip: noop,
  977. bindAxes: function () {
  978. var wordcloudAxis = {
  979. endOnTick: false,
  980. gridLineWidth: 0,
  981. lineWidth: 0,
  982. maxPadding: 0,
  983. startOnTick: false,
  984. title: null,
  985. tickPositions: []
  986. };
  987. Series.prototype.bindAxes.call(this);
  988. extend(this.yAxis.options, wordcloudAxis);
  989. extend(this.xAxis.options, wordcloudAxis);
  990. },
  991. pointAttribs: function (point, state) {
  992. var attribs = H.seriesTypes.column.prototype
  993. .pointAttribs.call(this, point, state);
  994. delete attribs.stroke;
  995. delete attribs['stroke-width'];
  996. return attribs;
  997. },
  998. /**
  999. * Calculates the fontSize of a word based on its weight.
  1000. *
  1001. * @private
  1002. * @function Highcharts.Series#deriveFontSize
  1003. *
  1004. * @param {number} [relativeWeight=0]
  1005. * The weight of the word, on a scale 0-1.
  1006. *
  1007. * @param {number} [maxFontSize=1]
  1008. * The maximum font size of a word.
  1009. *
  1010. * @param {number} [minFontSize=1]
  1011. * The minimum font size of a word.
  1012. *
  1013. * @return {number}
  1014. * Returns the resulting fontSize of a word. If minFontSize is larger then
  1015. * maxFontSize the result will equal minFontSize.
  1016. */
  1017. deriveFontSize: function deriveFontSize(relativeWeight, maxFontSize, minFontSize) {
  1018. var weight = isNumber(relativeWeight) ? relativeWeight : 0, max = isNumber(maxFontSize) ? maxFontSize : 1, min = isNumber(minFontSize) ? minFontSize : 1;
  1019. return Math.floor(Math.max(min, weight * max));
  1020. },
  1021. drawPoints: function () {
  1022. var series = this, hasRendered = series.hasRendered, xAxis = series.xAxis, yAxis = series.yAxis, chart = series.chart, group = series.group, options = series.options, animation = options.animation, allowExtendPlayingField = options.allowExtendPlayingField, renderer = chart.renderer, testElement = renderer.text().add(group), placed = [], placementStrategy = series.placementStrategy[options.placementStrategy], spiral, rotation = options.rotation, scale, weights = series.points.map(function (p) {
  1023. return p.weight;
  1024. }), maxWeight = Math.max.apply(null, weights),
  1025. // concat() prevents from sorting the original array.
  1026. data = series.points.concat().sort(function (a, b) {
  1027. return b.weight - a.weight; // Sort descending
  1028. }), field;
  1029. // Reset the scale before finding the dimensions (#11993).
  1030. // SVGGRaphicsElement.getBBox() (used in SVGElement.getBBox(boolean))
  1031. // returns slightly different values for the same element depending on
  1032. // whether it is rendered in a group which has already defined scale
  1033. // (e.g. 6) or in the group without a scale (scale = 1).
  1034. series.group.attr({
  1035. scaleX: 1,
  1036. scaleY: 1
  1037. });
  1038. // Get the dimensions for each word.
  1039. // Used in calculating the playing field.
  1040. data.forEach(function (point) {
  1041. var relativeWeight = 1 / maxWeight * point.weight, fontSize = series.deriveFontSize(relativeWeight, options.maxFontSize, options.minFontSize), css = extend({
  1042. fontSize: fontSize + 'px'
  1043. }, options.style), bBox;
  1044. testElement.css(css).attr({
  1045. x: 0,
  1046. y: 0,
  1047. text: point.name
  1048. });
  1049. bBox = testElement.getBBox(true);
  1050. point.dimensions = {
  1051. height: bBox.height,
  1052. width: bBox.width
  1053. };
  1054. });
  1055. // Calculate the playing field.
  1056. field = getPlayingField(xAxis.len, yAxis.len, data);
  1057. spiral = getSpiral(series.spirals[options.spiral], {
  1058. field: field
  1059. });
  1060. // Draw all the points.
  1061. data.forEach(function (point) {
  1062. var relativeWeight = 1 / maxWeight * point.weight, fontSize = series.deriveFontSize(relativeWeight, options.maxFontSize, options.minFontSize), css = extend({
  1063. fontSize: fontSize + 'px'
  1064. }, options.style), placement = placementStrategy(point, {
  1065. data: data,
  1066. field: field,
  1067. placed: placed,
  1068. rotation: rotation
  1069. }), attr = extend(series.pointAttribs(point, (point.selected && 'select')), {
  1070. align: 'center',
  1071. 'alignment-baseline': 'middle',
  1072. x: placement.x,
  1073. y: placement.y,
  1074. text: point.name,
  1075. rotation: placement.rotation
  1076. }), polygon = getPolygon(placement.x, placement.y, point.dimensions.width, point.dimensions.height, placement.rotation), rectangle = getBoundingBoxFromPolygon(polygon), delta = intersectionTesting(point, {
  1077. rectangle: rectangle,
  1078. polygon: polygon,
  1079. field: field,
  1080. placed: placed,
  1081. spiral: spiral,
  1082. rotation: placement.rotation
  1083. }), animate;
  1084. // If there is no space for the word, extend the playing field.
  1085. if (!delta && allowExtendPlayingField) {
  1086. // Extend the playing field to fit the word.
  1087. field = extendPlayingField(field, rectangle);
  1088. // Run intersection testing one more time to place the word.
  1089. delta = intersectionTesting(point, {
  1090. rectangle: rectangle,
  1091. polygon: polygon,
  1092. field: field,
  1093. placed: placed,
  1094. spiral: spiral,
  1095. rotation: placement.rotation
  1096. });
  1097. }
  1098. // Check if point was placed, if so delete it, otherwise place it on
  1099. // the correct positions.
  1100. if (isObject(delta)) {
  1101. attr.x += delta.x;
  1102. attr.y += delta.y;
  1103. rectangle.left += delta.x;
  1104. rectangle.right += delta.x;
  1105. rectangle.top += delta.y;
  1106. rectangle.bottom += delta.y;
  1107. field = updateFieldBoundaries(field, rectangle);
  1108. placed.push(point);
  1109. point.isNull = false;
  1110. }
  1111. else {
  1112. point.isNull = true;
  1113. }
  1114. if (animation) {
  1115. // Animate to new positions
  1116. animate = {
  1117. x: attr.x,
  1118. y: attr.y
  1119. };
  1120. // Animate from center of chart
  1121. if (!hasRendered) {
  1122. attr.x = 0;
  1123. attr.y = 0;
  1124. // or animate from previous position
  1125. }
  1126. else {
  1127. delete attr.x;
  1128. delete attr.y;
  1129. }
  1130. }
  1131. point.draw({
  1132. animatableAttribs: animate,
  1133. attribs: attr,
  1134. css: css,
  1135. group: group,
  1136. renderer: renderer,
  1137. shapeArgs: void 0,
  1138. shapeType: 'text'
  1139. });
  1140. });
  1141. // Destroy the element after use.
  1142. testElement = testElement.destroy();
  1143. // Scale the series group to fit within the plotArea.
  1144. scale = getScale(xAxis.len, yAxis.len, field);
  1145. series.group.attr({
  1146. scaleX: scale,
  1147. scaleY: scale
  1148. });
  1149. },
  1150. hasData: function () {
  1151. var series = this;
  1152. return (isObject(series) &&
  1153. series.visible === true &&
  1154. isArray(series.points) &&
  1155. series.points.length > 0);
  1156. },
  1157. // Strategies used for deciding rotation and initial position of a word. To
  1158. // implement a custom strategy, have a look at the function random for
  1159. // example.
  1160. placementStrategy: {
  1161. random: function (point, options) {
  1162. var field = options.field, r = options.rotation;
  1163. return {
  1164. x: getRandomPosition(field.width) - (field.width / 2),
  1165. y: getRandomPosition(field.height) - (field.height / 2),
  1166. rotation: getRotation(r.orientations, point.index, r.from, r.to)
  1167. };
  1168. },
  1169. center: function (point, options) {
  1170. var r = options.rotation;
  1171. return {
  1172. x: 0,
  1173. y: 0,
  1174. rotation: getRotation(r.orientations, point.index, r.from, r.to)
  1175. };
  1176. }
  1177. },
  1178. pointArrayMap: ['weight'],
  1179. // Spirals used for placing a word after the initial position experienced a
  1180. // collision with either another word or the borders. To implement a custom
  1181. // spiral, look at the function archimedeanSpiral for example.
  1182. spirals: {
  1183. 'archimedean': archimedeanSpiral,
  1184. 'rectangular': rectangularSpiral,
  1185. 'square': squareSpiral
  1186. },
  1187. utils: {
  1188. extendPlayingField: extendPlayingField,
  1189. getRotation: getRotation,
  1190. isPolygonsColliding: isPolygonsColliding,
  1191. rotate2DToOrigin: polygon.rotate2DToOrigin,
  1192. rotate2DToPoint: polygon.rotate2DToPoint
  1193. },
  1194. getPlotBox: function () {
  1195. var series = this, chart = series.chart, inverted = chart.inverted,
  1196. // Swap axes for inverted (#2339)
  1197. xAxis = series[(inverted ? 'yAxis' : 'xAxis')], yAxis = series[(inverted ? 'xAxis' : 'yAxis')], width = xAxis ? xAxis.len : chart.plotWidth, height = yAxis ? yAxis.len : chart.plotHeight, x = xAxis ? xAxis.left : chart.plotLeft, y = yAxis ? yAxis.top : chart.plotTop;
  1198. return {
  1199. translateX: x + (width / 2),
  1200. translateY: y + (height / 2),
  1201. scaleX: 1,
  1202. scaleY: 1
  1203. };
  1204. }
  1205. };
  1206. // Properties of the Sunburst series.
  1207. var wordCloudPoint = {
  1208. draw: drawPoint,
  1209. shouldDraw: function shouldDraw() {
  1210. var point = this;
  1211. return !point.isNull;
  1212. },
  1213. isValid: function isValid() {
  1214. return true;
  1215. },
  1216. weight: 1
  1217. };
  1218. /**
  1219. * A `wordcloud` series. If the [type](#series.wordcloud.type) option is not
  1220. * specified, it is inherited from [chart.type](#chart.type).
  1221. *
  1222. * @extends series,plotOptions.wordcloud
  1223. * @exclude dataSorting
  1224. * @product highcharts
  1225. * @requires modules/wordcloud
  1226. * @apioption series.wordcloud
  1227. */
  1228. /**
  1229. * An array of data points for the series. For the `wordcloud` series type,
  1230. * points can be given in the following ways:
  1231. *
  1232. * 1. An array of arrays with 2 values. In this case, the values correspond to
  1233. * `name,weight`.
  1234. * ```js
  1235. * data: [
  1236. * ['Lorem', 4],
  1237. * ['Ipsum', 1]
  1238. * ]
  1239. * ```
  1240. *
  1241. * 2. An array of objects with named values. The following snippet shows only a
  1242. * few settings, see the complete options set below. If the total number of
  1243. * data points exceeds the series'
  1244. * [turboThreshold](#series.arearange.turboThreshold), this option is not
  1245. * available.
  1246. * ```js
  1247. * data: [{
  1248. * name: "Lorem",
  1249. * weight: 4
  1250. * }, {
  1251. * name: "Ipsum",
  1252. * weight: 1
  1253. * }]
  1254. * ```
  1255. *
  1256. * @type {Array<Array<string,number>|*>}
  1257. * @extends series.line.data
  1258. * @excluding drilldown, marker, x, y
  1259. * @product highcharts
  1260. * @apioption series.wordcloud.data
  1261. */
  1262. /**
  1263. * The name decides the text for a word.
  1264. *
  1265. * @type {string}
  1266. * @since 6.0.0
  1267. * @product highcharts
  1268. * @apioption series.sunburst.data.name
  1269. */
  1270. /**
  1271. * The weighting of a word. The weight decides the relative size of a word
  1272. * compared to the rest of the collection.
  1273. *
  1274. * @type {number}
  1275. * @since 6.0.0
  1276. * @product highcharts
  1277. * @apioption series.sunburst.data.weight
  1278. */
  1279. /**
  1280. * @private
  1281. * @class
  1282. * @name Highcharts.seriesTypes.wordcloud
  1283. *
  1284. * @augments Highcharts.Series
  1285. */
  1286. seriesType('wordcloud', 'column', wordCloudOptions, wordCloudSeries, wordCloudPoint);
  1287. });
  1288. _registerModule(_modules, 'masters/modules/wordcloud.src.js', [], function () {
  1289. });
  1290. }));