interactionBreakdownChart.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import styled from '@emotion/styled';
  2. import {CHART_PALETTE} from 'sentry/constants/chartPalette';
  3. import {space} from 'sentry/styles/space';
  4. import {getDurationUnit} from 'sentry/utils/discover/charts';
  5. import {useInteractionBreakdownTimeseriesQuery} from 'sentry/views/performance/browser/interactionSummary/useInteractionBreakdownTimeseriesQuery';
  6. import Chart, {ChartType} from 'sentry/views/starfish/components/chart';
  7. type Props = {
  8. element: string;
  9. operation: string;
  10. page: string;
  11. };
  12. export function InteractionBreakdownChart({operation, element, page}: Props) {
  13. const {data, isLoading} = useInteractionBreakdownTimeseriesQuery({
  14. operation,
  15. element,
  16. page,
  17. });
  18. return (
  19. <ChartContainer>
  20. <Chart
  21. height={200}
  22. data={data}
  23. loading={isLoading}
  24. chartColors={[CHART_PALETTE[0][0]]}
  25. durationUnit={getDurationUnit(data)}
  26. aggregateOutputFormat="duration"
  27. type={ChartType.AREA}
  28. grid={{
  29. left: 20,
  30. right: 50,
  31. top: 30,
  32. bottom: 10,
  33. }}
  34. />
  35. </ChartContainer>
  36. );
  37. }
  38. const ChartContainer = styled('div')`
  39. flex: 1;
  40. border: 1px solid ${p => p.theme.gray200};
  41. border-radius: ${p => p.theme.borderRadius};
  42. margin-bottom: ${space(4)};
  43. `;