Skip to content

ChartScatter

The ChartScatter component displays data as a scatter plot with customizable styling, tooltips, and legends. Built with ApexCharts.

import { ChartScatter } from '@fintech-sandpit/ui/react';
const data = [
{ x: 10, y: 20, series: 'Team A' },
{ x: 15, y: 25, series: 'Team A' },
{ x: 20, y: 30, series: 'Team A' },
{ x: 12, y: 22, series: 'Team B' },
{ x: 18, y: 28, series: 'Team B' },
{ x: 22, y: 32, series: 'Team B' },
];
const series = [
{ name: 'Team A' },
{ name: 'Team B' },
];
return (
<ChartScatter
data={data}
series={series}
height="400px"
showTooltip={true}
showLegend={true}
/>
);
NameTypeDefaultDescription
dataChartScatterDataItem[]Array of data points where each object contains x, y coordinates and series name
seriesArray<{ name: string }>Array of series objects defining which series to display
widthCssUnit'100%'Width of the chart container (CSS unit string like ‘100%’, ‘400px’, ‘50rem’)
heightCssUnit'400px'Height of the chart container (CSS unit string like ‘400px’, ‘50vh’)
legendPositionLegendPosition'bottom'Position of the legend
showTooltipbooleantrueWhether to display tooltips on hover
showLegendbooleantrueWhether to display the legend
colorsstring[]Array of colors for the chart points
type CssUnit = `${number}${'px' | 'em' | 'rem' | 'vw' | 'vh' | 'vmin' | 'vmax' | '%'}`
type LegendPosition = 'top' | 'bottom' | 'left' | 'right'
type ChartScatterDataItem = {
x: number;
y: number;
series: string;
}