vue-highcharts is a component library that facilitates the integration of Highcharts, Highstock, Highmaps, and HighchartsGantt into Vue.js applications. The current stable version is 0.2.0, which targets Vue 3 exclusively. Previous versions (like 0.1.x) supported Vue 2. This library provides a straightforward way to globally register Highcharts components via `app.use()` or locally register them within individual components using `createHighcharts`. It allows for dynamic loading of Highcharts modules and add-ons like Stock, Map, Gantt, and Drilldown by passing the Highcharts object. Its key differentiator is its direct component-based approach for various Highcharts chart types, abstracting away much of the boilerplate for Vue 3 developers.
npm install vue-highchartsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to globally register vue-highcharts in a Vue 3 application, including loading various Highcharts modules like Stock, Map, and Gantt, making their respective components (`<Highcharts>`, `<Highstock>`, `<Highmaps>`, `<HighchartsGantt>`) available throughout the application.
For Vue 2 projects, install `npm i -S vue-highcharts@0.1`. For Vue 3 projects, ensure `vue` peer dependency is `^3.0.0`.
When globally registering, explicitly pass `{ Highcharts }` as the second argument to `app.use()`. Example: `app.use(VueHighcharts, { Highcharts });`Update all instances of `genComponent` to `createHighcharts`. Example: `import { createHighcharts } from 'vue-highcharts'; ... components: { Highcharts: createHighcharts('Highcharts', Highcharts) }`Import the `Highcharts` object directly from the `highcharts` package or retrieve it from the global scope if using direct `<script>` includes.
Migrate usage of `<HighchartsRender />` to `<Highcharts />` or other specific chart components (`<Highstock />`, `<Highmaps />`, etc.) registered globally or locally.
Ensure `app.use(VueHighcharts, { Highcharts });` is called in your main application file (for global registration) or use `createHighcharts` within the `components` option of your Vue component (for local registration).Confirm your project is running Vue 3. If on Vue 2, use `vue-highcharts@0.1.x` and its respective installation method (likely `Vue.use(VueHighcharts, { Highcharts });`).Ensure `import Highcharts from 'highcharts';` is present and that `Highcharts` is passed correctly to `app.use(VueHighcharts, { Highcharts });` or `createHighcharts('Highcharts', Highcharts);`.