MapLineSeries.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 '../Core/Options.js';
  12. import './MapSeries.js';
  13. var seriesTypes = BaseSeries.seriesTypes;
  14. /**
  15. * @private
  16. * @class
  17. * @name Highcharts.seriesTypes.mapline
  18. *
  19. * @augments Highcharts.Series
  20. */
  21. BaseSeries.seriesType('mapline', 'map',
  22. /**
  23. * A mapline series is a special case of the map series where the value
  24. * colors are applied to the strokes rather than the fills. It can also be
  25. * used for freeform drawing, like dividers, in the map.
  26. *
  27. * @sample maps/demo/mapline-mappoint/
  28. * Mapline and map-point chart
  29. *
  30. * @extends plotOptions.map
  31. * @product highmaps
  32. * @optionparent plotOptions.mapline
  33. */
  34. {
  35. /**
  36. * The width of the map line.
  37. */
  38. lineWidth: 1,
  39. /**
  40. * Fill color for the map line shapes
  41. *
  42. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  43. */
  44. fillColor: 'none'
  45. }, {
  46. type: 'mapline',
  47. colorProp: 'stroke',
  48. pointAttrToOptions: {
  49. 'stroke': 'color',
  50. 'stroke-width': 'lineWidth'
  51. },
  52. /* eslint-disable valid-jsdoc */
  53. /**
  54. * Get presentational attributes
  55. *
  56. * @private
  57. * @function Highcharts.seriesTypes.mapline#pointAttribs
  58. * @param {Highcharts.Point} point
  59. * @param {string} state
  60. * @return {Highcharts.SVGAttributes}
  61. */
  62. pointAttribs: function (point, state) {
  63. var attr = seriesTypes.map.prototype.pointAttribs.call(this, point, state);
  64. // The difference from a map series is that the stroke takes the
  65. // point color
  66. attr.fill = this.options.fillColor;
  67. return attr;
  68. },
  69. drawLegendSymbol: seriesTypes.line.prototype.drawLegendSymbol
  70. /* eslint-enable valid-jsdoc */
  71. });
  72. /**
  73. * A `mapline` series. If the [type](#series.mapline.type) option is
  74. * not specified, it is inherited from [chart.type](#chart.type).
  75. *
  76. * @extends series,plotOptions.mapline
  77. * @excluding dataParser, dataURL, marker
  78. * @product highmaps
  79. * @apioption series.mapline
  80. */
  81. /**
  82. * An array of data points for the series. For the `mapline` series type,
  83. * points can be given in the following ways:
  84. *
  85. * 1. An array of numerical values. In this case, the numerical values
  86. * will be interpreted as `value` options. Example:
  87. *
  88. * ```js
  89. * data: [0, 5, 3, 5]
  90. * ```
  91. *
  92. * 2. An array of arrays with 2 values. In this case, the values correspond
  93. * to `[hc-key, value]`. Example:
  94. *
  95. * ```js
  96. * data: [
  97. * ['us-ny', 0],
  98. * ['us-mi', 5],
  99. * ['us-tx', 3],
  100. * ['us-ak', 5]
  101. * ]
  102. * ```
  103. *
  104. * 3. An array of objects with named values. The following snippet shows only a
  105. * few settings, see the complete options set below. If the total number of data
  106. * points exceeds the series' [turboThreshold](#series.map.turboThreshold),
  107. * this option is not available.
  108. *
  109. * ```js
  110. * data: [{
  111. * value: 6,
  112. * name: "Point2",
  113. * color: "#00FF00"
  114. * }, {
  115. * value: 6,
  116. * name: "Point1",
  117. * color: "#FF00FF"
  118. * }]
  119. * ```
  120. *
  121. * @type {Array<number|Array<string,(number|null)>|null|*>}
  122. * @product highmaps
  123. * @apioption series.mapline.data
  124. */
  125. ''; // adds doclets above to transpiled file