Nivo charts Examples for Dashboards, Analytics and Reports
Practical Nivo charts examples for sales dashboards, website analytics, finance, KPI reports and research, with chart choices, data shapes and props.
Read guide
Nivo charts npm packages make adding visualisations to a React project straightforward. Rather than installing one large library, you add a small foundation package plus the chart types you actually need. This walkthrough covers prerequisites, installation commands, a first working chart and the most common setup problems developers meet along the way.
Nivo is a React library, so you need an existing React project created with a tool such as Vite, Next.js or another setup you already use. Node.js and a package manager like npm, Yarn or pnpm should be installed and working from your terminal.
Check that your React version is compatible with the Nivo release you plan to install. The peer dependency information listed for each package on npm, together with the repository release notes, shows which React versions are supported.
Every chart type is published as a separate package under the @nivo scope. The installation instructions pair each chart package with @nivo/core, the shared foundation that provides theming and common utilities. Supporting packages such as axes, legends and tooltips are installed automatically as dependencies.
| You want to build | Packages to install | Main component |
|---|---|---|
| Bar chart | @nivo/core @nivo/bar | ResponsiveBar |
| Line or area chart | @nivo/core @nivo/line | ResponsiveLine |
| Pie or donut chart | @nivo/core @nivo/pie | ResponsivePie |
| Calendar heatmap | @nivo/core @nivo/calendar | ResponsiveCalendar |
| Treemap | @nivo/core @nivo/treemap | ResponsiveTreeMap |
Open a terminal in the project root, the folder containing package.json, and install the foundation together with your first chart package. The example below adds everything needed for a bar chart.
npm install @nivo/core @nivo/bar
Yarn and pnpm users can run the equivalent commands, yarn add @nivo/core @nivo/bar or pnpm add @nivo/core @nivo/bar. Adding more charts later only requires installing their packages, for example @nivo/line or @nivo/pie.
All @nivo packages are released together and are designed to work at matching versions. Mixing versions, such as an older @nivo/core with a newer chart package, can cause duplicated internals or type errors, so update all Nivo packages at the same time.
With the packages installed, create a component that imports the responsive chart, defines some data and renders the chart inside a container with a fixed height. The height matters because responsive charts size themselves from their parent element.
import { ResponsiveBar } from '@nivo/bar'
const data = [
{ country: 'UK', value: 120 },
{ country: 'US', value: 200 },
{ country: 'DE', value: 150 },
]
export default function SalesChart() {
return (
<div style={{ height: 360 }}>
<ResponsiveBar
data={data}
keys={['value']}
indexBy="country"
margin={{ top: 20, right: 20, bottom: 50, left: 60 }}
padding={0.3}
colors={{ scheme: 'nivo' }}
axisBottom={{ legend: 'Country', legendPosition: 'middle', legendOffset: 36 }}
/>
</div>
)
}
Import SalesChart into a page and start the development server. A three-bar chart with axes, hover tooltips and animated transitions should appear immediately.
Only a few props are required to get started, and the rest refine appearance and behaviour. Knowing what each one controls makes the documentation far easier to navigate when you begin customising.
Frameworks that render on the server need one extra consideration. Nivo charts depend on browser features such as measuring their container, so in the Next.js App Router the file containing the chart should be a client component marked with the use client directive.
Vite, Create React App style setups and other client-rendered projects need no additional configuration. Import the chart and render it like any other component.
Most issues after installation fall into a handful of predictable categories. Working through them in order usually resolves a blank or broken chart within minutes.
| Symptom | Likely cause | Fix |
|---|---|---|
| Chart area is empty | Parent element has no height | Give the wrapper an explicit height |
| Module not found error | Chart package missing | Install the specific @nivo package |
| Peer dependency warnings | React version mismatch | Check supported versions in release notes |
| Type errors after an update | Mixed @nivo versions | Update all Nivo packages together |
| Error during server rendering | Chart rendered on the server | Use a client component |
Once the first chart works, the nivo.rocks documentation becomes the most useful companion. Each chart page provides live controls that update a preview and generate matching code, which is an efficient way to discover props without reading every option.
Continue with the documentation walkthrough to learn how props and data formats are described, or browse practical examples for dashboard ideas.
Projects usually grow from one chart to several. Each new chart type only needs its own package, because @nivo/core is already installed. Running a single command such as npm install @nivo/line @nivo/pie adds line and pie charts without touching existing code.
Keep a short list of the Nivo packages your project uses in documentation or code comments. When upgrading, that list makes it easy to update every package together and confirm nothing was missed.
Charts sometimes get replaced during redesigns. Uninstalling packages you no longer import keeps the dependency tree tidy and avoids carrying unused code into future upgrades.
A quick check confirms that everything installed correctly before you invest time in configuration. Listing the installed Nivo packages shows whether versions match and whether anything is missing.
npm ls @nivo/core @nivo/bar
Nivo charts npm installation comes down to adding @nivo/core plus the chart packages you need, importing a responsive component and rendering it inside a container with a defined height. Keeping package versions aligned and using client components in server-rendered frameworks prevents most problems.
With that foundation in place, every additional chart type is one install command away, and the same data-plus-props approach applies across the whole library.