viser-vue is a Vue.js component library designed for declarative data visualization, acting as a Vue-native wrapper for charts powered by the AntV G2 charting engine. It provides a set of components such as `<v-chart>`, `<v-tooltip>`, and various specific chart types (e.g., `<v-smooth-line>`) that allow developers to build interactive data visualizations directly within Vue templates. The package also integrates with `@antv/data-set` for robust data transformation capabilities. The current stable version is 2.4.8, last published approximately six years ago, indicating it is primarily designed for Vue 2 applications and is likely in a maintenance-only mode. Its key differentiator is providing a familiar Vue component API over the powerful G2 visualization grammar, abstracting away lower-level charting details for Vue developers. Due to its age, direct compatibility with Vue 3 is not expected.
npm install viser-vueVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a multi-line smooth chart using `viser-vue` components. It imports `viser-vue` as a Vue plugin, uses `@antv/data-set` to transform raw data into a suitable format, and then binds this processed data to a `<v-chart>` component, defining axes, tooltips, and a smooth line series with different colors per city. This example is designed for Vue 2 applications.
For Vue 3 projects, consider using a Vue 3-native charting library or a migration build (@vue/compat) as an intermediary step, though full compatibility for older libraries like viser-vue is not guaranteed. The recommended path is to find a Vue 3 alternative or rewrite using modern AntV G2 directly.
Assess the risk for new projects. For existing projects, consider migrating to more actively maintained Vue 2 or Vue 3 compatible charting libraries for long-term support and security.
Prefer `import DataSet from '@antv/data-set';` over `const DataSet = require('@antv/data-set');` in TypeScript or ES Module contexts. Ensure your `tsconfig.json` and build configuration (e.g., Webpack, Vite) are set up for proper module resolution.Ensure you are running a Vue 2 project (`vue@^2.x.x`). If you must use it in a Vue 3 project, investigate `@vue/compat` for a migration path, but be aware that full compatibility is not guaranteed. Make sure `Vue.use(ViserVue);` is called before your root Vue instance is created.
Install the dependency: `npm install --save @antv/data-set` or `yarn add @antv/data-set`.