MapLineSeries.js 3.4 KB

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