Creating beautiful and interactive charts in your Vue applications has never been easier. With the vue-chrts package (it's not a typo), you can build stunning, responsive charts with just a few lines of code.
To add Vue charts to your project, install the library via npm, pnpm or yarn:
pnpm add vue-chrts
npm install vue-chrts
yarn add vue-chrts
Then, import the chart component and use it in your Vue application:
<script lang="ts" setup>
import { AreaChart } from "vue-chrts";
interface AreaChartItem {
date: string
desktop: number
mobile: number
}
const categories: ComputedRef<Record<string, BulletLegendItemInterface>> =
computed(() => ({
desktop: {
name: 'Desktop',
color: '#3b82f6',
},
mobile: {
name: 'Mobile',
color: '#22c55e',
},
}))
const AreaChartData: AreaChartItem[] = [
{ date: '2024-04-01', desktop: 222, mobile: 150 },
{ date: '2024-04-02', desktop: 180, mobile: 97 },
{ date: '2024-04-03', desktop: 167, mobile: 120 },
{ date: '2024-04-04', desktop: 260, mobile: 240 },
{ date: '2024-04-05', desktop: 240, mobile: 290 },
]
const xFormatter = (tick: number): string => {
return `${AreaChartData[tick]?.date}`
}
</script>
<template>
<div id="app">
<AreaChart
:data="AreaChartData"
:height="300"
:categories="categories"
:y-grid-line="true"
:x-formatter="xFormatter"
:curve-type="CurveType.MonotoneX"
:legend-position="LegendPosition.Top"
:hide-legend="false"
/>
</div>
</template>
Vue charts (vue-chrts) can render any chart and are beautiful by design.
Vue charts are ideal for SaaS projects and finance dashboards, providing real-time data visualization, customizable chart types, and seamless integration with modern Vue workflows.
To learn more, check out our documentation.
Get instant access to 100+ chart & blocks
Everything you need to know about our templates