interactionBreakdownChart.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 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. grid={{
  28. left: 20,
  29. right: 50,
  30. top: 30,
  31. bottom: 10,
  32. }}
  33. />
  34. </ChartContainer>
  35. );
  36. }
  37. const ChartContainer = styled('div')`
  38. flex: 1;
  39. border: 1px solid ${p => p.theme.gray200};
  40. border-radius: ${p => p.theme.borderRadius};
  41. margin-bottom: ${space(4)};
  42. `;