BarSeries.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /* *
  2. * (c) 2010-2019 Torstein Honsi
  3. *
  4. * License: www.highcharts.com/license
  5. */
  6. 'use strict';
  7. import H from './Globals.js';
  8. import './Utilities.js';
  9. import './ColumnSeries.js';
  10. var seriesType = H.seriesType;
  11. /**
  12. * Bar series type.
  13. *
  14. * @private
  15. * @class
  16. * @name Highcharts.seriesTypes.bar
  17. *
  18. * @augments Highcharts.Series
  19. */
  20. seriesType('bar', 'column',
  21. /**
  22. * A bar series is a special type of column series where the columns are
  23. * horizontal.
  24. *
  25. * @sample highcharts/demo/bar-basic/
  26. * Bar chart
  27. *
  28. * @extends plotOptions.column
  29. * @product highcharts
  30. * @apioption plotOptions.bar
  31. */
  32. /**
  33. * Alignment of the data label relative to the data point.
  34. *
  35. * @sample {highcharts} highcharts/plotoptions/bar-datalabels-align-inside-bar/
  36. * Data labels inside the bar
  37. *
  38. * @type {string}
  39. * @default left
  40. * @product highcharts
  41. * @apioption plotOptions.bar.dataLabels.align
  42. */
  43. /**
  44. * The x position of the data label relative to the data point.
  45. *
  46. * @sample {highcharts} highcharts/plotoptions/bar-datalabels-align-inside-bar/
  47. * Data labels inside the bar
  48. *
  49. * @type {number}
  50. * @default 5
  51. * @product highcharts
  52. * @apioption plotOptions.bar.dataLabels.x
  53. */
  54. /**
  55. * @ignore
  56. */
  57. null
  58. , {
  59. inverted: true
  60. });
  61. /**
  62. * A `bar` series. If the [type](#series.bar.type) option is not specified,
  63. * it is inherited from [chart.type](#chart.type).
  64. *
  65. * @extends series,plotOptions.bar
  66. * @excluding connectNulls, dashStyle, dataParser, dataURL, gapSize, gapUnit,
  67. * linecap, lineWidth, marker, connectEnds, step
  68. * @product highcharts
  69. * @apioption series.bar
  70. */
  71. /**
  72. * An array of data points for the series. For the `bar` series type,
  73. * points can be given in the following ways:
  74. *
  75. * 1. An array of numerical values. In this case, the numerical values will be
  76. * interpreted as `y` options. The `x` values will be automatically
  77. * calculated, either starting at 0 and incremented by 1, or from
  78. * `pointStart` and `pointInterval` given in the series options. If the axis
  79. * has categories, these will be used. Example:
  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 to
  85. * `x,y`. If the first value is a string, it is applied as the name of the
  86. * point, and the `x` value is inferred.
  87. * ```js
  88. * data: [
  89. * [0, 5],
  90. * [1, 10],
  91. * [2, 3]
  92. * ]
  93. * ```
  94. *
  95. * 3. An array of objects with named values. The following snippet shows only a
  96. * few settings, see the complete options set below. If the total number of
  97. * data points exceeds the series'
  98. * [turboThreshold](#series.bar.turboThreshold), this option is not
  99. * available.
  100. * ```js
  101. * data: [{
  102. * x: 1,
  103. * y: 1,
  104. * name: "Point2",
  105. * color: "#00FF00"
  106. * }, {
  107. * x: 1,
  108. * y: 10,
  109. * name: "Point1",
  110. * color: "#FF00FF"
  111. * }]
  112. * ```
  113. *
  114. * @sample {highcharts} highcharts/chart/reflow-true/
  115. * Numerical values
  116. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  117. * Arrays of numeric x and y
  118. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  119. * Arrays of datetime x and y
  120. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  121. * Arrays of point.name and y
  122. * @sample {highcharts} highcharts/series/data-array-of-objects/
  123. * Config objects
  124. *
  125. * @type {Array<number|Array<(number|string),number>|*>}
  126. * @extends series.column.data
  127. * @product highcharts
  128. * @apioption series.bar.data
  129. */
  130. /**
  131. * @excluding halo,lineWidth,lineWidthPlus,marker
  132. * @product highcharts highstock
  133. * @apioption series.bar.states.hover
  134. */
  135. /**
  136. * @excluding halo,lineWidth,lineWidthPlus,marker
  137. * @product highcharts highstock
  138. * @apioption series.bar.states.select
  139. */