MapPointSeries.js 4.8 KB

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