projectStatsGraph.tsx 837 B

12345678910111213141516171819202122232425262728293031323334
  1. import {Fragment} from 'react';
  2. import LazyLoad from 'react-lazyload';
  3. import MiniBarChart from 'sentry/components/charts/miniBarChart';
  4. import {t} from 'sentry/locale';
  5. import {Project} from 'sentry/types';
  6. import {Series} from 'sentry/types/echarts';
  7. type Props = {
  8. project: Project;
  9. stats?: Project['stats'];
  10. };
  11. function ProjectStatsGraph({project, stats}: Props) {
  12. stats = stats || project.stats || [];
  13. const series: Series[] = [
  14. {
  15. seriesName: t('Events'),
  16. data: stats.map(point => ({name: point[0] * 1000, value: point[1]})),
  17. },
  18. ];
  19. return (
  20. <Fragment>
  21. {series && (
  22. <LazyLoad height={25} debounce={50}>
  23. <MiniBarChart isGroupedByDate showTimeInTooltip series={series} height={25} />
  24. </LazyLoad>
  25. )}
  26. </Fragment>
  27. );
  28. }
  29. export default ProjectStatsGraph;