throughputChart.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import type {Series} from 'sentry/types/echarts';
  2. import {RateUnit} from 'sentry/utils/discover/fields';
  3. import {formatRate} from 'sentry/utils/formatters';
  4. import {CHART_HEIGHT} from 'sentry/views/performance/database/settings';
  5. import {THROUGHPUT_COLOR} from 'sentry/views/starfish/colors';
  6. import Chart, {ChartType} from 'sentry/views/starfish/components/chart';
  7. import ChartPanel from 'sentry/views/starfish/components/chartPanel';
  8. import {getThroughputChartTitle} from 'sentry/views/starfish/views/spans/types';
  9. interface Props {
  10. isLoading: boolean;
  11. series: Series;
  12. error?: Error | null;
  13. }
  14. export function ThroughputChart({series, isLoading}: Props) {
  15. return (
  16. <ChartPanel title={getThroughputChartTitle('db')}>
  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. loading={isLoading}
  27. chartColors={[THROUGHPUT_COLOR]}
  28. type={ChartType.LINE}
  29. aggregateOutputFormat="rate"
  30. rateUnit={RateUnit.PER_MINUTE}
  31. tooltipFormatterOptions={{
  32. valueFormatter: value => formatRate(value, RateUnit.PER_MINUTE),
  33. }}
  34. />
  35. </ChartPanel>
  36. );
  37. }