uniformRateChart.tsx 1.9 KB

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