charts-chartcuterie.stories.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. import styled from '@emotion/styled';
  2. import * as echarts from 'echarts/core';
  3. import ReactEchartsCore from 'echarts-for-react/lib/core';
  4. import config from 'sentry/chartcuterie/config';
  5. import {ChartType} from 'sentry/chartcuterie/types';
  6. import {getDimensionValue} from 'sentry/components/charts/utils';
  7. import space from 'sentry/styles/space';
  8. const {renderConfig} = config;
  9. export default {
  10. title: 'Components/Data Visualization/Charts/Chartcuterie',
  11. };
  12. export const _SlackDiscoverTotalPeriod = () => {
  13. const data = [
  14. [1613577600000, [{count: 3659}]],
  15. [1613579400000, [{count: 3574}]],
  16. [1613581200000, [{count: 3360}]],
  17. [1613583000000, [{count: 2987}]],
  18. [1613584800000, [{count: 2853}]],
  19. [1613586600000, [{count: 2759}]],
  20. [1613588400000, [{count: 2617}]],
  21. [1613590200000, [{count: 2494}]],
  22. [1613592000000, [{count: 2341}]],
  23. [1613593800000, [{count: 2335}]],
  24. [1613595600000, [{count: 2272}]],
  25. [1613597400000, [{count: 2176}]],
  26. [1613599200000, [{count: 2109}]],
  27. [1613601000000, [{count: 1876}]],
  28. [1613602800000, [{count: 1626}]],
  29. [1613604600000, [{count: 1439}]],
  30. [1613606400000, [{count: 1402}]],
  31. [1613608200000, [{count: 1355}]],
  32. [1613610000000, [{count: 1413}]],
  33. [1613611800000, [{count: 1351}]],
  34. [1613613600000, [{count: 1347}]],
  35. [1613615400000, [{count: 1343}]],
  36. [1613617200000, [{count: 1188}]],
  37. [1613619000000, [{count: 1162}]],
  38. [1613620800000, [{count: 1131}]],
  39. ];
  40. const {height, width, getOption} = renderConfig.get(
  41. ChartType.SLACK_DISCOVER_TOTAL_PERIOD
  42. );
  43. return (
  44. <Container>
  45. <ReactEchartsCore
  46. echarts={echarts}
  47. style={{
  48. height: getDimensionValue(height),
  49. width: getDimensionValue(width),
  50. }}
  51. opts={{height, width, renderer: 'canvas'}}
  52. option={getOption({seriesName: 'count()', stats: {data}})}
  53. />
  54. </Container>
  55. );
  56. };
  57. export const _SlackDiscoverTotalDaily = () => {
  58. const data = [
  59. [1615852800, [{count: 2426486}]],
  60. [1615939200, [{count: 18837228}]],
  61. [1616025600, [{count: 14662530}]],
  62. [1616112000, [{count: 15102981}]],
  63. [1616198400, [{count: 7759228}]],
  64. [1616284800, [{count: 7216556}]],
  65. [1616371200, [{count: 16976035}]],
  66. [1616457600, [{count: 17240832}]],
  67. [1616544000, [{count: 16814701}]],
  68. [1616630400, [{count: 17480989}]],
  69. [1616716800, [{count: 15387478}]],
  70. [1616803200, [{count: 8467454}]],
  71. [1616889600, [{count: 6382678}]],
  72. [1616976000, [{count: 16842851}]],
  73. [1617062400, [{count: 12959057}]],
  74. ];
  75. const {height, width, getOption} = renderConfig.get(
  76. ChartType.SLACK_DISCOVER_TOTAL_DAILY
  77. );
  78. return (
  79. <Container>
  80. <ReactEchartsCore
  81. echarts={echarts}
  82. style={{
  83. height: getDimensionValue(height),
  84. width: getDimensionValue(width),
  85. }}
  86. opts={{height, width, renderer: 'canvas'}}
  87. option={getOption({seriesName: 'count()', stats: {data}})}
  88. />
  89. </Container>
  90. );
  91. };
  92. export const _SlackDiscoverTop5 = () => {
  93. const stats = {
  94. 'ludic-science,1st event': {
  95. data: [
  96. [1615877940, [{count: 0}]],
  97. [1615878000, [{count: 0}]],
  98. [1615878060, [{count: 0}]],
  99. [1615878120, [{count: 0}]],
  100. [1615878180, [{count: 1}]],
  101. [1615878240, [{count: 1}]],
  102. [1615878300, [{count: 1}]],
  103. [1615878360, [{count: 1}]],
  104. [1615878420, [{count: 1}]],
  105. [1615878480, [{count: 1}]],
  106. [1615878540, [{count: 1}]],
  107. [1615878600, [{count: 1}]],
  108. [1615878660, [{count: 1}]],
  109. [1615878720, [{count: 1}]],
  110. [1615878780, [{count: 1}]],
  111. [1615878840, [{count: 1}]],
  112. [1615878900, [{count: 1}]],
  113. [1615878960, [{count: 1}]],
  114. [1615879020, [{count: 1}]],
  115. [1615879080, [{count: 1}]],
  116. [1615879140, [{count: 1}]],
  117. [1615879200, [{count: 1}]],
  118. [1615879260, [{count: 1}]],
  119. [1615879320, [{count: 1}]],
  120. [1615879380, [{count: 0}]],
  121. [1615879440, [{count: 0}]],
  122. [1615879500, [{count: 0}]],
  123. [1615879560, [{count: 0}]],
  124. [1615879620, [{count: 0}]],
  125. ],
  126. order: 0,
  127. },
  128. 'ludic-science,2nd event': {
  129. data: [
  130. [1615877940, [{count: 0}]],
  131. [1615878000, [{count: 0}]],
  132. [1615878060, [{count: 0}]],
  133. [1615878120, [{count: 0}]],
  134. [1615878180, [{count: 1}]],
  135. [1615878240, [{count: 1}]],
  136. [1615878300, [{count: 1}]],
  137. [1615878360, [{count: 1}]],
  138. [1615878420, [{count: 1}]],
  139. [1615878480, [{count: 1}]],
  140. [1615878540, [{count: 1}]],
  141. [1615878600, [{count: 1}]],
  142. [1615878660, [{count: 1}]],
  143. [1615878720, [{count: 1}]],
  144. [1615878780, [{count: 1}]],
  145. [1615878840, [{count: 1}]],
  146. [1615878900, [{count: 1}]],
  147. [1615878960, [{count: 1}]],
  148. [1615879020, [{count: 1}]],
  149. [1615879080, [{count: 1}]],
  150. [1615879140, [{count: 1}]],
  151. [1615879200, [{count: 1}]],
  152. [1615879260, [{count: 1}]],
  153. [1615879320, [{count: 1}]],
  154. [1615879380, [{count: 0}]],
  155. [1615879440, [{count: 0}]],
  156. [1615879500, [{count: 0}]],
  157. [1615879560, [{count: 0}]],
  158. [1615879620, [{count: 0}]],
  159. ],
  160. order: 1,
  161. },
  162. };
  163. const {height, width, getOption} = renderConfig.get(ChartType.SLACK_DISCOVER_TOP5);
  164. return (
  165. <Container>
  166. <ReactEchartsCore
  167. echarts={echarts}
  168. style={{
  169. height: getDimensionValue(height),
  170. width: getDimensionValue(width),
  171. }}
  172. opts={{height, width, renderer: 'canvas'}}
  173. option={getOption({stats})}
  174. />
  175. </Container>
  176. );
  177. };
  178. const Container = styled('div')`
  179. margin: ${space(2)};
  180. border: 1px solid ${p => p.theme.innerBorder};
  181. display: inline-block;
  182. `;