scatterChart.tsx 891 B

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