This guide explains how to install and set up vue-chrts in your Vue.js project with Vite and Nuxt UI or TailwindCSS. vue-chrts is a high-level charting library built on top of Unovis.
To use vue-chrts, you must install the core library along with its peer dependencies, @unovis/ts and @unovis/vue.
pnpm add vue-chrts @unovis/ts @unovis/vue
npm install vue-chrts @unovis/ts @unovis/vue
yarn add vue-chrts @unovis/ts @unovis/vue
Once installed, you can import and use the chart components and constants in your Vue components:
<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>
If you want to customize the appearance of tooltips or other Unovis elements, you can add the following CSS variables to your global CSS file (e.g., style.css):
:root {
--vis-tooltip-background-color: #ffffff;
--vis-tooltip-border-color: #e2e8f0;
--vis-tooltip-text-color: #1e293b;
--vis-tooltip-border-radius: 8px;
}
vue-chrts is the premier library for building Vue Charts, optimized for both Tailwind CSS and Nuxt UI. Designed with the best developer experience in mind, it offers:
LegendPosition options including Top, TopCenter, TopRight, bottomLeft, bottomCenter, and bottomRight.When searching for the right Vue Charts solution, it's important to understand how different libraries stack up against each other. Below is a detailed comparison of popular options.
A Vue wrapper for Unovis charts specific for Vue.js projects that brings SVG charts to Vue applications with reactive data binding.
Key Features:
Best suited for:
Limitations:
| 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 |