Code Monkey home page Code Monkey logo

laravel-chartjs-vuecomponent's Introduction

Chart.js using a Vue.js (2.x) component registered in Laravel

I struggled a bit to properly get Chart.js working inside my Laravel application. Specifically, with how to get multiple charts to mount and render properly inside Laravel's awesome blade templating system. I wanted needed the solution to be clean, organized and easy to maintain.

Lo and behold, the answer was so simple! Enter Vue.js


Getting started:

  1. First, let's make sure you have NodeJS installed.

    Install it on your OS of choice

  2. Next, check to make sure node and npm installed properly

    npm --version

    node --version

  3. Next, install Vue.js in your application directoy

    npm install vue

  4. Finally, install the amazing wrapper package

    npm install vue-chartjs chart.js --save


Usage

  1. Place the ExampleChart.vue into your resources/assets/js/components folder in your Laravel application.

  2. Make sure it is registered in your resources/assets/js/app.js file.

    Vue.component('example-chart', require('./components/ExampleChart.vue'));

As always, run npm run dev or npm run watch to compile your assets.

Then, just plug your component into any blade file you want!

<example-chart></example-chart>

laravel-chartjs-vuecomponent's People

Contributors

fullstackofpancakes84 avatar

Watchers

James Cloos 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.