StreamgraphSeries.js 3.9 KB

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