Giter Club home page Giter Club logo

chartjs_mvc's Introduction

ChartJS_MVC

Boilerplate for MVC app dashboard using Chart.js.

Dependencies

Script

  1. Add the following scripts to the <head> tag:
  • Chart.js <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js" type="text/javascript"></script>
  • D3.js <script type="text/javascript" src="//d3js.org/d3.v3.min.js"></script>
  • Cal-HeatMap (Calendar heatmap)
<script type="text/javascript" src="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.min.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.css" />

Styling

  1. Add in a chart into an MVC view's <body> tag with the canvas and script elements using this method.

  2. Bootstrap helps to display the components in rows. The following styling helps to space the charts from each other and stretch their height to each chart container:

    <div class="row">
        <div class="col-xl-8 col-md-12"  style="padding: 0px 20px 20px 20px;">
            <div class="card card-default" style="height:100%;">
                <div class="card-body">
                    <div class="chart-container">
                        <canvas id="mixed-chart"></canvas>
                        <script>
                        ...

Adding Charts

If you want to add new charts, replace the <canvas> and <script> tags with charts from chartsjs.org or using Tobias Ahlin's blog to experiment with different chart samples.

TODO

  • Move everything in <script> tag to seperate .js file.
  • Move inline styling to seperate .css file
  • Add inline mock data for calendar heatmap
  • Add Models for charts and bind datasets to these

chartjs_mvc's People

Watchers

James Cloos avatar Luyanda Mncube 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.