streamgraph.src.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /**
  2. * @license Highcharts JS v9.1.1 (2021-06-04)
  3. *
  4. * Streamgraph module
  5. *
  6. * (c) 2010-2021 Torstein Honsi
  7. *
  8. * License: www.highcharts.com/license
  9. */
  10. 'use strict';
  11. (function (factory) {
  12. if (typeof module === 'object' && module.exports) {
  13. factory['default'] = factory;
  14. module.exports = factory;
  15. } else if (typeof define === 'function' && define.amd) {
  16. define('highcharts/modules/streamgraph', ['highcharts'], function (Highcharts) {
  17. factory(Highcharts);
  18. factory.Highcharts = Highcharts;
  19. return factory;
  20. });
  21. } else {
  22. factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
  23. }
  24. }(function (Highcharts) {
  25. var _modules = Highcharts ? Highcharts._modules : {};
  26. function _registerModule(obj, path, args, fn) {
  27. if (!obj.hasOwnProperty(path)) {
  28. obj[path] = fn.apply(null, args);
  29. }
  30. }
  31. _registerModule(_modules, 'Series/Streamgraph/StreamgraphSeries.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) {
  32. /* *
  33. *
  34. * Streamgraph module
  35. *
  36. * (c) 2010-2021 Torstein Honsi
  37. *
  38. * License: www.highcharts.com/license
  39. *
  40. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  41. *
  42. * */
  43. var __extends = (this && this.__extends) || (function () {
  44. var extendStatics = function (d,
  45. b) {
  46. extendStatics = Object.setPrototypeOf ||
  47. ({ __proto__: [] } instanceof Array && function (d,
  48. b) { d.__proto__ = b; }) ||
  49. function (d,
  50. b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  51. return extendStatics(d, b);
  52. };
  53. return function (d, b) {
  54. extendStatics(d, b);
  55. function __() { this.constructor = d; }
  56. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  57. };
  58. })();
  59. var AreaSplineSeries = SeriesRegistry.seriesTypes.areaspline;
  60. var merge = U.merge,
  61. extend = U.extend;
  62. /**
  63. * Streamgraph series type
  64. *
  65. * @private
  66. * @class
  67. * @name Highcharts.seriesTypes.streamgraph
  68. *
  69. * @augments Highcharts.Series
  70. */
  71. var StreamgraphSeries = /** @class */ (function (_super) {
  72. __extends(StreamgraphSeries, _super);
  73. function StreamgraphSeries() {
  74. var _this = _super !== null && _super.apply(this,
  75. arguments) || this;
  76. /* *
  77. *
  78. * Properties
  79. *
  80. * */
  81. _this.data = void 0;
  82. _this.points = void 0;
  83. _this.options = void 0;
  84. return _this;
  85. }
  86. /* *
  87. *
  88. * Functions
  89. *
  90. * */
  91. // Modifier function for stream stacks. It simply moves the point up or
  92. // down in order to center the full stack vertically.
  93. StreamgraphSeries.prototype.streamStacker = function (pointExtremes, stack, i) {
  94. // Y bottom value
  95. pointExtremes[0] -= stack.total / 2;
  96. // Y value
  97. pointExtremes[1] -= stack.total / 2;
  98. // Record the Y data for use when getting axis extremes
  99. this.stackedYData[i] = pointExtremes;
  100. };
  101. /**
  102. * A streamgraph is a type of stacked area graph which is displaced around a
  103. * central axis, resulting in a flowing, organic shape.
  104. *
  105. * @sample {highcharts|highstock} highcharts/demo/streamgraph/
  106. * Streamgraph
  107. *
  108. * @extends plotOptions.areaspline
  109. * @since 6.0.0
  110. * @product highcharts highstock
  111. * @requires modules/streamgraph
  112. * @optionparent plotOptions.streamgraph
  113. */
  114. StreamgraphSeries.defaultOptions = merge(AreaSplineSeries.defaultOptions, {
  115. /**
  116. * @see [fillColor](#plotOptions.streamgraph.fillColor)
  117. * @see [fillOpacity](#plotOptions.streamgraph.fillOpacity)
  118. *
  119. * @apioption plotOptions.streamgraph.color
  120. */
  121. /**
  122. * @see [color](#plotOptions.streamgraph.color)
  123. * @see [fillOpacity](#plotOptions.streamgraph.fillOpacity)
  124. *
  125. * @apioption plotOptions.streamgraph.fillColor
  126. */
  127. /**
  128. * @see [color](#plotOptions.streamgraph.color)
  129. * @see [fillColor](#plotOptions.streamgraph.fillColor)
  130. *
  131. * @apioption plotOptions.streamgraph.fillOpacity
  132. */
  133. fillOpacity: 1,
  134. lineWidth: 0,
  135. marker: {
  136. enabled: false
  137. },
  138. stacking: 'stream'
  139. });
  140. return StreamgraphSeries;
  141. }(AreaSplineSeries));
  142. extend(StreamgraphSeries.prototype, {
  143. negStacks: false
  144. });
  145. SeriesRegistry.registerSeriesType('streamgraph', StreamgraphSeries);
  146. /* *
  147. *
  148. * Default export
  149. *
  150. * */
  151. /* *
  152. *
  153. * API options
  154. *
  155. * */
  156. /**
  157. * A `streamgraph` series. If the [type](#series.streamgraph.type) option is not
  158. * specified, it is inherited from [chart.type](#chart.type).
  159. *
  160. * @extends series,plotOptions.streamgraph
  161. * @excluding dataParser, dataURL, step, boostThreshold, boostBlending
  162. * @product highcharts highstock
  163. * @requires modules/streamgraph
  164. * @apioption series.streamgraph
  165. */
  166. /**
  167. * @see [fillColor](#series.streamgraph.fillColor)
  168. * @see [fillOpacity](#series.streamgraph.fillOpacity)
  169. *
  170. * @apioption series.streamgraph.color
  171. */
  172. /**
  173. * An array of data points for the series. For the `streamgraph` series type,
  174. * points can be given in the following ways:
  175. *
  176. * 1. An array of numerical values. In this case, the numerical values will be
  177. * interpreted as `y` options. The `x` values will be automatically
  178. * calculated, either starting at 0 and incremented by 1, or from
  179. * `pointStart` and `pointInterval` given in the series options. If the axis
  180. * has categories, these will be used. Example:
  181. * ```js
  182. * data: [0, 5, 3, 5]
  183. * ```
  184. *
  185. * 2. An array of arrays with 2 values. In this case, the values correspond to
  186. * `x,y`. If the first value is a string, it is applied as the name of the
  187. * point, and the `x` value is inferred.
  188. * ```js
  189. * data: [
  190. * [0, 9],
  191. * [1, 7],
  192. * [2, 6]
  193. * ]
  194. * ```
  195. *
  196. * 3. An array of objects with named values. The following snippet shows only a
  197. * few settings, see the complete options set below. If the total number of
  198. * data points exceeds the series'
  199. * [turboThreshold](#series.area.turboThreshold),
  200. * this option is not available.
  201. * ```js
  202. * data: [{
  203. * x: 1,
  204. * y: 9,
  205. * name: "Point2",
  206. * color: "#00FF00"
  207. * }, {
  208. * x: 1,
  209. * y: 6,
  210. * name: "Point1",
  211. * color: "#FF00FF"
  212. * }]
  213. * ```
  214. *
  215. * @sample {highcharts} highcharts/chart/reflow-true/
  216. * Numerical values
  217. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  218. * Arrays of numeric x and y
  219. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  220. * Arrays of datetime x and y
  221. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  222. * Arrays of point.name and y
  223. * @sample {highcharts} highcharts/series/data-array-of-objects/
  224. * Config objects
  225. *
  226. * @type {Array<number|Array<(number|string),(number|null)>|null|*>}
  227. * @extends series.line.data
  228. * @product highcharts highstock
  229. * @apioption series.streamgraph.data
  230. */
  231. /**
  232. * @see [color](#series.streamgraph.color)
  233. * @see [fillOpacity](#series.streamgraph.fillOpacity)
  234. *
  235. * @apioption series.streamgraph.fillColor
  236. */
  237. /**
  238. * @see [color](#series.streamgraph.color)
  239. * @see [fillColor](#series.streamgraph.fillColor)
  240. *
  241. * @type {number}
  242. * @default 1
  243. * @apioption series.streamgraph.fillOpacity
  244. */
  245. ''; // adds doclets above to transpiled file
  246. return StreamgraphSeries;
  247. });
  248. _registerModule(_modules, 'masters/modules/streamgraph.src.js', [], function () {
  249. });
  250. }));