Circular Pie Chart Progress Bar Plugin with jQuery Canvas - Download Circular Pie Chart & Progress Bar Plugin with jQuery and Canvas

Download Circular Pie Chart & Progress Bar Plugin with jQuery and Canvas

Posted on

This time I will share jQuery Plugin and tutorial about Circular Pie Chart & Progress Bar Plugin with jQuery and Canvas, hope it will help you in programming stack.

Circular Pie Chart Progress Bar Plugin with jQuery Canvas - Download Circular Pie Chart & Progress Bar Plugin with jQuery and Canvas
File Size: 5.29 KB
Views Total: 28677
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   



A dead simple jQuery plugin that uses HTML5 canvas to render animated, customizable, circular pie chart for representing percentage values or progress status.

How to use it:

1. Load the latest version of jQuery library and the jQuery pie chart plugin at the end of the document.

1 <script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
2 <script src="js/pie-chart.js"></script>

2. Define the percentage value using data-percent attribute.

1 <div id="example" data-percent="25">
2 </div>

3. Initialize the plugin to draw a default pie chart / progress bar on the webpage.

1 $('#example').pieChart();

4. Show the current percentage value inside the pie chart / progress bar.

1 <div id="example"  class="pie-title-center" data-percent="25">
2   <span class="pie-value"></span>
3 </div>
01 .pie-title-center {
02   display: inline-block;
03   position: relative;
04   text-align: center;
05 }
06  
07 .pie-value {
08   display: block;
09   position: absolute;
10   font-size: 14px;
11   height: 40px;
12   top: 50%;
13   left: 0;
14   right: 0;
15   margin-top: -20px;
16   line-height: 40px;
17 }

5. All configuration options with default values.

01 // bar color
02 barColor: '#ef1e25',
03  
04 // background color
05 trackColor: '#f9f9f9',
06  
07 // line width
08 lineWidth: 3,
09  
10 // chart size
11 size: 110,
12  
13 // the origin of coordinates is at the top
14 rotate: 0,
15  
16 // custom animation
17 animate: {
18   duration: 1000,
19   enabled: true
20 },
21  
22 // jquery easing function
23 easing: function (x, t, b, c, d) {
24   t = t / (d / 2);
25   if (t < 1) {
26     return c / 2 * t * t + b;
27   }
28   return -c / 2 * ((--t) * (t - 2) - 1) + b;
29 },
30  
31 // show the percent digital animate
32 onStep: function (from, to, currentValue) {
33   return;
34 },

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




source : jqueryscript.net