lollipop.src.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. /**
  2. * @license Highcharts JS v9.1.1 (2021-06-04)
  3. *
  4. * (c) 2009-2021 Sebastian Bochan, Rafal Sebestjanski
  5. *
  6. * License: www.highcharts.com/license
  7. */
  8. 'use strict';
  9. (function (factory) {
  10. if (typeof module === 'object' && module.exports) {
  11. factory['default'] = factory;
  12. module.exports = factory;
  13. } else if (typeof define === 'function' && define.amd) {
  14. define('highcharts/modules/lollipop', ['highcharts'], function (Highcharts) {
  15. factory(Highcharts);
  16. factory.Highcharts = Highcharts;
  17. return factory;
  18. });
  19. } else {
  20. factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
  21. }
  22. }(function (Highcharts) {
  23. var _modules = Highcharts ? Highcharts._modules : {};
  24. function _registerModule(obj, path, args, fn) {
  25. if (!obj.hasOwnProperty(path)) {
  26. obj[path] = fn.apply(null, args);
  27. }
  28. }
  29. _registerModule(_modules, 'Series/Lollipop/LollipopPoint.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) {
  30. /* *
  31. *
  32. * (c) 2010-2021 Torstein Honsi
  33. *
  34. * License: www.highcharts.com/license
  35. *
  36. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  37. *
  38. * */
  39. var __extends = (this && this.__extends) || (function () {
  40. var extendStatics = function (d,
  41. b) {
  42. extendStatics = Object.setPrototypeOf ||
  43. ({ __proto__: [] } instanceof Array && function (d,
  44. b) { d.__proto__ = b; }) ||
  45. function (d,
  46. b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  47. return extendStatics(d, b);
  48. };
  49. return function (d, b) {
  50. extendStatics(d, b);
  51. function __() { this.constructor = d; }
  52. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  53. };
  54. })();
  55. var Point = SeriesRegistry.series.prototype.pointClass,
  56. _a = SeriesRegistry.seriesTypes,
  57. areaProto = _a.area.prototype,
  58. DumbbellPoint = _a.dumbbell.prototype.pointClass;
  59. var isObject = U.isObject,
  60. extend = U.extend;
  61. /* *
  62. *
  63. * Class
  64. *
  65. * */
  66. var LollipopPoint = /** @class */ (function (_super) {
  67. __extends(LollipopPoint, _super);
  68. function LollipopPoint() {
  69. var _this = _super !== null && _super.apply(this,
  70. arguments) || this;
  71. _this.series = void 0;
  72. _this.options = void 0;
  73. return _this;
  74. }
  75. return LollipopPoint;
  76. }(DumbbellPoint));
  77. extend(LollipopPoint.prototype, {
  78. pointSetState: areaProto.pointClass.prototype.setState,
  79. // Does not work with the inherited `isvalid`
  80. isValid: Point.prototype.isValid,
  81. init: function (series, options, x) {
  82. if (isObject(options) && 'low' in options) {
  83. options.y = options.low;
  84. delete options.low;
  85. }
  86. return Point.prototype.init.apply(this, arguments);
  87. }
  88. });
  89. /* *
  90. *
  91. * Default export
  92. *
  93. * */
  94. return LollipopPoint;
  95. });
  96. _registerModule(_modules, 'Series/Lollipop/LollipopSeries.js', [_modules['Series/Lollipop/LollipopPoint.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (LollipopPoint, SeriesRegistry, U) {
  97. /* *
  98. *
  99. * (c) 2010-2021 Sebastian Bochan, Rafal Sebestjanski
  100. *
  101. * License: www.highcharts.com/license
  102. *
  103. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  104. *
  105. * */
  106. var __extends = (this && this.__extends) || (function () {
  107. var extendStatics = function (d,
  108. b) {
  109. extendStatics = Object.setPrototypeOf ||
  110. ({ __proto__: [] } instanceof Array && function (d,
  111. b) { d.__proto__ = b; }) ||
  112. function (d,
  113. b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  114. return extendStatics(d, b);
  115. };
  116. return function (d, b) {
  117. extendStatics(d, b);
  118. function __() { this.constructor = d; }
  119. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  120. };
  121. })();
  122. var _a = SeriesRegistry.seriesTypes,
  123. areaProto = _a.area.prototype,
  124. colProto = _a.column.prototype,
  125. DumbbellSeries = _a.dumbbell;
  126. var pick = U.pick,
  127. merge = U.merge,
  128. extend = U.extend;
  129. /* *
  130. *
  131. * Class
  132. *
  133. * */
  134. /**
  135. * lollipop series type
  136. *
  137. * @private
  138. * @class
  139. * @name Highcharts.seriesTypes.lollipop
  140. *
  141. * @augments Highcharts.Series
  142. *
  143. */
  144. var LollipopSeries = /** @class */ (function (_super) {
  145. __extends(LollipopSeries, _super);
  146. function LollipopSeries() {
  147. /* *
  148. *
  149. * Static properties
  150. *
  151. * */
  152. var _this = _super !== null && _super.apply(this,
  153. arguments) || this;
  154. /* *
  155. *
  156. * Properties
  157. *
  158. * */
  159. _this.data = void 0;
  160. _this.options = void 0;
  161. _this.points = void 0;
  162. return _this;
  163. }
  164. LollipopSeries.prototype.toYData = function (point) {
  165. return [pick(point.y, point.low)];
  166. };
  167. /**
  168. * The lollipop series is a carteseian series with a line anchored from
  169. * the x axis and a dot at the end to mark the value.
  170. * Requires `highcharts-more.js`, `modules/dumbbell.js` and
  171. * `modules/lollipop.js`.
  172. *
  173. * @sample {highcharts} highcharts/demo/lollipop/
  174. * Lollipop chart
  175. * @sample {highcharts} highcharts/series-dumbbell/styled-mode-dumbbell/
  176. * Styled mode
  177. *
  178. * @extends plotOptions.dumbbell
  179. * @product highcharts highstock
  180. * @excluding fillColor, fillOpacity, lineWidth, stack, stacking,
  181. * lowColor, stickyTracking, trackByArea
  182. * @since 8.0.0
  183. * @optionparent plotOptions.lollipop
  184. */
  185. LollipopSeries.defaultOptions = merge(DumbbellSeries.defaultOptions, {
  186. /** @ignore-option */
  187. lowColor: void 0,
  188. /** @ignore-option */
  189. threshold: 0,
  190. /** @ignore-option */
  191. connectorWidth: 1,
  192. /** @ignore-option */
  193. groupPadding: 0.2,
  194. /** @ignore-option */
  195. pointPadding: 0.1,
  196. /** @ignore-option */
  197. states: {
  198. hover: {
  199. /** @ignore-option */
  200. lineWidthPlus: 0,
  201. /** @ignore-option */
  202. connectorWidthPlus: 1,
  203. /** @ignore-option */
  204. halo: false
  205. }
  206. },
  207. tooltip: {
  208. pointFormat: '<span style="color:{series.color}">●</span> {series.name}: <b>{point.y}</b><br/>'
  209. }
  210. });
  211. return LollipopSeries;
  212. }(DumbbellSeries));
  213. extend(LollipopSeries.prototype, {
  214. pointArrayMap: ['y'],
  215. pointValKey: 'y',
  216. translatePoint: areaProto.translate,
  217. drawPoint: areaProto.drawPoints,
  218. drawDataLabels: colProto.drawDataLabels,
  219. setShapeArgs: colProto.translate,
  220. pointClass: LollipopPoint
  221. });
  222. SeriesRegistry.registerSeriesType('lollipop', LollipopSeries);
  223. /* *
  224. *
  225. * Default export
  226. *
  227. * */
  228. /**
  229. * The `lollipop` series. If the [type](#series.lollipop.type) option is
  230. * not specified, it is inherited from [chart.type](#chart.type).
  231. *
  232. * @extends series,plotOptions.lollipop,
  233. * @excluding boostThreshold, boostBlending
  234. * @product highcharts highstock
  235. * @requires highcharts-more
  236. * @requires modules/dumbbell
  237. * @requires modules/lollipop
  238. * @apioption series.lollipop
  239. */
  240. /**
  241. * An array of data points for the series. For the `lollipop` series type,
  242. * points can be given in the following ways:
  243. *
  244. * 1. An array of numerical values. In this case, the numerical values will be
  245. * interpreted as `y` options. The `x` values will be automatically
  246. * calculated, either starting at 0 and incremented by 1, or from
  247. * `pointStart` and `pointInterval` given in the series options. If the axis
  248. * has categories, these will be used. Example:
  249. * ```js
  250. * data: [0, 5, 3, 5]
  251. * ```
  252. *
  253. * 2. An array of arrays with 2 values. In this case, the values correspond to
  254. * `x,y`. If the first value is a string, it is applied as the name of the
  255. * point, and the `x` value is inferred.
  256. * ```js
  257. * data: [
  258. * [0, 6],
  259. * [1, 2],
  260. * [2, 6]
  261. * ]
  262. * ```
  263. *
  264. * 3. An array of objects with named values. The following snippet shows only a
  265. * few settings, see the complete options set below. If the total number of
  266. * data points exceeds the series'
  267. * [turboThreshold](#series.lollipop.turboThreshold), this option is not
  268. * available.
  269. * ```js
  270. * data: [{
  271. * x: 1,
  272. * y: 9,
  273. * name: "Point2",
  274. * color: "#00FF00",
  275. * connectorWidth: 3,
  276. * connectorColor: "#FF00FF"
  277. * }, {
  278. * x: 1,
  279. * y: 6,
  280. * name: "Point1",
  281. * color: "#FF00FF"
  282. * }]
  283. * ```
  284. *
  285. * @sample {highcharts} highcharts/chart/reflow-true/
  286. * Numerical values
  287. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  288. * Arrays of numeric x and y
  289. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  290. * Arrays of datetime x and y
  291. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  292. * Arrays of point.name and y
  293. * @sample {highcharts} highcharts/series/data-array-of-objects/
  294. * Config objects
  295. *
  296. * @type {Array<number|Array<(number|string),(number|null)>|null|*>}
  297. * @extends series.dumbbell.data
  298. * @excluding high, low, lowColor
  299. * @product highcharts highstock
  300. * @apioption series.lollipop.data
  301. */
  302. /**
  303. * The y value of the point.
  304. *
  305. * @type {number|null}
  306. * @product highcharts highstock
  307. * @apioption series.line.data.y
  308. */
  309. ''; // adds doclets above to transpiled file
  310. return LollipopSeries;
  311. });
  312. _registerModule(_modules, 'masters/modules/lollipop.src.js', [], function () {
  313. });
  314. }));