Installation

Get started with Nuxt Charts or Vue Charts.

1. Install dependencies

Use your preferred package manager to install the library:

pnpm add nuxt-charts
Warning! If you're using pnpm in a Nuxt project, set shamefully-hoist=true in your .npmrc to avoid the "to-px" error, or install @unovis/ts as a dependency.

2. Configuration (Nuxt only)

If you are using Nuxt, add the module to your nuxt.config.ts:

nuxt.config.ts
export default defineNuxtConfig({
    modules: ["nuxt-charts"]
})

For Vue-only projects, no additional configuration is required.

3. Test installation

<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>

4. Customize CSS variables

Check the Unovis documentation for all options.

/assets/css/main.css
: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;
}

Library Comparison

When searching for the right charting solution, it's important to understand how different libraries stack up.

FeatureNuxt ChartsChart.jsUnovis
RenderingSVG (native)CanvasSVG (native)
Type Safety✅ Full TypeScriptPartial✅ Full TypeScript
Style SystemTailwind / Nuxt UICustom CSSFramework-agnostic
SEO Ready✅ Yes❌ Limited✅ Yes
Best ForModern Nuxt/Vue AppsLegacy/Simple AppsComplex Dashboards