scatterChart.tsx 961 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import * as React from 'react';
  2. import {Series} from 'sentry/types/echarts';
  3. import ScatterSeries from './series/scatterSeries';
  4. import BaseChart from './baseChart';
  5. type ChartProps = Omit<React.ComponentProps<typeof BaseChart>, 'css'>;
  6. export type ScatterChartSeries = Series;
  7. type Props = Omit<ChartProps, 'series'> & {
  8. series: ScatterChartSeries[];
  9. };
  10. function ScatterChart({series, ...props}: Props) {
  11. return (
  12. <BaseChart
  13. {...props}
  14. xAxis={{
  15. // do not want the axis pointer when working with scatter charts
  16. axisPointer: {
  17. show: false,
  18. ...props.xAxis?.axisPointer,
  19. },
  20. ...props.xAxis,
  21. }}
  22. series={series.map(({seriesName, data, ...options}) =>
  23. ScatterSeries({
  24. name: seriesName,
  25. data: data.map(({name, value}) => [name, value]),
  26. ...options,
  27. animation: false,
  28. })
  29. )}
  30. />
  31. );
  32. }
  33. export default ScatterChart;