jQuery Plugin To Draw Animated Gauges using Canvas 2D API

File Size: 10.6 KB
Views Total: 15585
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Draw Animated Gauges using Canvas 2D API

A lightweight and easy-to-use jQuery plugin to draw animated circular/half-circular gauges using Html5 canvas 2D drawing API.

See also:

How to use it:

1. Load the latest version of jQuery library and the jQuery gauge plugin in your project.

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="src/jquery.gauge.js"></script>

2. Create an Html5 canvas element on where you wish to draw a gauge.

<canvas id="demo" width="300" height="300"></canvas>

3. Call the function on the canvas element and set the initial value.

$("#demo").gauge(50);

4. Customize the gauge by overriding the default options listed below during initialization.

// $fn.gauge(value, options);

$("#demo").gauge(50, {


// Minimum value to display
min: 0,

// Maximum value to display
max: 100,

// Unit to be displayed after the value
unit: "%",

// color for the value and bar
color: "lightgreen",
colorAlpha: 1,

// background color of the bar
bgcolor: "#222",

// default or halfcircle
type: "default"

});

This awesome jQuery plugin is developed by swehacker. For more Advanced Usages, please check the demo page or visit the official website.