MapLineSeries.js 3.4 KB

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