How can I help you?
Getting Started with the Vue Chart Component in the Quasar Framework
20 Feb 20266 minutes to read
This section provides a step-by-step guide to creating a Quasar application and integrating the Syncfusion® Vue Chart component using the Composition API. It helps developers set up a responsive, high-performance charting solution within the Quasar ecosystem.
The Quasar Framework is a Vue.js–based open-source framework that enables developers to build modern, high-performance applications for web, mobile, and desktop from a single code base.
Prerequisites
Ensure that the development environment meets the requirements listed in
System requirements for Syncfusion® Vue Chart components.
Set up the Quasar project
To create a new Quasar project, run the following command:
npm init quasarThe command prompts for project options; example prompts appear below:

The generator installs dependencies when prompted. Confirm installation to proceed, as shown below:

Navigate to the project directory:
cd quasar-projectNow that quasar-project is ready, add the Syncfusion® Vue Chart component to the project.
Add Syncfusion® Vue packages
Syncfusion® Vue Chart component packages are available at npmjs.com. To use Syncfusion® Vue components in the project, install the corresponding npm package.
This article uses the Vue Chart component as an example. To use the Vue Chart component in the project, install the @syncfusion/ej2-vue-charts package using:
npm install @syncfusion/ej2-vue-chartsNote: npm v5+ saves packages to
dependenciesby default;--saveis not required.
Optional but recommended: To ensure proper styling, add one of the Syncfusion themes (for example, Material) to your Quasar config (for example, in quasar.config.js under the css array) or include the styles in a boot file:
// quasar.config.js
css: [
'@syncfusion/ej2-base/styles/material.css',
'@syncfusion/ej2-buttons/styles/material.css',
'@syncfusion/ej2-charts/styles/material.css',
// add other needed EJ2 component styles
]Add the Syncfusion® Vue component
Follow the steps below to add the Vue Chart component:
- First, add the
setupattribute to thescripttag to indicate that Vue will be using theComposition API, and import the Chart component in thescriptsection of src/app.vue.
<script setup>
import { provide } from 'vue';
import { ChartComponent as EjsChart, SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries, LineSeries, Legend, Category } from "@syncfusion/ej2-vue-charts";
</script>- In the
templatesection, define the Chart component with thedataSourceproperty.
<template>
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Line' xName='month' yName='sales' name='Sales'> </e-series>
</e-series-collection>
</ejs-chart>
</template>- Declare the values for the
dataSourceproperty in thescriptsection.
<script setup>
let seriesData = [
{ month: 'Jan', sales: 35 }, { month: 'Feb', sales: 28 },
{ month: 'Mar', sales: 34 }, { month: 'Apr', sales: 32 },
{ month: 'May', sales: 40 }, { month: 'Jun', sales: 32 },
{ month: 'Jul', sales: 35 }, { month: 'Aug', sales: 55 },
{ month: 'Sep', sales: 38 }, { month: 'Oct', sales: 30 },
{ month: 'Nov', sales: 25 }, { month: 'Dec', sales: 32 }
];
</script>Here is the summarized code for the above steps in the src/app.vue file:
<template>
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Line' xName='month' yName='sales' name='Sales'> </e-series>
</e-series-collection>
</ejs-chart>
</template>
<script setup>
import { provide } from 'vue';
import { ChartComponent as EjsChart, SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries, LineSeries, Legend, Category } from "@syncfusion/ej2-vue-charts";
let seriesData = [
{ month: 'Jan', sales: 35 }, { month: 'Feb', sales: 28 },
{ month: 'Mar', sales: 34 }, { month: 'Apr', sales: 32 },
{ month: 'May', sales: 40 }, { month: 'Jun', sales: 32 },
{ month: 'Jul', sales: 35 }, { month: 'Aug', sales: 55 },
{ month: 'Sep', sales: 38 }, { month: 'Oct', sales: 30 },
{ month: 'Nov', sales: 25 }, { month: 'Dec', sales: 32 }
];
let title = 'Sales Analysis';
let primaryXAxis = {valueType: 'Category'};
// Register required modules (idiomatic one-liner)
provide('chart', [LineSeries, Legend, Category]);
</script>Run the project
To run the project, use the following command:
npm run devThe output will appear as follows:
