npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-highcharts

v0.2.0

Published

Highcharts component for Vue

Downloads

12,722

Readme

vue-highcharts

GitHub Action Coverage NPM version License File size Download jsDelivr

Highcharts component for Vue.

Requirements

  • Vue >= 3.0.0
  • Highcharts >= 4.2.0

Installation

npm i -S vue-highcharts

For Vue 2, please run npm i -S [email protected], and checkout document here.

Usage

Registering globally

import { createApp } from 'vue';
import Highcharts from 'highcharts';
import VueHighcharts from 'vue-highcharts';

import App from './App.vue';

const app = createApp(App);
app.use(VueHighcharts, { Highcharts });
// now <Highcharts /> is available in components
<script src="/path/to/vue/dist/vue.global.prod.js"></script>
<script src="/path/to/highcharts/highcharts.js"></script>
<script src="/path/to/vue-highcharts/dist/vue-highcharts.js"></script>
<script>
const { createApp } = window.Vue;
const app = createApp();
app.use(window.VueHighcharts['default'], { Highcharts: window.Highcharts });
</script>

Highstock, Highmaps and any other add-ons

import { createApp } from 'vue';
import Highcharts from 'highcharts';
import VueHighcharts from 'vue-highcharts';

import App from './App.vue';

// load these modules as your need
import loadStock from 'highcharts/modules/stock.js';
import loadMap from 'highcharts/modules/map.js';
import loadGantt from 'highcharts/modules/gantt.js';
import loadDrilldown from 'highcharts/modules/drilldown.js';
// some charts like solid gauge require `highcharts-more.js`, you can find it in official document.
import loadHighchartsMore from 'highcharts/highcharts-more.js';
import loadSolidGauge from 'highcharts/modules/solid-gauge.js';

loadStock(Highcharts);
loadMap(Highcharts);
loadGantt(Highcharts);
loadDrilldown(Highcharts);
loadHighchartsMore(Highcharts);
loadSolidGauge(Highcharts);

const app = createApp(App);
app.use(VueHighcharts, { Highcharts });
// now <Highcharts />, <Highstock />, <Highmaps />, <HighchartsGantt /> is available in components
// drilldown and solid gauge are work with <Highcharts />

Registering in components

<template>
  <Highcharts />
  <Highmaps />
</template>

<script>
import Highcharts from 'highcharts';
import { createHighcharts } from 'vue-highcharts';

import loadMap from 'highcharts/modules/map.js';

loadMap(Highcharts);

export default {
  components: {
    Highcharts: createHighcharts('Highcharts', Highcharts),
    Highmaps: createHighcharts('Highmaps', Highcharts),
    // Highstock: createHighcharts('Highstock', Highcharts),
    // HighchartsGantt: createHighcharts('HighchartsGantt', Highcharts),
  },
};
</script>

Typing:

type ChartName = 'Highcharts' | 'Highstock' | 'Highmaps' | 'HighchartsGantt';
function createHighcharts(name: ChartName, Highcharts: Highcharts): VueComponent | null

Configuration options and the chart instance

<template>
  <Highcharts ref="highchartsRef" :options="chartOptions" />
  <Highstock :options="stockOptions" />
  <Highmaps :options="mapsOptions" />
  <HighchartsGantt :options="ganttOptions" />
</template>

<script>
import { ref, onMounted } from 'vue';

export default {
  setup() {
    const highchartsRef = ref(null);
    onMounted(() => {
      // access the `chart` instance with template refs
      const { chart } = highchartsRef.value;
    });
    return {
      highchartsRef,
      chartOptions: {},
      stockOptions: {},
      mapsOptions: {},
      ganttOptions: {},
    };
  },
};
</script>

The options object can be found in Highcharts API Reference.

The chart instance can be accessed with template refs.

Demo