OHLCPoint.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. 'use strict';
  11. var __extends = (this && this.__extends) || (function () {
  12. var extendStatics = function (d, b) {
  13. extendStatics = Object.setPrototypeOf ||
  14. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16. return extendStatics(d, b);
  17. };
  18. return function (d, b) {
  19. extendStatics(d, b);
  20. function __() { this.constructor = d; }
  21. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  22. };
  23. })();
  24. import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
  25. var ColumnSeries = SeriesRegistry.seriesTypes.column;
  26. /* *
  27. *
  28. * Class
  29. *
  30. * */
  31. var OHLCPoint = /** @class */ (function (_super) {
  32. __extends(OHLCPoint, _super);
  33. function OHLCPoint() {
  34. /* *
  35. *
  36. * Properties
  37. *
  38. * */
  39. var _this = _super !== null && _super.apply(this, arguments) || this;
  40. _this.close = void 0;
  41. _this.high = void 0;
  42. _this.low = void 0;
  43. _this.open = void 0;
  44. _this.options = void 0;
  45. _this.plotClose = void 0;
  46. _this.plotOpen = void 0;
  47. _this.series = void 0;
  48. return _this;
  49. /* eslint-enable valid-jsdoc */
  50. }
  51. /* *
  52. *
  53. * Functions
  54. *
  55. * */
  56. /* eslint-disable valid-jsdoc */
  57. /**
  58. * Extend the parent method by adding up or down to the class name.
  59. * @private
  60. * @function Highcharts.seriesTypes.ohlc#getClassName
  61. * @return {string}
  62. */
  63. OHLCPoint.prototype.getClassName = function () {
  64. return _super.prototype.getClassName.call(this) +
  65. (this.open < this.close ?
  66. ' highcharts-point-up' :
  67. ' highcharts-point-down');
  68. };
  69. /**
  70. * Save upColor as point color (#14826).
  71. * @private
  72. * @function Highcharts.seriesTypes.ohlc#resolveUpColor
  73. */
  74. OHLCPoint.prototype.resolveUpColor = function () {
  75. if (this.open < this.close &&
  76. !this.options.color &&
  77. this.series.options.upColor) {
  78. this.color = this.series.options.upColor;
  79. }
  80. };
  81. /**
  82. * Extend the parent method by saving upColor.
  83. * @private
  84. * @function Highcharts.seriesTypes.ohlc#resolveColor
  85. */
  86. OHLCPoint.prototype.resolveColor = function () {
  87. _super.prototype.resolveColor.call(this);
  88. this.resolveUpColor();
  89. };
  90. /**
  91. * Extend the parent method by saving upColor.
  92. * @private
  93. * @function Highcharts.seriesTypes.ohlc#getZone
  94. *
  95. * @return {Highcharts.SeriesZonesOptionsObject}
  96. * The zone item.
  97. */
  98. OHLCPoint.prototype.getZone = function () {
  99. var zone = _super.prototype.getZone.call(this);
  100. this.resolveUpColor();
  101. return zone;
  102. };
  103. return OHLCPoint;
  104. }(ColumnSeries.prototype.pointClass));
  105. /* *
  106. *
  107. * Default Export
  108. *
  109. * */
  110. export default OHLCPoint;