Giter Site home page Giter Site logo

chartjs-vue's Introduction

ChartJS-VUE

基于ChartJS的Vue单文件组件

使用方法

1、 确保项目中已经安装了chart.js 如果没有安装,请执行:

npm install chart.js --save

2、在需要引用图表的页面中使用

脚本

<script>
import chartjs from '../plugins/chartjs'

export default{
  data () {
    return {
      currentDate: '2017-05-11 12:00',
      lineData: {
        labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
        datasets: [{ }]
      },
      pieData: {
        labels: ['Red', 'Blue', 'Yellow'],
        datasets: [{ }]
      },
      barData: {
        labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
        datasets: [{ }]
      },
      radarData: {
        labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'],
        datasets: [{ }]
      },
      polarareaData: {
        datasets: [{ }],
        labels: ['Red','Green','Yellow','Grey','Blue']
      },
      bubbleData: {
        datasets: [{ }]
      },
      options: {
      }
    }
  },
  mounted () {
  },
  components: {
    chartjs
  }
}
</script>

组件标签

<chartjs :type="'line'" :data="lineData" :options="options" :height="200"></chartjs>

关于Chart.js的详细配置,请参考官方文档 或者参考此文档

该组件可直接使用官方所给出的配置来使用

截图展示

Line Chart

Bar Chart

Radar Chart

Polar Area Chart

Pie Chart

Doughnut Chart

Bubble Chart

chartjs-vue's People

Contributors

abingoal avatar turingcat0101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nyhxiaoning

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.