MapPoint.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 ColorMapMixin from '../../Mixins/ColorMapSeries.js';
  25. var colorMapPointMixin = ColorMapMixin.colorMapPointMixin;
  26. import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
  27. var ScatterSeries = SeriesRegistry.seriesTypes.scatter;
  28. import U from '../../Core/Utilities.js';
  29. var extend = U.extend;
  30. /* *
  31. *
  32. * Class
  33. *
  34. * */
  35. var MapPoint = /** @class */ (function (_super) {
  36. __extends(MapPoint, _super);
  37. function MapPoint() {
  38. /* *
  39. *
  40. * Properties
  41. *
  42. * */
  43. var _this = _super !== null && _super.apply(this, arguments) || this;
  44. _this.options = void 0;
  45. _this.path = void 0;
  46. _this.series = void 0;
  47. return _this;
  48. /* eslint-enable valid-jsdoc */
  49. }
  50. /* *
  51. *
  52. * Functions
  53. *
  54. * */
  55. /* eslint-disable valid-jsdoc */
  56. /**
  57. * Extend the Point object to split paths.
  58. * @private
  59. */
  60. MapPoint.prototype.applyOptions = function (options, x) {
  61. var series = this.series, point = _super.prototype.applyOptions.call(this, options, x), joinBy = series.joinBy, mapPoint;
  62. if (series.mapData && series.mapMap) {
  63. var joinKey = joinBy[1];
  64. var mapKey = _super.prototype.getNestedProperty.call(point, joinKey);
  65. mapPoint = typeof mapKey !== 'undefined' &&
  66. series.mapMap[mapKey];
  67. if (mapPoint) {
  68. // This applies only to bubbles
  69. if (series.xyFromShape) {
  70. point.x = mapPoint._midX;
  71. point.y = mapPoint._midY;
  72. }
  73. extend(point, mapPoint); // copy over properties
  74. }
  75. else {
  76. point.value = point.value || null;
  77. }
  78. }
  79. return point;
  80. };
  81. /**
  82. * Stop the fade-out
  83. * @private
  84. */
  85. MapPoint.prototype.onMouseOver = function (e) {
  86. U.clearTimeout(this.colorInterval);
  87. if (this.value !== null || this.series.options.nullInteraction) {
  88. _super.prototype.onMouseOver.call(this, e);
  89. }
  90. else {
  91. // #3401 Tooltip doesn't hide when hovering over null points
  92. this.series.onMouseOut(e);
  93. }
  94. };
  95. /**
  96. * Highmaps only. Zoom in on the point using the global animation.
  97. *
  98. * @sample maps/members/point-zoomto/
  99. * Zoom to points from butons
  100. *
  101. * @requires modules/map
  102. *
  103. * @function Highcharts.Point#zoomTo
  104. */
  105. MapPoint.prototype.zoomTo = function () {
  106. var point = this, series = point.series;
  107. series.xAxis.setExtremes(point._minX, point._maxX, false);
  108. series.yAxis.setExtremes(point._minY, point._maxY, false);
  109. series.chart.redraw();
  110. };
  111. return MapPoint;
  112. }(ScatterSeries.prototype.pointClass));
  113. extend(MapPoint.prototype, {
  114. dataLabelOnNull: colorMapPointMixin.dataLabelOnNull,
  115. isValid: colorMapPointMixin.isValid,
  116. setState: colorMapPointMixin.setState
  117. });
  118. /* *
  119. *
  120. * Default Export
  121. *
  122. * */
  123. export default MapPoint;