GithubHelp home page GithubHelp logo

hhy5277 / vue-charts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gimmyhchs/vue-charts

0.0 2.0 0.0 488 KB

Base on Vue2.0 wrapper for ChartJs.

Home Page: http://vue-charts.hchspersonal.tk/

License: MIT License

Vue 57.89% JavaScript 42.11%

vue-charts's Introduction

vue-charts Package Quality

Base on Vue2, wrapper for ChartJs.

Render a Chart Easily

  • Single Line
  • Multiple Bar
  • Multiple Mix Chart

Features

Document and Demo

Home page
Line
Bar
Horizontal Bar
Radar
Polar Area
Pie
Doughnut
DataBinding
Jsondata

NPM Package

NPM Package

Install

npm install hchs-vue-charts   

or

yarn add hchs-vue-charts  

Notice

  • vue-charts base on Vue 2
  • vue-charts base on Chart.js 2

How to use --- dist & CDN

1.build a page

    <body>
        <div id="app">
            <chartjs-line></chartjs-line>
        </div>
    </body>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.js"></script>
    <script src="js/vue-charts.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.min.js"></script>
    <script type="text/javascript">
		Vue.use(VueCharts);
        const app = new Vue({
            el: '#app',
        });
    </script>

2.Done!
dist&CDN Demo

How to use --- Laravel Elixir

1.Checkout your gulpfile.js in your laravel project

    const elixir = require('laravel-elixir');

    require('laravel-elixir-vue-2');

    /*
     |--------------------------------------------------------------------------
     | Elixir Asset Management
     |--------------------------------------------------------------------------
     |
     | Elixir provides a clean, fluent API for defining some basic Gulp tasks
     | for your Laravel application. By default, we are compiling the Sass
     | file for our application, as well as publishing vendor resources.
     |
     */

    elixir(mix => {
        mix.sass('app.scss')
           .webpack('app.js');  // we just need to require 'hchs-vue-charts' in this file or somewhere else
    });

2.open your app.js

    /**
     * First we will load all of this project's JavaScript dependencies which
     * include Vue and Vue Resource. This gives a great starting point for
     * building robust, powerful web applications using Vue and Laravel.
     */

	//By default the bootstrap file will require('vue');
    require('./bootstrap');

	// chartjs package
	require('chart.js');
    // vue-charts package
    require('hchs-vue-charts');
    Vue.use(VueCharts);


    /**
     * Next, we will create a fresh Vue application instance and attach it to
     * the page. Then, you may begin adding components to this application
     * or customize the JavaScript scaffolding to fit your unique needs.
     */

    Vue.component('example', require('./components/Example.vue'));

    const app = new Vue({
        el: '#app'
    });

3.run gulp in your laravel project

	gulp

4.modify your wellcome.blade.php or where you want to show the chart

  • give vue root id
  • add line chart component
  • don't forget your script source
	<body>
	  <div class="flex-center position-ref full-height">
		  <div id="app" class="content">
			  <!--line chart component-->
			  <chartjs-line></chartjs-line>
			  <div class="title m-b-md">
				  Laravel
			  </div>

			  <div class="links">
				  <a href="https://laravel.com/docs">Documentation</a>
				  <a href="https://laracasts.com">Laracasts</a>
				  <a href="https://laravel-news.com">News</a>
				  <a href="https://forge.laravel.com">Forge</a>
				  <a href="https://github.com/laravel/laravel">GitHub</a>
			  </div>
		  </div>
	  </div>
  	</body>
  	<!--set script src-->
  	<script src="{{asset('js/app.js')}}"></script>

5.Done

Thanks

@yeknava - Horizontal Bar

vue-charts's People

Contributors

cleitonsouza avatar gimmyhchs avatar joecampo avatar

Watchers

 avatar  avatar

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.