MapPointSeries.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /* *
  2. *
  3. * (c) 2010-2020 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. import H from '../Core/Globals.js';
  12. import '../Core/Utilities.js';
  13. import '../Core/Options.js';
  14. import '../Core/Series/Point.js';
  15. import '../Series/ScatterSeries.js';
  16. var merge = H.merge, Point = H.Point, Series = H.Series, seriesType = H.seriesType;
  17. /**
  18. * @private
  19. * @class
  20. * @name Highcharts.seriesTypes.mappoint
  21. *
  22. * @augments Highcharts.Series
  23. */
  24. seriesType('mappoint', 'scatter',
  25. /**
  26. * A mappoint series is a special form of scatter series where the points
  27. * can be laid out in map coordinates on top of a map.
  28. *
  29. * @sample maps/demo/mapline-mappoint/
  30. * Map-line and map-point series.
  31. *
  32. * @extends plotOptions.scatter
  33. * @product highmaps
  34. * @optionparent plotOptions.mappoint
  35. */
  36. {
  37. dataLabels: {
  38. crop: false,
  39. defer: false,
  40. enabled: true,
  41. formatter: function () {
  42. return this.point.name;
  43. },
  44. overflow: false,
  45. style: {
  46. /** @internal */
  47. color: '#000000'
  48. }
  49. }
  50. // Prototype members
  51. }, {
  52. type: 'mappoint',
  53. forceDL: true,
  54. drawDataLabels: function () {
  55. Series.prototype.drawDataLabels.call(this);
  56. if (this.dataLabelsGroup) {
  57. this.dataLabelsGroup.clip(this.chart.clipRect);
  58. }
  59. }
  60. // Point class
  61. }, {
  62. applyOptions: function (options, x) {
  63. var mergedOptions = (typeof options.lat !== 'undefined' &&
  64. typeof options.lon !== 'undefined' ?
  65. merge(options, this.series.chart.fromLatLonToPoint(options)) :
  66. options);
  67. return Point.prototype
  68. .applyOptions.call(this, mergedOptions, x);
  69. }
  70. });
  71. /**
  72. * A `mappoint` series. If the [type](#series.mappoint.type) option
  73. * is not specified, it is inherited from [chart.type](#chart.type).
  74. *
  75. *
  76. * @extends series,plotOptions.mappoint
  77. * @excluding dataParser, dataURL
  78. * @product highmaps
  79. * @apioption series.mappoint
  80. */
  81. /**
  82. * An array of data points for the series. For the `mappoint` series
  83. * type, points can be given in the following ways:
  84. *
  85. * 1. An array of numerical values. In this case, the numerical values will be
  86. * interpreted as `y` options. The `x` values will be automatically
  87. * calculated, either starting at 0 and incremented by 1, or from
  88. * `pointStart` and `pointInterval` given in the series options. If the axis
  89. * has categories, these will be used. Example:
  90. * ```js
  91. * data: [0, 5, 3, 5]
  92. * ```
  93. *
  94. * 2. An array of arrays with 2 values. In this case, the values correspond to
  95. * `x,y`. If the first value is a string, it is applied as the name of the
  96. * point, and the `x` value is inferred.
  97. * ```js
  98. * data: [
  99. * [0, 1],
  100. * [1, 8],
  101. * [2, 7]
  102. * ]
  103. * ```
  104. *
  105. * 3. An array of objects with named values. The following snippet shows only a
  106. * few settings, see the complete options set below. If the total number of
  107. * data points exceeds the series'
  108. * [turboThreshold](#series.mappoint.turboThreshold),
  109. * this option is not available.
  110. * ```js
  111. * data: [{
  112. * x: 1,
  113. * y: 7,
  114. * name: "Point2",
  115. * color: "#00FF00"
  116. * }, {
  117. * x: 1,
  118. * y: 4,
  119. * name: "Point1",
  120. * color: "#FF00FF"
  121. * }]
  122. * ```
  123. *
  124. * @type {Array<number|Array<number,(number|null)>|null|*>}
  125. * @extends series.map.data
  126. * @excluding labelrank, middleX, middleY, path, value
  127. * @product highmaps
  128. * @apioption series.mappoint.data
  129. */
  130. /**
  131. * The latitude of the point. Must be combined with the `lon` option
  132. * to work. Overrides `x` and `y` values.
  133. *
  134. * @sample {highmaps} maps/demo/mappoint-latlon/
  135. * Point position by lat/lon
  136. *
  137. * @type {number}
  138. * @since 1.1.0
  139. * @product highmaps
  140. * @apioption series.mappoint.data.lat
  141. */
  142. /**
  143. * The longitude of the point. Must be combined with the `lon` option
  144. * to work. Overrides `x` and `y` values.
  145. *
  146. * @sample {highmaps} maps/demo/mappoint-latlon/
  147. * Point position by lat/lon
  148. *
  149. * @type {number}
  150. * @since 1.1.0
  151. * @product highmaps
  152. * @apioption series.mappoint.data.lon
  153. */
  154. /**
  155. * The x coordinate of the point in terms of the map path coordinates.
  156. *
  157. * @sample {highmaps} maps/demo/mapline-mappoint/
  158. * Map point demo
  159. *
  160. * @type {number}
  161. * @product highmaps
  162. * @apioption series.mappoint.data.x
  163. */
  164. /**
  165. * The x coordinate of the point in terms of the map path coordinates.
  166. *
  167. * @sample {highmaps} maps/demo/mapline-mappoint/
  168. * Map point demo
  169. *
  170. * @type {number|null}
  171. * @product highmaps
  172. * @apioption series.mappoint.data.y
  173. */
  174. ''; // adds doclets above to transpiled file