streamgraph.src.js 3.9 KB

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