uniformRateChart.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import styled from '@emotion/styled';
  2. import {BarChart} from 'sentry/components/charts/barChart';
  3. import {ChartContainer, HeaderTitle} from 'sentry/components/charts/styles';
  4. import {Panel} from 'sentry/components/panels';
  5. import Placeholder from 'sentry/components/placeholder';
  6. import {t} from 'sentry/locale';
  7. import {Series} from 'sentry/types/echarts';
  8. import {formatAbbreviatedNumber} from 'sentry/utils/formatters';
  9. import getDynamicText from 'sentry/utils/getDynamicText';
  10. type Props = {
  11. series: Series[];
  12. };
  13. function UniformRateChart({series}: Props) {
  14. const legend = {
  15. right: 10,
  16. top: 5,
  17. data: series.map(s => s.seriesName),
  18. };
  19. return (
  20. <ChartPanel>
  21. <ChartContainer>
  22. <HeaderTitle>{t('Transactions (Last 30 days) ')}</HeaderTitle>
  23. {getDynamicText({
  24. value: (
  25. <BarChart
  26. legend={legend}
  27. series={series}
  28. grid={{
  29. left: '10px',
  30. right: '10px',
  31. top: '40px',
  32. bottom: '0px',
  33. }}
  34. height={200}
  35. isGroupedByDate
  36. showTimeInTooltip={false}
  37. tooltip={{valueFormatter: value => formatAbbreviatedNumber(value)}}
  38. yAxis={{
  39. axisLabel: {
  40. formatter: (value: number) => formatAbbreviatedNumber(value),
  41. },
  42. }}
  43. />
  44. ),
  45. fixed: <Placeholder height="224px" />,
  46. })}
  47. </ChartContainer>
  48. </ChartPanel>
  49. );
  50. }
  51. const ChartPanel = styled(Panel)`
  52. margin-bottom: 0;
  53. border-bottom-left-radius: 0;
  54. border-bottom: none;
  55. border-bottom-right-radius: 0;
  56. `;
  57. export {UniformRateChart};