throughputChart.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 {THROUGHPUT_COLOR} from 'sentry/views/insights/colors';
  5. import Chart, {ChartType} from 'sentry/views/insights/common/components/chart';
  6. import ChartPanel from 'sentry/views/insights/common/components/chartPanel';
  7. import {getThroughputChartTitle} from 'sentry/views/insights/common/views/spans/types';
  8. import {CHART_HEIGHT} from 'sentry/views/insights/database/settings';
  9. import {RESOURCE_THROUGHPUT_UNIT} from '../../settings';
  10. interface Props {
  11. isLoading: boolean;
  12. series: Series;
  13. error?: Error | null;
  14. }
  15. export function ThroughputChart({series, isLoading}: Props) {
  16. return (
  17. <ChartPanel title={getThroughputChartTitle('resource', RESOURCE_THROUGHPUT_UNIT)}>
  18. <Chart
  19. height={CHART_HEIGHT}
  20. grid={{
  21. left: '0',
  22. right: '0',
  23. top: '8px',
  24. bottom: '0',
  25. }}
  26. data={[series]}
  27. loading={isLoading}
  28. chartColors={[THROUGHPUT_COLOR]}
  29. type={ChartType.LINE}
  30. aggregateOutputFormat="rate"
  31. rateUnit={RateUnit.PER_MINUTE}
  32. tooltipFormatterOptions={{
  33. valueFormatter: value => formatRate(value, RESOURCE_THROUGHPUT_UNIT),
  34. }}
  35. />
  36. </ChartPanel>
  37. );
  38. }