StreamgraphSeries.js 4.9 KB

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