Nuxt Charts is a Nuxt 3 module (current stable version 2.1.4) that provides an effortless way to integrate beautiful and responsive charting components into Nuxt applications. It acts as a wrapper around the `vue-chrts` library, which is inspired by Tremor and built on top of Unovis, offering a variety of chart types including Line, Bar, Area, Stacked Area, and Donut charts. The module leverages Nuxt's auto-import feature for its components and types, simplifying the development experience. It is designed with Vue 3 and TypeScript, focusing on customizability and an intuitive API. While `nuxt-charts` doesn't have a fixed public release cadence, it typically aligns with the Nuxt ecosystem's rapid development. Its key differentiator lies in providing a 'Nuxt-native' charting solution, abstracting away direct component imports from `vue-chrts` and integrating seamlessly with the Nuxt development workflow, which differentiates it from general Vue charting libraries like `vue-chartjs` or `vue-chartkick`.
npm install nuxt-chartsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to enable the `nuxt-charts` module in `nuxt.config.ts` and then use both `LineChart` and `BarChart` components directly in a Vue component. It highlights the auto-import functionality for chart components and provides example data and categories.
To resolve this, add `shamefully-hoist=true` to your `.npmrc` file, or explicitly install `@unovis/ts` as a direct dependency in your project: `pnpm add @unovis/ts`.
Always prefer using the auto-imported components directly in your Vue templates (e.g., `<LineChart />`) without any explicit script imports, as this is the intended and most efficient way within a Nuxt module context. Only explicitly import from `vue-chrts` if you have disabled Nuxt auto-imports or for specific advanced scenarios.
Ensure that data bound to chart props is deeply reactive if nested changes are expected to trigger updates. Use `toRaw()` for passing non-reactive objects if reactivity is not needed, or explicitly use `.value` for refs. Consider `watch` or `watchEffect` for complex reactivity scenarios, or configure deep reactivity for `useAsyncData`/`useFetch` if necessary.
Ensure `modules: ['nuxt-charts']` is present in your `nuxt.config.ts` file.
Install `vue-chrts` manually: `npm install vue-chrts` or `pnpm add vue-chrts` or `yarn add vue-chrts`.
Add `shamefully-hoist=true` to your `.npmrc` file (create if it doesn't exist) or explicitly install `@unovis/ts` as a direct dependency: `pnpm add @unovis/ts`.