SankeyPoint.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* *
  2. *
  3. * Sankey diagram module
  4. *
  5. * (c) 2010-2021 Torstein Honsi
  6. *
  7. * License: www.highcharts.com/license
  8. *
  9. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  10. *
  11. * */
  12. 'use strict';
  13. var __extends = (this && this.__extends) || (function () {
  14. var extendStatics = function (d, b) {
  15. extendStatics = Object.setPrototypeOf ||
  16. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18. return extendStatics(d, b);
  19. };
  20. return function (d, b) {
  21. extendStatics(d, b);
  22. function __() { this.constructor = d; }
  23. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  24. };
  25. })();
  26. import NodesMixin from '../../Mixins/Nodes.js';
  27. import Point from '../../Core/Series/Point.js';
  28. import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
  29. var ColumnSeries = SeriesRegistry.seriesTypes.column;
  30. import U from '../../Core/Utilities.js';
  31. var defined = U.defined, extend = U.extend;
  32. /* *
  33. *
  34. * Class
  35. *
  36. * */
  37. var SankeyPoint = /** @class */ (function (_super) {
  38. __extends(SankeyPoint, _super);
  39. function SankeyPoint() {
  40. /* *
  41. *
  42. * Properties
  43. *
  44. * */
  45. var _this = _super !== null && _super.apply(this, arguments) || this;
  46. _this.className = void 0;
  47. _this.fromNode = void 0;
  48. _this.level = void 0;
  49. _this.linkBase = void 0;
  50. _this.linksFrom = void 0;
  51. _this.linksTo = void 0;
  52. _this.mass = void 0;
  53. _this.nodeX = void 0;
  54. _this.nodeY = void 0;
  55. _this.options = void 0;
  56. _this.series = void 0;
  57. _this.toNode = void 0;
  58. return _this;
  59. /* eslint-enable valid-jsdoc */
  60. }
  61. /* *
  62. *
  63. * Functions
  64. *
  65. * */
  66. /* eslint-disable valid-jsdoc */
  67. /**
  68. * @private
  69. */
  70. SankeyPoint.prototype.applyOptions = function (options, x) {
  71. Point.prototype.applyOptions.call(this, options, x);
  72. // Treat point.level as a synonym of point.column
  73. if (defined(this.options.level)) {
  74. this.options.column = this.column = this.options.level;
  75. }
  76. return this;
  77. };
  78. /**
  79. * @private
  80. */
  81. SankeyPoint.prototype.getClassName = function () {
  82. return (this.isNode ? 'highcharts-node ' : 'highcharts-link ') +
  83. Point.prototype.getClassName.call(this);
  84. };
  85. /**
  86. * @private
  87. */
  88. SankeyPoint.prototype.isValid = function () {
  89. return this.isNode || typeof this.weight === 'number';
  90. };
  91. return SankeyPoint;
  92. }(ColumnSeries.prototype.pointClass));
  93. extend(SankeyPoint.prototype, {
  94. setState: NodesMixin.setNodeState
  95. });
  96. /* *
  97. *
  98. * Default Export
  99. *
  100. * */
  101. export default SankeyPoint;