sankey.src.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. /**
  2. * @license Highcharts JS v7.0.2 (2019-01-17)
  3. * Sankey diagram module
  4. *
  5. * (c) 2010-2019 Torstein Honsi
  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(function () {
  16. return factory;
  17. });
  18. } else {
  19. factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
  20. }
  21. }(function (Highcharts) {
  22. (function (H) {
  23. H.NodesMixin = {
  24. // Create a single node that holds information on incoming and outgoing
  25. // links.
  26. createNode: function (id) {
  27. function findById(nodes, id) {
  28. return H.find(nodes, function (node) {
  29. return node.id === id;
  30. });
  31. }
  32. var node = findById(this.nodes, id),
  33. PointClass = this.pointClass,
  34. options;
  35. if (!node) {
  36. options = this.options.nodes && findById(this.options.nodes, id);
  37. node = (new PointClass()).init(
  38. this,
  39. H.extend({
  40. className: 'highcharts-node',
  41. isNode: true,
  42. id: id,
  43. y: 1 // Pass isNull test
  44. }, options)
  45. );
  46. node.linksTo = [];
  47. node.linksFrom = [];
  48. node.formatPrefix = 'node';
  49. node.name = node.name || node.options.id; // for use in formats
  50. // Return the largest sum of either the incoming or outgoing links.
  51. node.getSum = function () {
  52. var sumTo = 0,
  53. sumFrom = 0;
  54. node.linksTo.forEach(function (link) {
  55. sumTo += link.weight;
  56. });
  57. node.linksFrom.forEach(function (link) {
  58. sumFrom += link.weight;
  59. });
  60. return Math.max(sumTo, sumFrom);
  61. };
  62. // Get the offset in weight values of a point/link.
  63. node.offset = function (point, coll) {
  64. var offset = 0;
  65. for (var i = 0; i < node[coll].length; i++) {
  66. if (node[coll][i] === point) {
  67. return offset;
  68. }
  69. offset += node[coll][i].weight;
  70. }
  71. };
  72. // Return true if the node has a shape, otherwise all links are
  73. // outgoing.
  74. node.hasShape = function () {
  75. var outgoing = 0;
  76. node.linksTo.forEach(function (link) {
  77. if (link.outgoing) {
  78. outgoing++;
  79. }
  80. });
  81. return !node.linksTo.length || outgoing !== node.linksTo.length;
  82. };
  83. this.nodes.push(node);
  84. }
  85. return node;
  86. }
  87. };
  88. }(Highcharts));
  89. (function (H) {
  90. /* *
  91. * Sankey diagram module
  92. *
  93. * (c) 2010-2019 Torstein Honsi
  94. *
  95. * License: www.highcharts.com/license
  96. */
  97. var defined = H.defined,
  98. seriesType = H.seriesType,
  99. pick = H.pick,
  100. Point = H.Point;
  101. /**
  102. * @private
  103. * @class
  104. * @name Highcharts.seriesTypes.sankey
  105. *
  106. * @augments Highcharts.Series
  107. */
  108. seriesType('sankey', 'column'
  109. /**
  110. * A sankey diagram is a type of flow diagram, in which the width of the
  111. * link between two nodes is shown proportionally to the flow quantity.
  112. *
  113. * @sample highcharts/demo/sankey-diagram/
  114. * Sankey diagram
  115. * @sample highcharts/plotoptions/sankey-inverted/
  116. * Inverted sankey diagram
  117. * @sample highcharts/plotoptions/sankey-outgoing
  118. * Sankey diagram with outgoing links
  119. *
  120. * @extends plotOptions.column
  121. * @since 6.0.0
  122. * @product highcharts
  123. * @excluding animationLimit, boostThreshold, borderColor, borderRadius,
  124. * borderWidth, crisp, cropThreshold, depth, edgeColor, edgeWidth,
  125. * findNearestPointBy, grouping, groupPadding, groupZPadding,
  126. * maxPointWidth, negativeColor, pointInterval, pointIntervalUnit,
  127. * pointPadding, pointPlacement, pointRange, pointStart,
  128. * pointWidth, shadow, softThreshold, stacking, threshold,
  129. * zoneAxis, zones
  130. * @optionparent plotOptions.sankey
  131. */
  132. , {
  133. colorByPoint: true,
  134. /**
  135. * Higher numbers makes the links in a sankey diagram render more curved.
  136. * A `curveFactor` of 0 makes the lines straight.
  137. */
  138. curveFactor: 0.33,
  139. /**
  140. * Options for the data labels appearing on top of the nodes and links. For
  141. * sankey charts, data labels are visible for the nodes by default, but
  142. * hidden for links. This is controlled by modifying the `nodeFormat`, and
  143. * the `format` that applies to links and is an empty string by default.
  144. */
  145. dataLabels: {
  146. enabled: true,
  147. backgroundColor: 'none', // enable padding
  148. crop: false,
  149. /**
  150. * The
  151. * [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)
  152. * specifying what to show for _nodes_ in the sankey diagram. By default
  153. * the `nodeFormatter` returns `{point.name}`.
  154. *
  155. * @type {string}
  156. */
  157. nodeFormat: undefined,
  158. /**
  159. * Callback to format data labels for _nodes_ in the sankey diagram.
  160. * The `nodeFormat` option takes precedence over the `nodeFormatter`.
  161. *
  162. * @type {Highcharts.FormatterCallbackFunction<object>}
  163. * @since 6.0.2
  164. */
  165. nodeFormatter: function () {
  166. return this.point.name;
  167. },
  168. /**
  169. * The
  170. * [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)
  171. * specifying what to show for _links_ in the sankey diagram. Defaults
  172. * to an empty string returned from the `formatter`, in effect disabling
  173. * the labels.
  174. *
  175. * @type {string}
  176. */
  177. format: undefined,
  178. /**
  179. * Callback to format data labels for _links_ in the sankey diagram.
  180. * The `format` option takes precedence over the `formatter`.
  181. *
  182. * @type {Highcharts.FormatterCallbackFunction<Highcharts.SeriesDataLabelsFormatterContextObject>}
  183. * @since 6.0.2
  184. */
  185. formatter: function () {
  186. return '';
  187. },
  188. inside: true
  189. },
  190. /**
  191. * Opacity for the links between nodes in the sankey diagram.
  192. */
  193. linkOpacity: 0.5,
  194. /**
  195. * The pixel width of each node in a sankey diagram, or the height in case
  196. * the chart is inverted.
  197. */
  198. nodeWidth: 20,
  199. /**
  200. * The padding between nodes in a sankey diagram, in pixels.
  201. */
  202. nodePadding: 10,
  203. showInLegend: false,
  204. states: {
  205. hover: {
  206. /**
  207. * Opacity for the links between nodes in the sankey diagram in
  208. * hover mode.
  209. */
  210. linkOpacity: 1
  211. }
  212. },
  213. tooltip: {
  214. /**
  215. * A callback for defining the format for _nodes_ in the sankey chart's
  216. * tooltip, as opposed to links.
  217. *
  218. * @type {Highcharts.FormatterCallbackFunction<object>}
  219. * @since 6.0.2
  220. * @apioption plotOptions.sankey.tooltip.nodeFormatter
  221. */
  222. /**
  223. * Whether the tooltip should follow the pointer or stay fixed on the
  224. * item.
  225. */
  226. followPointer: true,
  227. headerFormat:
  228. '<span style="font-size: 10px">{series.name}</span><br/>',
  229. pointFormat: '{point.fromNode.name} \u2192 {point.toNode.name}: <b>{point.weight}</b><br/>',
  230. /**
  231. * The
  232. * [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)
  233. * specifying what to show for _nodes_ in tooltip of a sankey diagram
  234. * series, as opposed to links.
  235. */
  236. nodeFormat: '{point.name}: <b>{point.sum}</b><br/>'
  237. }
  238. }, {
  239. isCartesian: false,
  240. forceDL: true,
  241. // Create a single node that holds information on incoming and outgoing
  242. // links.
  243. createNode: H.NodesMixin.createNode,
  244. // Create a node column.
  245. createNodeColumn: function () {
  246. var chart = this.chart,
  247. column = [],
  248. nodePadding = this.options.nodePadding;
  249. column.sum = function () {
  250. var sum = 0;
  251. this.forEach(function (node) {
  252. sum += node.getSum();
  253. });
  254. return sum;
  255. };
  256. // Get the offset in pixels of a node inside the column.
  257. column.offset = function (node, factor) {
  258. var offset = 0;
  259. for (var i = 0; i < column.length; i++) {
  260. if (column[i] === node) {
  261. return offset + (node.options.offset || 0);
  262. }
  263. offset += column[i].getSum() * factor + nodePadding;
  264. }
  265. };
  266. // Get the column height in pixels.
  267. column.top = function (factor) {
  268. var height = 0;
  269. for (var i = 0; i < column.length; i++) {
  270. if (i > 0) {
  271. height += nodePadding;
  272. }
  273. height += column[i].getSum() * factor;
  274. }
  275. return (chart.plotSizeY - height) / 2;
  276. };
  277. return column;
  278. },
  279. // Create node columns by analyzing the nodes and the relations between
  280. // incoming and outgoing links.
  281. createNodeColumns: function () {
  282. var columns = [];
  283. this.nodes.forEach(function (node) {
  284. var fromColumn = -1,
  285. i,
  286. point;
  287. if (!H.defined(node.options.column)) {
  288. // No links to this node, place it left
  289. if (node.linksTo.length === 0) {
  290. node.column = 0;
  291. // There are incoming links, place it to the right of the
  292. // highest order column that links to this one.
  293. } else {
  294. for (i = 0; i < node.linksTo.length; i++) {
  295. point = node.linksTo[0];
  296. if (point.fromNode.column > fromColumn) {
  297. fromColumn = point.fromNode.column;
  298. }
  299. }
  300. node.column = fromColumn + 1;
  301. }
  302. }
  303. if (!columns[node.column]) {
  304. columns[node.column] = this.createNodeColumn();
  305. }
  306. columns[node.column].push(node);
  307. }, this);
  308. // Fill in empty columns (#8865)
  309. for (var i = 0; i < columns.length; i++) {
  310. if (columns[i] === undefined) {
  311. columns[i] = this.createNodeColumn();
  312. }
  313. }
  314. return columns;
  315. },
  316. // Return the presentational attributes.
  317. pointAttribs: function (point, state) {
  318. var opacity = this.options.linkOpacity,
  319. color = point.color;
  320. if (state) {
  321. opacity = this.options.states[state].linkOpacity || opacity;
  322. color = this.options.states[state].color || point.color;
  323. }
  324. return {
  325. fill: point.isNode ?
  326. color :
  327. H.color(color).setOpacity(opacity).get()
  328. };
  329. },
  330. // Extend generatePoints by adding the nodes, which are Point objects
  331. // but pushed to the this.nodes array.
  332. generatePoints: function () {
  333. var nodeLookup = {},
  334. chart = this.chart;
  335. H.Series.prototype.generatePoints.call(this);
  336. if (!this.nodes) {
  337. this.nodes = []; // List of Point-like node items
  338. }
  339. this.colorCounter = 0;
  340. // Reset links from previous run
  341. this.nodes.forEach(function (node) {
  342. node.linksFrom.length = 0;
  343. node.linksTo.length = 0;
  344. });
  345. // Create the node list and set up links
  346. this.points.forEach(function (point) {
  347. if (defined(point.from)) {
  348. if (!nodeLookup[point.from]) {
  349. nodeLookup[point.from] = this.createNode(point.from);
  350. }
  351. nodeLookup[point.from].linksFrom.push(point);
  352. point.fromNode = nodeLookup[point.from];
  353. // Point color defaults to the fromNode's color
  354. if (chart.styledMode) {
  355. point.colorIndex = pick(
  356. point.options.colorIndex,
  357. nodeLookup[point.from].colorIndex
  358. );
  359. } else {
  360. point.color =
  361. point.options.color || nodeLookup[point.from].color;
  362. }
  363. }
  364. if (defined(point.to)) {
  365. if (!nodeLookup[point.to]) {
  366. nodeLookup[point.to] = this.createNode(point.to);
  367. }
  368. nodeLookup[point.to].linksTo.push(point);
  369. point.toNode = nodeLookup[point.to];
  370. }
  371. // for use in formats
  372. point.name = point.name || point.options.id;
  373. }, this);
  374. // Order the nodes, starting with the root node(s) (#9818)
  375. function order(node, level) {
  376. node.level = level;
  377. node.linksFrom.forEach(function (link) {
  378. order(link.toNode, level + 1);
  379. });
  380. }
  381. this.nodes
  382. // Identify the root node(s)
  383. .filter(function (node) {
  384. return node.linksTo.length === 0;
  385. })
  386. // Start by the root node(s) and recursively set the level on
  387. // all following nodes.
  388. .forEach(function (node) {
  389. order(node, 0);
  390. });
  391. this.nodes.sort(function (a, b) {
  392. return a.level - b.level;
  393. });
  394. },
  395. // Destroy all nodes on setting new data
  396. setData: function () {
  397. if (this.nodes) {
  398. this.nodes.forEach(function (node) {
  399. node.destroy();
  400. });
  401. this.nodes.length = 0;
  402. }
  403. H.Series.prototype.setData.apply(this, arguments);
  404. },
  405. // Run pre-translation by generating the nodeColumns.
  406. translate: function () {
  407. if (!this.processedXData) {
  408. this.processData();
  409. }
  410. this.generatePoints();
  411. this.nodeColumns = this.createNodeColumns();
  412. var chart = this.chart,
  413. inverted = chart.inverted,
  414. options = this.options,
  415. left = 0,
  416. nodeWidth = options.nodeWidth,
  417. nodeColumns = this.nodeColumns,
  418. colDistance = (chart.plotSizeX - nodeWidth) /
  419. (nodeColumns.length - 1),
  420. curvy = (
  421. (inverted ? -colDistance : colDistance) *
  422. options.curveFactor
  423. ),
  424. factor = Infinity;
  425. // Find out how much space is needed. Base it on the translation
  426. // factor of the most spaceous column.
  427. this.nodeColumns.forEach(function (column) {
  428. var height = chart.plotSizeY -
  429. (column.length - 1) * options.nodePadding;
  430. factor = Math.min(factor, height / column.sum());
  431. });
  432. this.nodeColumns.forEach(function (column) {
  433. column.forEach(function (node) {
  434. var sum = node.getSum(),
  435. height = sum * factor,
  436. fromNodeTop = (
  437. column.top(factor) +
  438. column.offset(node, factor)
  439. ),
  440. nodeLeft = inverted ?
  441. chart.plotSizeX - left :
  442. left;
  443. node.sum = sum;
  444. // Draw the node
  445. node.shapeType = 'rect';
  446. if (!inverted) {
  447. node.shapeArgs = {
  448. x: nodeLeft,
  449. y: fromNodeTop,
  450. width: nodeWidth,
  451. height: height
  452. };
  453. } else {
  454. node.shapeArgs = {
  455. x: nodeLeft - nodeWidth,
  456. y: chart.plotSizeY - fromNodeTop - height,
  457. width: nodeWidth,
  458. height: height
  459. };
  460. }
  461. node.shapeArgs.display = node.hasShape() ? '' : 'none';
  462. // Pass test in drawPoints
  463. node.plotY = 1;
  464. // Draw the links from this node
  465. node.linksFrom.forEach(function (point) {
  466. var linkHeight = point.weight * factor,
  467. fromLinkTop = node.offset(point, 'linksFrom') *
  468. factor,
  469. fromY = fromNodeTop + fromLinkTop,
  470. toNode = point.toNode,
  471. toColTop = nodeColumns[toNode.column].top(factor),
  472. toY = (
  473. toColTop +
  474. (toNode.offset(point, 'linksTo') * factor) +
  475. nodeColumns[toNode.column].offset(
  476. toNode,
  477. factor
  478. )
  479. ),
  480. nodeW = nodeWidth,
  481. right = toNode.column * colDistance,
  482. outgoing = point.outgoing,
  483. straight = right > nodeLeft;
  484. if (inverted) {
  485. fromY = chart.plotSizeY - fromY;
  486. toY = chart.plotSizeY - toY;
  487. right = chart.plotSizeX - right;
  488. nodeW = -nodeW;
  489. linkHeight = -linkHeight;
  490. straight = nodeLeft > right;
  491. }
  492. point.shapeType = 'path';
  493. // Links going from left to right
  494. if (straight) {
  495. point.shapeArgs = {
  496. d: [
  497. 'M', nodeLeft + nodeW, fromY,
  498. 'C', nodeLeft + nodeW + curvy, fromY,
  499. right - curvy, toY,
  500. right, toY,
  501. 'L',
  502. right + (outgoing ? nodeW : 0),
  503. toY + linkHeight / 2,
  504. 'L',
  505. right,
  506. toY + linkHeight,
  507. 'C', right - curvy, toY + linkHeight,
  508. nodeLeft + nodeW + curvy,
  509. fromY + linkHeight,
  510. nodeLeft + nodeW, fromY + linkHeight,
  511. 'z'
  512. ]
  513. };
  514. // Experimental: Circular links pointing backwards. In
  515. // v6.1.0 this breaks the rendering completely, so even
  516. // this experimental rendering is an improvement. #8218.
  517. // @todo
  518. // - Make room for the link in the layout
  519. // - Automatically determine if the link should go up or
  520. // down.
  521. } else {
  522. var bend = 20,
  523. vDist = chart.plotHeight - fromY - linkHeight,
  524. x1 = right - bend - linkHeight,
  525. x2 = right - bend,
  526. x3 = right,
  527. x4 = nodeLeft + nodeW,
  528. x5 = x4 + bend,
  529. x6 = x5 + linkHeight,
  530. fy1 = fromY,
  531. fy2 = fromY + linkHeight,
  532. fy3 = fy2 + bend,
  533. y4 = fy3 + vDist,
  534. y5 = y4 + bend,
  535. y6 = y5 + linkHeight,
  536. ty1 = toY,
  537. ty2 = ty1 + linkHeight,
  538. ty3 = ty2 + bend,
  539. cfy1 = fy2 - linkHeight * 0.7,
  540. cy2 = y5 + linkHeight * 0.7,
  541. cty1 = ty2 - linkHeight * 0.7,
  542. cx1 = x3 - linkHeight * 0.7,
  543. cx2 = x4 + linkHeight * 0.7;
  544. point.shapeArgs = {
  545. d: [
  546. 'M', x4, fy1,
  547. 'C', cx2, fy1, x6, cfy1, x6, fy3,
  548. 'L', x6, y4,
  549. 'C', x6, cy2, cx2, y6, x4, y6,
  550. 'L', x3, y6,
  551. 'C', cx1, y6, x1, cy2, x1, y4,
  552. 'L', x1, ty3,
  553. 'C', x1, cty1, cx1, ty1, x3, ty1,
  554. 'L', x3, ty2,
  555. 'C', x2, ty2, x2, ty2, x2, ty3,
  556. 'L', x2, y4,
  557. 'C', x2, y5, x2, y5, x3, y5,
  558. 'L', x4, y5,
  559. 'C', x5, y5, x5, y5, x5, y4,
  560. 'L', x5, fy3,
  561. 'C', x5, fy2, x5, fy2, x4, fy2,
  562. 'z'
  563. ]
  564. };
  565. }
  566. // Place data labels in the middle
  567. point.dlBox = {
  568. x: nodeLeft + (right - nodeLeft + nodeW) / 2,
  569. y: fromY + (toY - fromY) / 2,
  570. height: linkHeight,
  571. width: 0
  572. };
  573. // Pass test in drawPoints
  574. point.y = point.plotY = 1;
  575. if (!point.color) {
  576. point.color = node.color;
  577. }
  578. });
  579. });
  580. left += colDistance;
  581. }, this);
  582. },
  583. // Extend the render function to also render this.nodes together with
  584. // the points.
  585. render: function () {
  586. var points = this.points;
  587. this.points = this.points.concat(this.nodes);
  588. H.seriesTypes.column.prototype.render.call(this);
  589. this.points = points;
  590. },
  591. animate: H.Series.prototype.animate,
  592. destroy: function () {
  593. // Nodes must also be destroyed (#8682, #9300)
  594. this.data = [].concat(this.points, this.nodes);
  595. H.Series.prototype.destroy.call(this);
  596. }
  597. }, {
  598. getClassName: function () {
  599. return (this.isNode ? 'highcharts-node ' : 'highcharts-link ') +
  600. Point.prototype.getClassName.call(this);
  601. },
  602. isValid: function () {
  603. return this.isNode || typeof this.weight === 'number';
  604. }
  605. });
  606. /**
  607. * A `sankey` series. If the [type](#series.sankey.type) option is not
  608. * specified, it is inherited from [chart.type](#chart.type).
  609. *
  610. * @extends series,plotOptions.sankey
  611. * @excluding animationLimit, boostThreshold, borderColor, borderRadius,
  612. * borderWidth, crisp, cropThreshold, dataParser, dataURL, depth,
  613. * edgeColor, edgeWidth, findNearestPointBy, grouping, groupPadding,
  614. * groupZPadding, maxPointWidth, negativeColor, pointInterval,
  615. * pointIntervalUnit, pointPadding, pointPlacement, pointRange,
  616. * pointStart, pointWidth, shadow, softThreshold, stacking,
  617. * threshold, zoneAxis, zones
  618. * @product highcharts
  619. * @apioption series.sankey
  620. */
  621. /**
  622. * A collection of options for the individual nodes. The nodes in a sankey
  623. * diagram are auto-generated instances of `Highcharts.Point`, but options can
  624. * be applied here and linked by the `id`.
  625. *
  626. * @sample highcharts/css/sankey/
  627. * Sankey diagram with node options
  628. *
  629. * @type {Array<*>}
  630. * @product highcharts
  631. * @apioption series.sankey.nodes
  632. */
  633. /**
  634. * The id of the auto-generated node, refering to the `from` or `to` setting of
  635. * the link.
  636. *
  637. * @type {string}
  638. * @product highcharts
  639. * @apioption series.sankey.nodes.id
  640. */
  641. /**
  642. * The color of the auto generated node.
  643. *
  644. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  645. * @product highcharts
  646. * @apioption series.sankey.nodes.color
  647. */
  648. /**
  649. * The color index of the auto generated node, especially for use in styled
  650. * mode.
  651. *
  652. * @type {number}
  653. * @product highcharts
  654. * @apioption series.sankey.nodes.colorIndex
  655. */
  656. /**
  657. * An optional column index of where to place the node. The default behaviour is
  658. * to place it next to the preceding node.
  659. *
  660. * @sample highcharts/plotoptions/sankey-node-column/
  661. * Specified node column
  662. *
  663. * @type {number}
  664. * @since 6.0.5
  665. * @product highcharts
  666. * @apioption series.sankey.nodes.column
  667. */
  668. /**
  669. * The name to display for the node in data labels and tooltips. Use this when
  670. * the name is different from the `id`. Where the id must be unique for each
  671. * node, this is not necessary for the name.
  672. *
  673. * @sample highcharts/css/sankey/
  674. * Sankey diagram with node options
  675. *
  676. * @type {string}
  677. * @product highcharts
  678. * @apioption series.sankey.nodes.name
  679. */
  680. /**
  681. * The vertical offset of a node in terms of weight. Positive values shift the
  682. * node downwards, negative shift it upwards.
  683. *
  684. * @sample highcharts/plotoptions/sankey-node-column/
  685. * Specified node offset
  686. *
  687. * @type {number}
  688. * @default 0
  689. * @since 6.0.5
  690. * @product highcharts
  691. * @apioption series.sankey.nodes.offset
  692. */
  693. /**
  694. * An array of data points for the series. For the `sankey` series type,
  695. * points can be given in the following way:
  696. *
  697. * An array of objects with named values. The following snippet shows only a
  698. * few settings, see the complete options set below. If the total number of data
  699. * points exceeds the series' [turboThreshold](#series.area.turboThreshold),
  700. * this option is not available.
  701. *
  702. * ```js
  703. * data: [{
  704. * from: 'Category1',
  705. * to: 'Category2',
  706. * weight: 2
  707. * }, {
  708. * from: 'Category1',
  709. * to: 'Category3',
  710. * weight: 5
  711. * }]
  712. * ```
  713. *
  714. * @sample {highcharts} highcharts/series/data-array-of-objects/
  715. * Config objects
  716. *
  717. * @type {Array<*>}
  718. * @extends series.line.data
  719. * @excluding drilldown, marker, x, y
  720. * @product highcharts
  721. * @apioption series.sankey.data
  722. */
  723. /**
  724. * The color for the individual _link_. By default, the link color is the same
  725. * as the node it extends from. The `series.fillOpacity` option also applies to
  726. * the points, so when setting a specific link color, consider setting the
  727. * `fillOpacity` to 1.
  728. *
  729. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  730. * @product highcharts
  731. * @apioption series.sankey.data.color
  732. */
  733. /**
  734. * The node that the link runs from.
  735. *
  736. * @type {string}
  737. * @product highcharts
  738. * @apioption series.sankey.data.from
  739. */
  740. /**
  741. * The node that the link runs to.
  742. *
  743. * @type {string}
  744. * @product highcharts
  745. * @apioption series.sankey.data.to
  746. */
  747. /**
  748. * Whether the link goes out of the system.
  749. *
  750. * @sample highcharts/plotoptions/sankey-outgoing
  751. * Sankey chart with outgoing links
  752. *
  753. * @type {boolean}
  754. * @default false
  755. * @product highcharts
  756. * @apioption series.sankey.data.outgoing
  757. */
  758. /**
  759. * The weight of the link.
  760. *
  761. * @type {number}
  762. * @product highcharts
  763. * @apioption series.sankey.data.weight
  764. */
  765. }(Highcharts));
  766. return (function () {
  767. }());
  768. }));