Use your preferred package manager to install the library:
pnpm add nuxt-charts
pnpm add vue-chrts @unovis/ts @unovis/vue
shamefully-hoist=true in your .npmrc to avoid the "to-px" error, or install @unovis/ts as a dependency.If you are using Nuxt, add the module to your nuxt.config.ts:
export default defineNuxtConfig({
modules: ["nuxt-charts"]
})
For Vue-only projects, no additional configuration is required.
<script setup lang="ts">
const data = [
{ month: 'Jan', sales: 100, profit: 50 },
{ month: 'Feb', sales: 120, profit: 55 },
{ month: 'Mar', sales: 180, profit: 80 },
{ month: 'Apr', sales: 110, profit: 40 },
{ month: 'May', sales: 90, profit: 30 },
]
const categories = {
sales: {
name: 'Sales',
color: '#3b82f6',
},
profit: {
name: 'Profit',
color: '#10b981',
},
}
const xFormatter = (i: number) => data[i].month
</script>
<template>
<LineChart
:data="data"
:categories="categories"
:height="300"
:xFormatter="xFormatter"
xLabel="Month"
yLabel="Amount"
/>
</template>
<script setup lang="ts">
import { LineChart, LegendPosition } from 'vue-chrts'
const data = [
{ month: 'Jan', sales: 100 },
{ month: 'Feb', sales: 120 },
]
const categories = {
sales: {
name: 'Sales',
color: '#3b82f6'
}
}
</script>
<template>
<LineChart
:data="data"
:categories="categories"
:legendPosition="LegendPosition.TopCenter"
/>
</template>
Check the Unovis documentation for all options.
:root {
--vis-color0: oklch(0.72 0.192 149.58) !important;
--vis-color1: oklch(0.63 0.1963 157.86) !important;
--tooltip-label-color: rgba(255, 255, 255, 0.5) !important;
--tooltip-value-color: rgba(255, 255, 255, 1) !important;
--vis-axis-grid-color: rgba(255, 255, 255, 0.1) !important;
--vis-tooltip-background-color: #121212 !important;
--vis-tooltip-border-color: none !important;
--tooltip-label-color: rgba(255, 255, 255, 0.5);
--tooltip-value-color: rgba(255, 255, 255, 1);
--vis-tooltip-text-color: rgba(255, 255, 255, 0.5) !important;
--vis-axis-tick-label-color: rgba(255, 255, 255, 0.5) !important;
--vis-legend-label-color: rgba(255, 255, 255, 0.75) !important;
--vis-axis-label-color: rgba(255, 255, 255, 0.5) !important;
--vis-legend-label-color: rgba(255, 255, 255, 0.5) !important;
}
When searching for the right charting solution, it's important to understand how different libraries stack up.
| Feature | Nuxt Charts | Chart.js | Unovis |
|---|---|---|---|
| Rendering | SVG (native) | Canvas | SVG (native) |
| Type Safety | ✅ Full TypeScript | Partial | ✅ Full TypeScript |
| Style System | Tailwind / Nuxt UI | Custom CSS | Framework-agnostic |
| SEO Ready | ✅ Yes | ❌ Limited | ✅ Yes |
| Best For | Modern Nuxt/Vue Apps | Legacy/Simple Apps | Complex Dashboards |