MapBubbleSeries.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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 BubbleSeries from '../Bubble/BubbleSeries.js';
  25. import MapBubblePoint from './MapBubblePoint.js';
  26. import MapSeries from '../Map/MapSeries.js';
  27. import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
  28. import U from '../../Core/Utilities.js';
  29. var extend = U.extend, merge = U.merge;
  30. import '../../Core/Options.js';
  31. import '../Bubble/BubbleSeries.js';
  32. import '../Map/MapSeries.js';
  33. /* *
  34. *
  35. * Class
  36. *
  37. * */
  38. /**
  39. * @private
  40. * @class
  41. * @name Highcharts.seriesTypes.mapbubble
  42. *
  43. * @augments Highcharts.Series
  44. */
  45. var MapBubbleSeries = /** @class */ (function (_super) {
  46. __extends(MapBubbleSeries, _super);
  47. function MapBubbleSeries() {
  48. /* *
  49. *
  50. * Static Properties
  51. *
  52. * */
  53. var _this = _super !== null && _super.apply(this, arguments) || this;
  54. /* *
  55. *
  56. * Properties
  57. *
  58. * */
  59. _this.data = void 0;
  60. _this.options = void 0;
  61. _this.points = void 0;
  62. return _this;
  63. }
  64. /**
  65. * A map bubble series is a bubble series laid out on top of a map
  66. * series, where each bubble is tied to a specific map area.
  67. *
  68. * @sample maps/demo/map-bubble/
  69. * Map bubble chart
  70. *
  71. * @extends plotOptions.bubble
  72. * @product highmaps
  73. * @optionparent plotOptions.mapbubble
  74. */
  75. MapBubbleSeries.defaultOptions = merge(BubbleSeries.defaultOptions, {
  76. /**
  77. * The main color of the series. This color affects both the fill
  78. * and the stroke of the bubble. For enhanced control, use `marker`
  79. * options.
  80. *
  81. * @sample {highmaps} maps/plotoptions/mapbubble-color/
  82. * Pink bubbles
  83. *
  84. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  85. * @apioption plotOptions.mapbubble.color
  86. */
  87. /**
  88. * Whether to display negative sized bubbles. The threshold is
  89. * given by the [zThreshold](#plotOptions.mapbubble.zThreshold)
  90. * option, and negative bubbles can be visualized by setting
  91. * [negativeColor](#plotOptions.bubble.negativeColor).
  92. *
  93. * @type {boolean}
  94. * @default true
  95. * @apioption plotOptions.mapbubble.displayNegative
  96. */
  97. /**
  98. * @sample {highmaps} maps/demo/map-bubble/
  99. * Bubble size
  100. *
  101. * @apioption plotOptions.mapbubble.maxSize
  102. */
  103. /**
  104. * @sample {highmaps} maps/demo/map-bubble/
  105. * Bubble size
  106. *
  107. * @apioption plotOptions.mapbubble.minSize
  108. */
  109. /**
  110. * When a point's Z value is below the
  111. * [zThreshold](#plotOptions.mapbubble.zThreshold) setting, this
  112. * color is used.
  113. *
  114. * @sample {highmaps} maps/plotoptions/mapbubble-negativecolor/
  115. * Negative color below a threshold
  116. *
  117. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  118. * @apioption plotOptions.mapbubble.negativeColor
  119. */
  120. /**
  121. * Whether the bubble's value should be represented by the area or
  122. * the width of the bubble. The default, `area`, corresponds best to
  123. * the human perception of the size of each bubble.
  124. *
  125. * @type {Highcharts.BubbleSizeByValue}
  126. * @default area
  127. * @apioption plotOptions.mapbubble.sizeBy
  128. */
  129. /**
  130. * When this is true, the absolute value of z determines the size
  131. * of the bubble. This means that with the default `zThreshold` of
  132. * 0, a bubble of value -1 will have the same size as a bubble of
  133. * value 1, while a bubble of value 0 will have a smaller size
  134. * according to `minSize`.
  135. *
  136. * @sample {highmaps} highcharts/plotoptions/bubble-sizebyabsolutevalue/
  137. * Size by absolute value, various thresholds
  138. *
  139. * @type {boolean}
  140. * @default false
  141. * @since 1.1.9
  142. * @apioption plotOptions.mapbubble.sizeByAbsoluteValue
  143. */
  144. /**
  145. * The minimum for the Z value range. Defaults to the highest Z
  146. * value in the data.
  147. *
  148. * @see [zMax](#plotOptions.mapbubble.zMin)
  149. *
  150. * @sample {highmaps} highcharts/plotoptions/bubble-zmin-zmax/
  151. * Z has a possible range of 0-100
  152. *
  153. * @type {number}
  154. * @since 1.0.3
  155. * @apioption plotOptions.mapbubble.zMax
  156. */
  157. /**
  158. * The minimum for the Z value range. Defaults to the lowest Z value
  159. * in the data.
  160. *
  161. * @see [zMax](#plotOptions.mapbubble.zMax)
  162. *
  163. * @sample {highmaps} highcharts/plotoptions/bubble-zmin-zmax/
  164. * Z has a possible range of 0-100
  165. *
  166. * @type {number}
  167. * @since 1.0.3
  168. * @apioption plotOptions.mapbubble.zMin
  169. */
  170. /**
  171. * When [displayNegative](#plotOptions.mapbubble.displayNegative)
  172. * is `false`, bubbles with lower Z values are skipped. When
  173. * `displayNegative` is `true` and a
  174. * [negativeColor](#plotOptions.mapbubble.negativeColor) is given,
  175. * points with lower Z is colored.
  176. *
  177. * @sample {highmaps} maps/plotoptions/mapbubble-negativecolor/
  178. * Negative color below a threshold
  179. *
  180. * @type {number}
  181. * @default 0
  182. * @apioption plotOptions.mapbubble.zThreshold
  183. */
  184. animationLimit: 500,
  185. tooltip: {
  186. pointFormat: '{point.name}: {point.z}'
  187. }
  188. });
  189. return MapBubbleSeries;
  190. }(BubbleSeries));
  191. extend(MapBubbleSeries.prototype, {
  192. type: 'mapbubble',
  193. getBox: MapSeries.prototype.getBox,
  194. // If one single value is passed, it is interpreted as z
  195. pointArrayMap: ['z'],
  196. pointClass: MapBubblePoint,
  197. setData: MapSeries.prototype.setData,
  198. setOptions: MapSeries.prototype.setOptions,
  199. xyFromShape: true
  200. });
  201. SeriesRegistry.registerSeriesType('mapbubble', MapBubbleSeries);
  202. /* *
  203. *
  204. * Default Export
  205. *
  206. * */
  207. export default MapBubbleSeries;
  208. /* *
  209. *
  210. * API Options
  211. *
  212. * */
  213. /**
  214. * A `mapbubble` series. If the [type](#series.mapbubble.type) option
  215. * is not specified, it is inherited from [chart.type](#chart.type).
  216. *
  217. * @extends series,plotOptions.mapbubble
  218. * @excluding dataParser, dataURL
  219. * @product highmaps
  220. * @apioption series.mapbubble
  221. */
  222. /**
  223. * An array of data points for the series. For the `mapbubble` series
  224. * type, points can be given in the following ways:
  225. *
  226. * 1. An array of numerical values. In this case, the numerical values
  227. * will be interpreted as `z` options. Example:
  228. *
  229. * ```js
  230. * data: [0, 5, 3, 5]
  231. * ```
  232. *
  233. * 2. An array of objects with named values. The following snippet shows only a
  234. * few settings, see the complete options set below. If the total number of
  235. * data points exceeds the series'
  236. * [turboThreshold](#series.mapbubble.turboThreshold),
  237. * this option is not available.
  238. *
  239. * ```js
  240. * data: [{
  241. * z: 9,
  242. * name: "Point2",
  243. * color: "#00FF00"
  244. * }, {
  245. * z: 10,
  246. * name: "Point1",
  247. * color: "#FF00FF"
  248. * }]
  249. * ```
  250. *
  251. * @type {Array<number|null|*>}
  252. * @extends series.mappoint.data
  253. * @excluding labelrank, middleX, middleY, path, value, x, y, lat, lon
  254. * @product highmaps
  255. * @apioption series.mapbubble.data
  256. */
  257. /**
  258. * While the `x` and `y` values of the bubble are determined by the
  259. * underlying map, the `z` indicates the actual value that gives the
  260. * size of the bubble.
  261. *
  262. * @sample {highmaps} maps/demo/map-bubble/
  263. * Bubble
  264. *
  265. * @type {number|null}
  266. * @product highmaps
  267. * @apioption series.mapbubble.data.z
  268. */
  269. /**
  270. * @excluding enabled, enabledThreshold, height, radius, width
  271. * @apioption series.mapbubble.marker
  272. */
  273. ''; // adds doclets above to transpiled file