DumbbellPoint.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* *
  2. *
  3. * (c) 2010-2021 Sebastian Bochan, Rafal Sebestjanski
  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 AreaRangePoint from '../AreaRange/AreaRangePoint.js';
  25. import U from '../../Core/Utilities.js';
  26. var extend = U.extend, pick = U.pick;
  27. /* *
  28. *
  29. * Class
  30. *
  31. * */
  32. var DumbbellPoint = /** @class */ (function (_super) {
  33. __extends(DumbbellPoint, _super);
  34. function DumbbellPoint() {
  35. /* *
  36. *
  37. * Properties
  38. *
  39. * */
  40. var _this = _super !== null && _super.apply(this, arguments) || this;
  41. _this.series = void 0;
  42. _this.options = void 0;
  43. _this.connector = void 0;
  44. _this.pointWidth = void 0;
  45. return _this;
  46. }
  47. /* *
  48. *
  49. * Functions
  50. *
  51. * */
  52. /**
  53. * Set the point's state extended by have influence on the connector
  54. * (between low and high value).
  55. *
  56. * @private
  57. * @param {Highcharts.Point} this The point to inspect.
  58. *
  59. * @return {void}
  60. */
  61. DumbbellPoint.prototype.setState = function () {
  62. var point = this, series = point.series, chart = series.chart, seriesLowColor = series.options.lowColor, seriesMarker = series.options.marker, pointOptions = point.options, pointLowColor = pointOptions.lowColor, zoneColor = point.zone && point.zone.color, lowerGraphicColor = pick(pointLowColor, seriesLowColor, pointOptions.color, zoneColor, point.color, series.color), verb = 'attr', upperGraphicColor, origProps;
  63. this.pointSetState.apply(this, arguments);
  64. if (!point.state) {
  65. verb = 'animate';
  66. if (point.lowerGraphic && !chart.styledMode) {
  67. point.lowerGraphic.attr({
  68. fill: lowerGraphicColor
  69. });
  70. if (point.upperGraphic) {
  71. origProps = {
  72. y: point.y,
  73. zone: point.zone
  74. };
  75. point.y = point.high;
  76. point.zone = point.zone ? point.getZone() : void 0;
  77. upperGraphicColor = pick(point.marker ? point.marker.fillColor : void 0, seriesMarker ? seriesMarker.fillColor : void 0, pointOptions.color, point.zone ? point.zone.color : void 0, point.color);
  78. point.upperGraphic.attr({
  79. fill: upperGraphicColor
  80. });
  81. extend(point, origProps);
  82. }
  83. }
  84. }
  85. point.connector[verb](series.getConnectorAttribs(point));
  86. };
  87. return DumbbellPoint;
  88. }(AreaRangePoint));
  89. extend(DumbbellPoint.prototype, {
  90. pointSetState: AreaRangePoint.prototype.setState
  91. });
  92. /* *
  93. *
  94. * Default export
  95. *
  96. * */
  97. export default DumbbellPoint;