MapLineSeries.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 MapSeries from '../Map/MapSeries.js';
  25. import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
  26. var Series = SeriesRegistry.series;
  27. import U from '../../Core/Utilities.js';
  28. var extend = U.extend, merge = U.merge;
  29. /* *
  30. *
  31. * Class
  32. *
  33. * */
  34. /**
  35. * @private
  36. * @class
  37. * @name Highcharts.seriesTypes.mapline
  38. *
  39. * @augments Highcharts.Series
  40. */
  41. var MapLineSeries = /** @class */ (function (_super) {
  42. __extends(MapLineSeries, _super);
  43. function MapLineSeries() {
  44. /* *
  45. *
  46. * Static Properties
  47. *
  48. * */
  49. var _this = _super !== null && _super.apply(this, arguments) || this;
  50. /* *
  51. *
  52. * Properties
  53. *
  54. * */
  55. _this.data = void 0;
  56. _this.options = void 0;
  57. _this.points = void 0;
  58. return _this;
  59. /* eslint-enable valid-jsdoc */
  60. }
  61. /* *
  62. *
  63. * Functions
  64. *
  65. * */
  66. /* eslint-disable valid-jsdoc */
  67. /**
  68. * Get presentational attributes
  69. *
  70. * @private
  71. * @function Highcharts.seriesTypes.mapline#pointAttribs
  72. * @param {Highcharts.Point} point
  73. * @param {string} state
  74. * @return {Highcharts.SVGAttributes}
  75. */
  76. MapLineSeries.prototype.pointAttribs = function (point, state) {
  77. var attr = MapSeries.prototype.pointAttribs.call(this, point, state);
  78. // The difference from a map series is that the stroke takes the
  79. // point color
  80. attr.fill = this.options.fillColor;
  81. return attr;
  82. };
  83. /**
  84. * A mapline series is a special case of the map series where the value
  85. * colors are applied to the strokes rather than the fills. It can also be
  86. * used for freeform drawing, like dividers, in the map.
  87. *
  88. * @sample maps/demo/mapline-mappoint/
  89. * Mapline and map-point chart
  90. *
  91. * @extends plotOptions.map
  92. * @product highmaps
  93. * @optionparent plotOptions.mapline
  94. */
  95. MapLineSeries.defaultOptions = merge(MapSeries.defaultOptions, {
  96. /**
  97. * The width of the map line.
  98. */
  99. lineWidth: 1,
  100. /**
  101. * Fill color for the map line shapes
  102. *
  103. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  104. */
  105. fillColor: 'none'
  106. });
  107. return MapLineSeries;
  108. }(MapSeries));
  109. extend(MapLineSeries.prototype, {
  110. type: 'mapline',
  111. colorProp: 'stroke',
  112. drawLegendSymbol: Series.prototype.drawLegendSymbol,
  113. pointAttrToOptions: {
  114. 'stroke': 'color',
  115. 'stroke-width': 'lineWidth'
  116. }
  117. });
  118. SeriesRegistry.registerSeriesType('mapline', MapLineSeries);
  119. /* *
  120. *
  121. * Default Export
  122. *
  123. * */
  124. export default MapLineSeries;
  125. /* *
  126. *
  127. * API Options
  128. *
  129. * */
  130. /**
  131. * A `mapline` series. If the [type](#series.mapline.type) option is
  132. * not specified, it is inherited from [chart.type](#chart.type).
  133. *
  134. * @extends series,plotOptions.mapline
  135. * @excluding dataParser, dataURL, marker
  136. * @product highmaps
  137. * @apioption series.mapline
  138. */
  139. /**
  140. * An array of data points for the series. For the `mapline` series type,
  141. * points can be given in the following ways:
  142. *
  143. * 1. An array of numerical values. In this case, the numerical values
  144. * will be interpreted as `value` options. Example:
  145. *
  146. * ```js
  147. * data: [0, 5, 3, 5]
  148. * ```
  149. *
  150. * 2. An array of arrays with 2 values. In this case, the values correspond
  151. * to `[hc-key, value]`. Example:
  152. *
  153. * ```js
  154. * data: [
  155. * ['us-ny', 0],
  156. * ['us-mi', 5],
  157. * ['us-tx', 3],
  158. * ['us-ak', 5]
  159. * ]
  160. * ```
  161. *
  162. * 3. An array of objects with named values. The following snippet shows only a
  163. * few settings, see the complete options set below. If the total number of data
  164. * points exceeds the series' [turboThreshold](#series.map.turboThreshold),
  165. * this option is not available.
  166. *
  167. * ```js
  168. * data: [{
  169. * value: 6,
  170. * name: "Point2",
  171. * color: "#00FF00"
  172. * }, {
  173. * value: 6,
  174. * name: "Point1",
  175. * color: "#FF00FF"
  176. * }]
  177. * ```
  178. *
  179. * @type {Array<number|Array<string,(number|null)>|null|*>}
  180. * @product highmaps
  181. * @apioption series.mapline.data
  182. */
  183. ''; // adds doclets above to transpiled file