AreaRangePoint.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* *
  2. *
  3. * (c) 2010-2021 Torstein Honsi
  4. *
  5. * License: www.highcharts.com/license
  6. *
  7. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  8. *
  9. * */
  10. var __extends = (this && this.__extends) || (function () {
  11. var extendStatics = function (d, b) {
  12. extendStatics = Object.setPrototypeOf ||
  13. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15. return extendStatics(d, b);
  16. };
  17. return function (d, b) {
  18. extendStatics(d, b);
  19. function __() { this.constructor = d; }
  20. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21. };
  22. })();
  23. import AreaSeries from '../Area/AreaSeries.js';
  24. import Point from '../../Core/Series/Point.js';
  25. var pointProto = Point.prototype;
  26. import U from '../../Core/Utilities.js';
  27. var defined = U.defined, isNumber = U.isNumber;
  28. /* *
  29. *
  30. * Class
  31. *
  32. * */
  33. var AreaRangePoint = /** @class */ (function (_super) {
  34. __extends(AreaRangePoint, _super);
  35. function AreaRangePoint() {
  36. /* *
  37. *
  38. * Properties
  39. *
  40. * */
  41. var _this = _super !== null && _super.apply(this, arguments) || this;
  42. _this.high = void 0;
  43. _this.low = void 0;
  44. _this.options = void 0;
  45. _this.plotHigh = void 0;
  46. _this.plotLow = void 0;
  47. _this.plotHighX = void 0;
  48. _this.plotLowX = void 0;
  49. _this.plotX = void 0;
  50. _this.series = void 0;
  51. return _this;
  52. }
  53. /* *
  54. *
  55. * Functions
  56. *
  57. * */
  58. /**
  59. * @private
  60. */
  61. AreaRangePoint.prototype.setState = function () {
  62. var prevState = this.state, series = this.series, isPolar = series.chart.polar;
  63. if (!defined(this.plotHigh)) {
  64. // Boost doesn't calculate plotHigh
  65. this.plotHigh = series.yAxis.toPixels(this.high, true);
  66. }
  67. if (!defined(this.plotLow)) {
  68. // Boost doesn't calculate plotLow
  69. this.plotLow = this.plotY = series.yAxis.toPixels(this.low, true);
  70. }
  71. if (series.stateMarkerGraphic) {
  72. series.lowerStateMarkerGraphic = series.stateMarkerGraphic;
  73. series.stateMarkerGraphic = series.upperStateMarkerGraphic;
  74. }
  75. // Change state also for the top marker
  76. this.graphic = this.upperGraphic;
  77. this.plotY = this.plotHigh;
  78. if (isPolar) {
  79. this.plotX = this.plotHighX;
  80. }
  81. // Top state:
  82. pointProto.setState.apply(this, arguments);
  83. this.state = prevState;
  84. // Now restore defaults
  85. this.plotY = this.plotLow;
  86. this.graphic = this.lowerGraphic;
  87. if (isPolar) {
  88. this.plotX = this.plotLowX;
  89. }
  90. if (series.stateMarkerGraphic) {
  91. series.upperStateMarkerGraphic = series.stateMarkerGraphic;
  92. series.stateMarkerGraphic = series.lowerStateMarkerGraphic;
  93. // Lower marker is stored at stateMarkerGraphic
  94. // to avoid reference duplication (#7021)
  95. series.lowerStateMarkerGraphic = void 0;
  96. }
  97. pointProto.setState.apply(this, arguments);
  98. };
  99. AreaRangePoint.prototype.haloPath = function () {
  100. var isPolar = this.series.chart.polar, path = [];
  101. // Bottom halo
  102. this.plotY = this.plotLow;
  103. if (isPolar) {
  104. this.plotX = this.plotLowX;
  105. }
  106. if (this.isInside) {
  107. path = pointProto.haloPath.apply(this, arguments);
  108. }
  109. // Top halo
  110. this.plotY = this.plotHigh;
  111. if (isPolar) {
  112. this.plotX = this.plotHighX;
  113. }
  114. if (this.isTopInside) {
  115. path = path.concat(pointProto.haloPath.apply(this, arguments));
  116. }
  117. return path;
  118. };
  119. AreaRangePoint.prototype.isValid = function () {
  120. return isNumber(this.low) && isNumber(this.high);
  121. };
  122. return AreaRangePoint;
  123. }(AreaSeries.prototype.pointClass));
  124. /* *
  125. *
  126. * Default export
  127. *
  128. * */
  129. export default AreaRangePoint;