barChart.stories.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import {BarChart} from 'sentry/components/charts/barChart';
  2. export default {
  3. title: 'Components/Data Visualization/Charts/Bar Chart',
  4. component: BarChart,
  5. parameters: {
  6. controls: {hideNoControlsWarning: true},
  7. },
  8. };
  9. export const _BarChart = () => {
  10. return (
  11. <div>
  12. <BarChart
  13. style={{height: 250}}
  14. stacked
  15. series={[
  16. {
  17. seriesName: 'Unhandled Errors',
  18. data: [
  19. {
  20. value: 923,
  21. name: 'Chrome',
  22. },
  23. {
  24. value: 107,
  25. name: 'Safari',
  26. },
  27. {
  28. value: 50,
  29. name: 'Firefox',
  30. },
  31. ],
  32. },
  33. {
  34. seriesName: 'Handled Errors',
  35. data: [
  36. {
  37. value: 100,
  38. name: 'Chrome',
  39. },
  40. {
  41. value: 99,
  42. name: 'Safari',
  43. },
  44. {
  45. value: 66,
  46. name: 'Opera',
  47. },
  48. ],
  49. },
  50. ]}
  51. />
  52. <BarChart
  53. style={{height: 400}}
  54. stacked
  55. series={[
  56. {
  57. seriesName: 'Chrome',
  58. data: [
  59. {
  60. value: 923,
  61. name: 'Jan 1',
  62. },
  63. {
  64. value: 107,
  65. name: 'Jan 2',
  66. },
  67. {
  68. value: 50,
  69. name: 'Jan 3',
  70. },
  71. ],
  72. },
  73. {
  74. seriesName: 'Safari',
  75. data: [
  76. {
  77. value: 100,
  78. name: 'Jan 1',
  79. },
  80. {
  81. value: 99,
  82. name: 'Jan 2',
  83. },
  84. {
  85. value: 66,
  86. name: 'Jan 3',
  87. },
  88. {
  89. value: 66,
  90. name: 'Jan 4',
  91. },
  92. ],
  93. },
  94. ]}
  95. />
  96. <h2 style={{paddingLeft: '60px'}}>Regular Bar Chart (Not Stacked):</h2>
  97. <BarChart
  98. style={{height: 400}}
  99. series={[
  100. {
  101. seriesName: 'Chrome',
  102. data: [
  103. {
  104. value: 923,
  105. name: 'Jan 1',
  106. },
  107. {
  108. value: 107,
  109. name: 'Jan 2',
  110. },
  111. {
  112. value: 50,
  113. name: 'Jan 3',
  114. },
  115. ],
  116. },
  117. {
  118. seriesName: 'Safari',
  119. data: [
  120. {
  121. value: 100,
  122. name: 'Jan 1',
  123. },
  124. {
  125. value: 99,
  126. name: 'Jan 2',
  127. },
  128. {
  129. value: 66,
  130. name: 'Jan 3',
  131. },
  132. {
  133. value: 66,
  134. name: 'Jan 4',
  135. },
  136. ],
  137. },
  138. ]}
  139. />
  140. </div>
  141. );
  142. };
  143. _BarChart.storyName = 'Bar Chart';
  144. _BarChart.parameters = {
  145. docs: {
  146. description: {
  147. story: 'Stacked & Unstacked Bar Charts',
  148. },
  149. },
  150. };