Nivo vs Recharts vs Chart.js vs Victory: Which Chart Library Fits Your Project?
A balanced comparison of Nivo charts with Recharts, Chart.js and Victory covering API style, rendering, chart variety, React integration and fit.
Read guide
Nivo charts are designed to be shaped around your application rather than forcing a fixed look. Colours, typography, axes, legends, labels and tooltips can all be adjusted through props, and a shared theme keeps every chart consistent. This article walks through the main customisation areas and the props that control them.
The colors prop is the starting point for most visual changes. It accepts a named scheme, an array of colour values, a function that returns a colour for each datum, or an object that reads colours from a field in your data. Named schemes come from d3-scale-chromatic, including categorical options such as nivo, category10, paired and set2.
Mapping colours from data is useful when categories must always use the same colour, for example brand-specific products. Store the colour on each record and point the colors prop at that field.
| colors value | Example | Use case |
|---|---|---|
| Scheme object | { scheme: 'set2' } | Quick, balanced palettes |
| Array | ['#22B39A', '#F7B731'] | Brand palettes |
| Function | bar => bar.data.color | Colours stored in data |
Props such as borderColor and labelTextColor accept inherit modifiers, for example darker or brighter versions of the element colour. This keeps borders and labels harmonious without defining every shade manually.
The theme prop controls everything that is not the data shapes themselves: fonts, axis lines and ticks, grid lines, legends, labels, annotations and tooltip containers. Defining one theme object and passing it to every chart creates a consistent visual language across dashboards.
const theme = {
text: { fontFamily: 'Poppins, sans-serif', fontSize: 12, fill: '#4A5A70' },
axis: { ticks: { line: { stroke: '#CBD5DC' } }, legend: { text: { fontWeight: 600 } } },
grid: { line: { stroke: '#E2EAED', strokeDasharray: '4 4' } },
legends: { text: { fontSize: 12 } },
tooltip: { container: { borderRadius: 10, boxShadow: '0 8px 24px rgba(0,0,0,.1)' } },
}
Axes are configured through axisTop, axisRight, axisBottom and axisLeft. Each accepts settings for tick size, padding, rotation, legend text, legend position and offset, plus a format option for tick labels. Passing null hides an axis entirely.
Grid lines are toggled with enableGridX and enableGridY, and gridXValues or gridYValues can limit lines to specific values. Lighter grids usually improve readability, letting the data stand out.
Legends are defined as an array in the legends prop, so a chart can show more than one. Each legend has an anchor, direction, item size, spacing and symbol shape, and hover effects can highlight the matching series.
Labels display values directly on shapes. Options such as enableLabel, labelSkipWidth and labelSkipHeight in bar charts hide labels on elements too small to fit them, preventing overlapping text.
The tooltip prop accepts a React component that receives the hovered element's data, giving complete control over content and layout. Custom tooltips are ideal for adding formatted values, comparisons or links to related views.
const Tip = ({ id, value, color }) => (
<div style={{ padding: 10, background: '#fff', borderLeft: `4px solid ${color}` }}>
<strong>{id}</strong>: {value.toLocaleString()}
</div>
)
<ResponsiveBar data={data} keys={['value']} indexBy="country" tooltip={Tip} />
Event props such as onClick, onMouseEnter and onMouseLeave let charts drive the rest of an interface, for example filtering a table when a bar is clicked.
Many charts support defs and fill props, which apply SVG patterns or gradients to selected elements. Patterns such as lines or dots are valuable for accessibility because they distinguish series without relying on colour alone.
The layers prop controls drawing order and accepts custom functions that render additional elements, such as target lines, annotations or centre labels in donut charts. Layers give advanced control while keeping the built-in behaviour intact.
Responsive charts resize automatically, but good mobile layouts often need different props too. Reading the container width and adjusting margins, tick counts and legend placement keeps charts legible on narrow screens.
Moving legends below the chart, shortening labels and reducing label density are simple changes with a big impact on phones.
Margins reserve space for axes and legends, and fixed values that suit a desktop layout can waste room on a phone. Calculating margins from the container width keeps the plotting area as large as possible on every screen.
Before shipping a chart, a short review ensures that customisation choices support readability rather than decoration. The checklist below covers the details that most often need attention.
| Area | What to check |
|---|---|
| Colour | Consistent meaning across charts and sufficient contrast |
| Typography | Theme font matches the application and sizes are legible |
| Axes | Units are clear and tick labels do not overlap |
| Legends | Placement does not cover data on small screens |
| Tooltips | Values are formatted and easy to scan |
| Accessibility | ARIA labels and patterns support non-colour cues |
Customisation grows over time, and scattered settings become hard to manage. Centralising themes, colour maps, axis formatters and tooltip components in a shared module keeps every chart aligned with a single source of truth.
Wrapping frequently used charts in your own components, for example a BrandBarChart with sensible defaults, means product teams only pass data and a few options. Updates to styling then happen in one place instead of across dozens of files.
Most styling is applied through props and the theme object rather than external CSS, which keeps SVG and Canvas renderers consistent.
Set fontFamily in the text section of the theme object, making sure the font is loaded by your application.
Yes. Set animate to false, or choose a calmer motionConfig preset when you want subtle transitions.
Nivo charts give you control over colours, themes, axes, legends, labels, tooltips, patterns and layers through clear, consistent props. A shared theme plus a small set of colour rules creates a professional, unified look across every visualisation.
Start with colours and theme, refine axes and labels, then add custom tooltips where they bring real value. The examples article shows these techniques working together in complete dashboards.