The Data Visualization Engineer translates raw numbers into visual shapes that communicate faster than a table. The chart type determines what question it answers - a line chart shows trend, a bar chart shows comparison, a scatter plot shows correlation. Choosing the wrong chart makes the answer harder to see, not easier.
Chart Type Selection Guide
| Chart type | Best for | Avoid when |
|---|---|---|
| Line chart | Trends over time with continuous data | Fewer than 4 data points; non-temporal x-axis |
| Bar chart | Comparing discrete categories | More than 15 categories; time series |
| Stacked bar | Part-to-whole over categories | More than 5 stack segments; small differences matter |
| Scatter plot | Correlation between two variables | Fewer than 20 data points; categorical x-axis |
| Heatmap | Density / frequency across two dimensions | Precise values need to be read |
| Funnel | Sequential conversion rates | Non-sequential steps; steps can be skipped |
| Pie / donut | Simple part-to-whole with ≤5 segments | More than 5 segments; comparing segment sizes matters |
Recharts Pattern
import {
LineChart, Line, XAxis, YAxis, CartesianGrid,
Tooltip, Legend, ResponsiveContainer
} from 'recharts';
const data = [
{ date: 'Jan', revenue: 4200, users: 240 },
{ date: 'Feb', revenue: 5800, users: 310 },
{ date: 'Mar', revenue: 7200, users: 410 },
];
export function RevenueChart() {
return (
<ResponsiveContainer width="100%" height={300}>
<LineChart data={data} margin={{ top: 5, right: 20, left: 0, bottom: 5 }}>
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
<XAxis dataKey="date" tick={{ fontSize: 12, fill: '#6b7280' }} />
<YAxis
tick={{ fontSize: 12, fill: '#6b7280' }}
tickFormatter={(v) => `$${(v / 1000).toFixed(0)}k`}
/>
<Tooltip
contentStyle={{ borderRadius: 8, border: '1px solid #e5e7eb' }}
formatter={(value: number) => [`$${value.toLocaleString()}`, 'Revenue']}
/>
<Legend />
<Line
type="monotone"
dataKey="revenue"
stroke="#3b82f6"
strokeWidth={2}
dot={false}
activeDot={{ r: 4 }}
/>
</LineChart>
</ResponsiveContainer>
);
}
Large Dataset Performance
- Switch from SVG to Canvas (
rechartsCanvas mode orvisx) beyond ~5,000 data points - SVG DOM nodes become a render bottleneck - Use data decimation: reduce to max 500 points client-side using LTTB (Largest-Triangle-Three-Buckets) algorithm before rendering
- Virtualise tooltip hit-testing - spatial indexing (d3-quadtree) instead of iterating all points on mousemove
- Memoize chart data transforms with
useMemo- avoid recomputing aggregations on every render - Accessible charts: add
aria-labelto the chart container and a<table>alternative visible to screen readers (and hidden via CSS)