All Projects → smithalan92 → vue3-highcharts

smithalan92 / vue3-highcharts

Licence: MIT License
Vue 3 component wrapper for Highcharts.js

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to vue3-highcharts

vue2-timeago
🙌 A vue component used to format date with time ago statement. 💬
Stars: ✭ 76 (+85.37%)
Mutual labels:  vue3
electron-vue-vite-boilerplate
Electron Vue Vite Boilerplate for you next project
Stars: ✭ 26 (-36.59%)
Mutual labels:  vue3
codeiiest-web
https://codeiiest.org | Website for Code IIEST
Stars: ✭ 23 (-43.9%)
Mutual labels:  vue3
vue-bootstrap-boilerplate
📦 Vue 2/3, Bootstrap 5, Vuex, Vue-Router, Sass/Scss, ESLint, Axios (switch to vue3 branch)
Stars: ✭ 86 (+109.76%)
Mutual labels:  vue3
v-bucket
📦 Fast, Simple, and Lightweight State Manager for Vue 3.0 built with composition API, inspired by Vuex.
Stars: ✭ 42 (+2.44%)
Mutual labels:  vue3
variantwind
Most elegant way to work with TailwindCSS variants in Vue
Stars: ✭ 45 (+9.76%)
Mutual labels:  vue3
highcharts-themes-collection
Highcharts themes collection
Stars: ✭ 30 (-26.83%)
Mutual labels:  highcharts
vue3-dropzone
HTML5 drag-drop zone with vue3
Stars: ✭ 34 (-17.07%)
Mutual labels:  vue3
hoc-element-table
📦 A Vue 3.x Table Component built on Webpack 5
Stars: ✭ 26 (-36.59%)
Mutual labels:  vue3
xForm
基于[email protected]的动态表单生成器。
Stars: ✭ 25 (-39.02%)
Mutual labels:  vue3
highcharts-webcomponent
Highcharts Web Component usable with any Framework
Stars: ✭ 21 (-48.78%)
Mutual labels:  highcharts
vue3-webpack-boilerplate
Vue 3 Webpack Boilerplate (Vue 3, Vue Router 4, Vuex 4, Typescript)
Stars: ✭ 69 (+68.29%)
Mutual labels:  vue3
vite-example
Todo app with vite/vue3/vue-router4
Stars: ✭ 22 (-46.34%)
Mutual labels:  vue3
vue3-cesium-typescript-start-up-template
Vue3 cesium ts start up template. 有时候需要墙才能访问
Stars: ✭ 39 (-4.88%)
Mutual labels:  vue3
layui-vue
采用 layui 风格的 vue3 组件库。(UI一直是个痛,那就先基于现有的UI,先封装几套玩玩。)
Stars: ✭ 15 (-63.41%)
Mutual labels:  vue3
vite-vue-admin
🎉🎉使用Vite + Vue3 + TypeScript + Element-plus + Mock开发的后台管理系统🎉🎉
Stars: ✭ 97 (+136.59%)
Mutual labels:  vue3
vue-snippets
Visual Studio Code Syntax Highlighting For Vue3 And Vue2
Stars: ✭ 25 (-39.02%)
Mutual labels:  vue3
OSAPI
👋 OSAPI 是依靠通用性后台管理平台搭建的API管理平台,基于 vue3、Nestjs 技术栈实现,包含 RBAC 角色权限模块、数据展示、编辑等模块。
Stars: ✭ 32 (-21.95%)
Mutual labels:  vue3
data-visualization
🔗 configurable data visualization
Stars: ✭ 18 (-56.1%)
Mutual labels:  highcharts
tutorial-photo-gallery-vue
Photo Gallery Tutorial: Ionic Vue and Capacitor
Stars: ✭ 33 (-19.51%)
Mutual labels:  vue3

Vue 3 - Highcharts JS

A simple, fast, Vue 3 component for rendering Highcharts.js Charts written using the composition API.

Demos https://smithalan92.github.io/vue3-highcharts/

Note: This package is not maintained

This package was originally created when Vue 3 was first released as there was no component to use Vue 3 with highcharts. Since then the official highcharts package has been updated to support Vue 3. I recommend existing users switch to using the official package.

highcharts-vue

Minimum Requirements

[email protected] [email protected] ( older versions may work but not tested )

Vue and Highcharts are not bundled with the module and need to be included in your projects dependencies.

Usage

Install with npm

npm i --save vue3-highcharts

You can register the component in 2 ways.

Register as a global component.

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

const app = createApp(..options);
app.use(VueHighcharts);

Register as a local component

import VueHighcharts from 'vue3-highcharts';

export default {
  name: 'MyChart',
  components: {
    VueHighcharts,
  },
};

Props

The following props can be passed to the component. Options is the only required one.

Name Type Required Default Notes
type String no 'chart' This should be the constructor type you'd use with highcharts. If you import the stock chat, you can pass 'stockChart' as this option for example.
options Object yes - This should be a Highcharts chart options object
redrawOnUpdate Boolean no true If the chart should be redrawn when options update.
oneToOneUpdate Boolean no false If the certain collections should be updated one to one. See here.
animateOnUpdate Boolean no true If the redraw should be animated.

Events

The following events are emitted from the component. No data is provided with any event.

Name Notes
rendered Emitted when the chart has been rendered on the dom
updated Emitted when the chart options have been updated and the chart has been updated
destroyed Emitted when the Highcharts chart instance has been destroyed ( happens when the component unmounts )


The Highcharts chart object is also exposed on the component instance as chart

A wrapper div is also created with a .vue-highcharts class around the actual chart.

Simple Example

<template>
  <vue-highcharts
    type="chart"
    :options="chartOptions"
    :redrawOnUpdate="true"
    :oneToOneUpdate="false"
    :animateOnUpdate="true"
    @rendered="onRender"
    @update="onUpdate"
    @destroy="onDestroy"/>
</template>
<script>
import { ref } from 'vue';

export default {
  name: 'chart',
  setup() {
    const data = ref([1, 2, 3])
    const chartData = computed(() =>{
      return {
        series: [{
          name: 'Test Series',
          data: data.value,
        }],
      }
    });

    const onRender = () => {
      console.log('Chart rendered');
    };

    const onUpdate = () => {
      console.log('Chart updated');
    };

    const onDestroy = () => {
      console.log('Chart destroyed');
    };

    return {
      chartData,
      onRender,
      onUpdate,
      onDestroy,
    };
  }
}
</script>
<style>
.vue-highcharts {
  width: 100%;
}
</style>

Using Stock/Map charts

To use the stock map charts, you need to import and register them. For example, to use the map chart

import HighCharts from 'highcharts';
import useMapCharts from 'highcharts/modules/map';

useMapCharts(HighCharts);
<template>
  <vue-highcharts type="mapChart" :options="chartOptions"/>

Local Dev Issues.

Since Vue and Highcharts are not bundled with the module, you may need to add some webpack aliases.

For example, the following needs to be added when using vue-cli to vue.config.js

const path = require('path');
module.exports = {
  chainWebpack: (config) => {
    config.resolve.alias.set('vue$', path.join(__dirname, 'node_modules/vue'));
    config.resolve.alias.set('highcharts$', path.join(__dirname, 'node_modules/highcharts'));
  },
};

License

See License.md

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].