streamgraph.src.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /**
  2. * @license Highcharts JS v7.0.2 (2019-01-17)
  3. * Streamgraph module
  4. *
  5. * (c) 2010-2019 Torstein Honsi
  6. *
  7. * License: www.highcharts.com/license
  8. */
  9. 'use strict';
  10. (function (factory) {
  11. if (typeof module === 'object' && module.exports) {
  12. factory['default'] = factory;
  13. module.exports = factory;
  14. } else if (typeof define === 'function' && define.amd) {
  15. define(function () {
  16. return factory;
  17. });
  18. } else {
  19. factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
  20. }
  21. }(function (Highcharts) {
  22. (function (H) {
  23. /* *
  24. * Streamgraph module
  25. *
  26. * (c) 2010-2019 Torstein Honsi
  27. *
  28. * License: www.highcharts.com/license
  29. */
  30. var seriesType = H.seriesType;
  31. /**
  32. * @private
  33. * @class
  34. * @name Highcharts.seriesTypes.streamgraph
  35. *
  36. * @augments Highcharts.Series
  37. */
  38. seriesType('streamgraph', 'areaspline'
  39. /**
  40. * A streamgraph is a type of stacked area graph which is displaced around a
  41. * central axis, resulting in a flowing, organic shape.
  42. *
  43. * @sample {highcharts|highstock} highcharts/demo/streamgraph/
  44. * Streamgraph
  45. *
  46. * @extends plotOptions.areaspline
  47. * @since 6.0.0
  48. * @product highcharts highstock
  49. * @optionparent plotOptions.streamgraph
  50. */
  51. , {
  52. fillOpacity: 1,
  53. lineWidth: 0,
  54. marker: {
  55. enabled: false
  56. },
  57. stacking: 'stream'
  58. // Prototype functions
  59. }, {
  60. negStacks: false,
  61. // Modifier function for stream stacks. It simply moves the point up or
  62. // down in order to center the full stack vertically.
  63. streamStacker: function (pointExtremes, stack, i) {
  64. // Y bottom value
  65. pointExtremes[0] -= stack.total / 2;
  66. // Y value
  67. pointExtremes[1] -= stack.total / 2;
  68. // Record the Y data for use when getting axis extremes
  69. this.stackedYData[i] = pointExtremes;
  70. }
  71. });
  72. /**
  73. * A `streamgraph` series. If the [type](#series.streamgraph.type) option is not
  74. * specified, it is inherited from [chart.type](#chart.type).
  75. *
  76. * @extends series,plotOptions.streamgraph
  77. * @excluding dataParser, dataURL
  78. * @product highcharts highstock
  79. * @apioption series.streamgraph
  80. */
  81. /**
  82. * An array of data points for the series. For the `streamgraph` series type,
  83. * points can be given in the following ways:
  84. *
  85. * 1. An array of numerical values. In this case, the numerical values
  86. * will be interpreted as `y` options. The `x` values will be automatically
  87. * calculated, either starting at 0 and incremented by 1, or from `pointStart`
  88. * and `pointInterval` given in the series options. If the axis has
  89. * categories, these will be used. Example:
  90. *
  91. * ```js
  92. * data: [0, 5, 3, 5]
  93. * ```
  94. *
  95. * 2. An array of arrays with 2 values. In this case, the values correspond
  96. * to `x,y`. If the first value is a string, it is applied as the name
  97. * of the point, and the `x` value is inferred.
  98. *
  99. * ```js
  100. * data: [
  101. * [0, 9],
  102. * [1, 7],
  103. * [2, 6]
  104. * ]
  105. * ```
  106. *
  107. * 3. An array of objects with named values. The following snippet shows only a
  108. * few settings, see the complete options set below. If the total number of data
  109. * points exceeds the series' [turboThreshold](#series.area.turboThreshold),
  110. * this option is not available.
  111. *
  112. * ```js
  113. * data: [{
  114. * x: 1,
  115. * y: 9,
  116. * name: "Point2",
  117. * color: "#00FF00"
  118. * }, {
  119. * x: 1,
  120. * y: 6,
  121. * name: "Point1",
  122. * color: "#FF00FF"
  123. * }]
  124. * ```
  125. *
  126. * @sample {highcharts} highcharts/chart/reflow-true/
  127. * Numerical values
  128. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  129. * Arrays of numeric x and y
  130. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  131. * Arrays of datetime x and y
  132. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  133. * Arrays of point.name and y
  134. * @sample {highcharts} highcharts/series/data-array-of-objects/
  135. * Config objects
  136. *
  137. * @type {Array<number|Array<(number|string),number>|*>}
  138. * @extends series.line.data
  139. * @product highcharts highstock
  140. * @apioption series.streamgraph.data
  141. */
  142. }(Highcharts));
  143. return (function () {
  144. }());
  145. }));