scatterChart.tsx 928 B

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