Scatter Chart
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
Beautiful scatter charts for exploring correlations between two variables
Installation
Usage
The scatter chart is composible. <EvilScatterChart> is the container, and you compose only the parts you need — <Grid>, <XAxis>, <YAxis>, <Legend>, <Tooltip>, and one or more <Scatter> — as its children. Each <Scatter> carries its own data array of { x, y } points and can be styled independently with isGlowing and isClickable.
import {
EvilScatterChart,
Scatter,
XAxis,
YAxis,
Grid,
Tooltip,
Legend,
Dot,
ActiveDot,
} from "@/components/evilcharts/charts/scatter-chart";<EvilScatterChart config={chartConfig}>
<Grid />
<XAxis dataKey="x" />
<YAxis dataKey="y" />
<Legend isClickable />
<Tooltip />
<Scatter dataKey="desktop" data={desktopData} isClickable>
<Dot variant="border" />
<ActiveDot variant="colored-border" />
</Scatter>
<Scatter dataKey="mobile" data={mobileData} isClickable>
<Dot variant="border" />
<ActiveDot variant="colored-border" />
</Scatter>
</EvilScatterChart>Interactive Selection
Add isClickable to any <Scatter> (and to <Legend>) to make those series selectable. Use the onSelectionChange callback on <EvilScatterChart> to handle selection events:
<EvilScatterChart
config={chartConfig}
onSelectionChange={(selectedDataKey) => {
if (selectedDataKey) {
console.log("Selected:", selectedDataKey);
} else {
console.log("Deselected");
}
}}
>
<XAxis dataKey="x" />
<YAxis dataKey="y" />
<Legend isClickable />
<Tooltip />
<Scatter dataKey="desktop" data={desktopData} isClickable />
<Scatter dataKey="mobile" data={mobileData} isClickable />
</EvilScatterChart>Loading State
The scatter chart supports loading state. Pass isLoading to show an animated skeleton while data is being fetched.
Examples
Gradient Colors
Glowing Points
API Reference
The chart is composed of several parts. The props below are grouped by the component they belong to.
The root container. It owns the shared selection state and the loading skeleton. Everything visual is composed as its children.
A single scatter series. Each <Scatter /> is self-contained with its own point data and style definitions.
Point markers composed inside a <Scatter />. <Dot /> is the resting marker; <ActiveDot /> is the hovered marker.
The value axes. Both default to type="number" and forward every Recharts axis prop. They are hidden automatically while the chart is loading.
The background grid lines. Defaults to horizontal-only dashed lines and forwards every Recharts CartesianGrid prop.
The hover tooltip. It reads the chart's selection state so its content dims unselected series.
The series legend. When the chart is clickable, each entry toggles selection of its series.