GithubHelp home page GithubHelp logo

kevinongko / vue-chart-js Goto Github PK

View Code? Open in Web Editor NEW
34.0 3.0 4.0 173 KB

Chart.js wrapper component based on Vue.js

License: MIT License

Vue 40.19% JavaScript 59.81%
vue chart chartjs wrapper

vue-chart-js's Introduction

vue-chart-js

npm npm npm npm

Chart.js wrapper component based on Vue.

Works with Vue 2.*

Installation

Install via CDN

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.min.js"></script>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/vue-chart-js"></script>

<script>
  Vue.use(VueChart.default)
</script>

Install via NPM

$ npm install vue-chart-js --save

Register as Component

import Vue from 'vue'
import VueChart from 'vue-chart-js'

export default {
  name: 'App',

  components: {
    VueChart
  }
}

Register as Plugin

import Vue from 'vue'
import VueChart from 'vue-chart-js'

Vue.use(VueChart)

Usage

<template>
  <vue-chart type="bar" :data="chartData"></vue-chart>
</template>

<script>
import VueChart from 'vue-chart-js'

export default {
  name: 'App',

  components: {
    VueChart
  },

  data: () => ({
    chartData: {
        labels: ['Item 1', 'Item 2', 'Item 3'],
        datasets: [
            {
                label: 'Component 1',
                data: [10, 20, 30]
            },
            {
                label: 'Component 2',
                data: [20, 30, 40]
            }
        ]
    }
  }),
}
</script>

Props

Props Description Type Required
type Chart.js type String true
data Chart.js datasets Object true
options Chart.js options Object false
width Chart width Number false
height Chart height Number false

License

Vue-Chart-Js is open-sourced software licensed under the MIT license

Support

Hello, I'm Kevin the maintainer of this project in my free time (which is getting lessen these days), if this project does help you in any way please consider to support me. Thanks ๐Ÿ˜ƒ

vue-chart-js's People

Contributors

kevinongko avatar s-oehding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vue-chart-js's Issues

How to update chart when data prop changes?

I've read through the discussions in the following issues but they did not help resolve my problem: #10, #7.

Here is an example on my issue on Code Sandbox: https://codesandbox.io/s/6w9mjky30w.

As you can see, I use buttons to change the data prop that is passed to vue-chart. The data is set to a new object if a different button is pressed, which is verified by the watcher I've set up.

If I'm passing a new data object to vue-chart, why, then, does the chart not update?

ask

how to set minimum value??

Component render 4 times

When I try to load a chart component it render 4 times always enter 4 time in the created, mounted, beforeCreate, and beforeMount

not updating after query

after i query and put the data to datasets data , i can only see the bars updated after i clicked on the labels. ,is it possible to execute the .update() from my component?

Chart not updating when data changes

When I update the data for the chart, the tooltip on the chart displays the correct data however the chart doesn't. I am using a radar chart.

Props are missing when dataset is changed

Hi! First of all, great work here.

I'm having a weird issue when I change the dataset. For some reason the property hash gets overwritten.

Do you have any idea why this is happening?

Thanks

color per chart

hello,

How can I define a color for each component of the graphic?

thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.