durationChart.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import type {ComponentProps} from 'react';
  2. import type {Series} from 'sentry/types/echarts';
  3. import {CHART_HEIGHT} from 'sentry/views/performance/database/settings';
  4. import {AVG_COLOR} from 'sentry/views/starfish/colours';
  5. import Chart, {ChartType} from 'sentry/views/starfish/components/chart';
  6. import ChartPanel from 'sentry/views/starfish/components/chartPanel';
  7. import {getDurationChartTitle} from 'sentry/views/starfish/views/spans/types';
  8. interface Props {
  9. isLoading: boolean;
  10. series: Series[];
  11. error?: Error | null;
  12. scatterPlot?: ComponentProps<typeof Chart>['scatterPlot'];
  13. }
  14. export function DurationChart({series, scatterPlot, isLoading, error}: Props) {
  15. return (
  16. <ChartPanel title={getDurationChartTitle('http')}>
  17. <Chart
  18. height={CHART_HEIGHT}
  19. grid={{
  20. left: '0',
  21. right: '0',
  22. top: '8px',
  23. bottom: '0',
  24. }}
  25. data={series}
  26. scatterPlot={scatterPlot}
  27. loading={isLoading}
  28. error={error}
  29. chartColors={[AVG_COLOR]}
  30. type={ChartType.LINE}
  31. />
  32. </ChartPanel>
  33. );
  34. }