MapPointSeries.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 MapPointPoint from './MapPointPoint.js';
  25. import palette from '../../Core/Color/Palette.js';
  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, merge = U.merge;
  30. import '../../Core/Options.js';
  31. import '../Scatter/ScatterSeries.js';
  32. /* *
  33. *
  34. * Class
  35. *
  36. * */
  37. /**
  38. * @private
  39. * @class
  40. * @name Highcharts.seriesTypes.mappoint
  41. *
  42. * @augments Highcharts.Series
  43. */
  44. var MapPointSeries = /** @class */ (function (_super) {
  45. __extends(MapPointSeries, _super);
  46. function MapPointSeries() {
  47. /* *
  48. *
  49. * Static Properties
  50. *
  51. * */
  52. var _this = _super !== null && _super.apply(this, arguments) || this;
  53. /* *
  54. *
  55. * Properties
  56. *
  57. * */
  58. _this.data = void 0;
  59. _this.options = void 0;
  60. _this.points = void 0;
  61. return _this;
  62. /* eslint-enable valid-jsdoc */
  63. }
  64. /* *
  65. *
  66. * Functions
  67. *
  68. * */
  69. /* eslint-disable valid-jsdoc */
  70. MapPointSeries.prototype.drawDataLabels = function () {
  71. _super.prototype.drawDataLabels.call(this);
  72. if (this.dataLabelsGroup) {
  73. this.dataLabelsGroup.clip(this.chart.clipRect);
  74. }
  75. };
  76. /**
  77. * A mappoint series is a special form of scatter series where the points
  78. * can be laid out in map coordinates on top of a map.
  79. *
  80. * @sample maps/demo/mapline-mappoint/
  81. * Map-line and map-point series.
  82. *
  83. * @extends plotOptions.scatter
  84. * @product highmaps
  85. * @optionparent plotOptions.mappoint
  86. */
  87. MapPointSeries.defaultOptions = merge(ScatterSeries.defaultOptions, {
  88. dataLabels: {
  89. crop: false,
  90. defer: false,
  91. enabled: true,
  92. formatter: function () {
  93. return this.point.name;
  94. },
  95. overflow: false,
  96. style: {
  97. /** @internal */
  98. color: palette.neutralColor100
  99. }
  100. }
  101. });
  102. return MapPointSeries;
  103. }(ScatterSeries));
  104. extend(MapPointSeries.prototype, {
  105. type: 'mappoint',
  106. forceDL: true,
  107. pointClass: MapPointPoint
  108. });
  109. SeriesRegistry.registerSeriesType('mappoint', MapPointSeries);
  110. /* *
  111. *
  112. * Default Export
  113. *
  114. * */
  115. export default MapPointSeries;
  116. /* *
  117. *
  118. * API Options
  119. *
  120. * */
  121. /**
  122. * A `mappoint` series. If the [type](#series.mappoint.type) option
  123. * is not specified, it is inherited from [chart.type](#chart.type).
  124. *
  125. *
  126. * @extends series,plotOptions.mappoint
  127. * @excluding dataParser, dataURL
  128. * @product highmaps
  129. * @apioption series.mappoint
  130. */
  131. /**
  132. * An array of data points for the series. For the `mappoint` series
  133. * type, points can be given in the following ways:
  134. *
  135. * 1. An array of numerical values. In this case, the numerical values will be
  136. * interpreted as `y` options. The `x` values will be automatically
  137. * calculated, either starting at 0 and incremented by 1, or from
  138. * `pointStart` and `pointInterval` given in the series options. If the axis
  139. * has categories, these will be used. Example:
  140. * ```js
  141. * data: [0, 5, 3, 5]
  142. * ```
  143. *
  144. * 2. An array of arrays with 2 values. In this case, the values correspond to
  145. * `x,y`. If the first value is a string, it is applied as the name of the
  146. * point, and the `x` value is inferred.
  147. * ```js
  148. * data: [
  149. * [0, 1],
  150. * [1, 8],
  151. * [2, 7]
  152. * ]
  153. * ```
  154. *
  155. * 3. An array of objects with named values. The following snippet shows only a
  156. * few settings, see the complete options set below. If the total number of
  157. * data points exceeds the series'
  158. * [turboThreshold](#series.mappoint.turboThreshold),
  159. * this option is not available.
  160. * ```js
  161. * data: [{
  162. * x: 1,
  163. * y: 7,
  164. * name: "Point2",
  165. * color: "#00FF00"
  166. * }, {
  167. * x: 1,
  168. * y: 4,
  169. * name: "Point1",
  170. * color: "#FF00FF"
  171. * }]
  172. * ```
  173. *
  174. * @type {Array<number|Array<number,(number|null)>|null|*>}
  175. * @extends series.map.data
  176. * @excluding labelrank, middleX, middleY, path, value
  177. * @product highmaps
  178. * @apioption series.mappoint.data
  179. */
  180. /**
  181. * The latitude of the point. Must be combined with the `lon` option
  182. * to work. Overrides `x` and `y` values.
  183. *
  184. * @sample {highmaps} maps/demo/mappoint-latlon/
  185. * Point position by lat/lon
  186. *
  187. * @type {number}
  188. * @since 1.1.0
  189. * @product highmaps
  190. * @apioption series.mappoint.data.lat
  191. */
  192. /**
  193. * The longitude of the point. Must be combined with the `lon` option
  194. * to work. Overrides `x` and `y` values.
  195. *
  196. * @sample {highmaps} maps/demo/mappoint-latlon/
  197. * Point position by lat/lon
  198. *
  199. * @type {number}
  200. * @since 1.1.0
  201. * @product highmaps
  202. * @apioption series.mappoint.data.lon
  203. */
  204. /**
  205. * The x coordinate of the point in terms of the map path coordinates.
  206. *
  207. * @sample {highmaps} maps/demo/mapline-mappoint/
  208. * Map point demo
  209. *
  210. * @type {number}
  211. * @product highmaps
  212. * @apioption series.mappoint.data.x
  213. */
  214. /**
  215. * The x coordinate of the point in terms of the map path coordinates.
  216. *
  217. * @sample {highmaps} maps/demo/mapline-mappoint/
  218. * Map point demo
  219. *
  220. * @type {number|null}
  221. * @product highmaps
  222. * @apioption series.mappoint.data.y
  223. */
  224. ''; // adds doclets above to transpiled file