Graph.js is an interactive and customizable jQuery plugin that takes advantage of HTML5 SVG to create linear, area, bar, combo, pie, and donut graphs with support for multiple data sets.
Features:
- jQuery plugin.
- Linear, area, bar, combo, pie, and donut graphs, as well as tables,
- Legend keys for multiple datasets and pie and donut graphs (simple legend keys for individual datasets),
- Supports multiple data sets,
- Full grids, vertical and horizontal grids, no grids…,
supports interaction, - Lightweight,
- Graphs can be changed from one type to another (including tables): graph.to (“linear”);
- easy to use,
- Every inch is customizable,
- animation
How to make use of it:
1. Create an empty container(ID) to place your SVG graphic.
<div id="graph"></div>
2. Include the latest version of the jQuery library.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="graph.js"></script>
3. Create the data in javascript and initialize the graph.
<script> $(function(){ $('#graph').graphify({ start: 'combo', // //type of graph to start with obj: { id: 'ggg', width: 775, height: 375, xGrid: false, // False will remove vertical grid lines legend: true, // Show a legend? title: 'Linux vs Mac', points: [ [7, 26, 33, 74, 12, 49, 33], [32, 46, 75, 38, 62, 20, 52] ], pointRadius: 3, colors: ['blue', 'red'], xDist: 90, // Horizontal distance between vertical grid lines (Makes graph wider) dataNames: ['Linux', 'Mac'], xName: 'Day', // Name of X-Axis tooltipWidth: 15, animations: true, pointAnimation: true, averagePointRadius: 10, design: { tooltipColor: '#fff', gridColor: 'grey', tooltipBoxColor: 'green', averageLineColor: 'green', pointColor: 'green', lineStrokeColor: 'grey', } } }); }); </script>
4. More options with default values.
xDist: 60, yDist: 30, scale: 10, //leave space for labels: xOffset: 25, yOffset: 20, yStart: 0, // what number do we want to start from for y labels mainOffset: 35, //to seperate everything from the ylabels padding: 10, //keep labels from touching edges //single points xOfPoints: [], //get x and y coordinates of points yOfPoints: [], //multiple points mxOfPoints: [], myOfPoints: [], multipleDataSets: false, legend: false, interactive: true, animations: false, animationDuration: 1, pointAnimation: true, lineAnimation: true, barAnimation: true, pieAnimation: true, grid: true, xGrid: true, yGrid: true, xName: null, yName: null, special: null, showPoints: true, noLines: false, pointRadius: 5, averagePointRadius: 5, pieSize: 200, tooltipWidth: 50, pieLegend: true, rx: 10, //tooltip roundedness //add some html before append before: '', //after append: after: '', title: '', //title of graph to be written in SVG
See Demo And Download
Official Website(uriahsanders): Click Here
This superior jQuery/javascript plugin is developed by uriahsanders. For extra Advanced Usage, please go to the official website.