This time I will share jQuery Plugin and tutorial about Customizable Pie Chart/Round Progress Bar Plugin – easy-pie-chart, hope it will help you in programming stack.
easy-pie-chart is a lightweight JavaScript/jQuery plugin to draw animated, customizable, retina-ready pie/ring charts and circular progress bars using HTML5 Canvas and requestAnimationFrame API.
How to use it:
1. Load the easy-pie-chart plugin in the document.
2 |
< script src = "dist/easypiechart.js" ></ script > |
5 |
< script src = "/path/to/cdn/jquery.min.js" ></ script > |
6 |
< script src = "dist/jquery.easypiechart.js" ></ script > |
2. Create the HTML for the easy pie chart and define the percent in the data-percent
attribute.
1 |
< span class = "chart" data-percent = "86" > |
2 |
< span class = "percent" ></ span > |
3. Initialize the plugin with default settings.
02 |
const myChart = new EasyPieChart(document.querySelector( '.chart' ), { |
08 |
$( '.chart' ).easyPieChart({ |
4. Possible options to customize the easy pie chart.
02 |
$( '.chart' ).easyPieChart({ |
04 |
trackColor: '#f9f9f9' , |
05 |
scaleColor: '#dfe0e0' , |
09 |
trackWidth: undefined, |
16 |
easing: function (x, t, b, c, d) { |
19 |
return c / 2 * t * t + b; |
21 |
return -c/2 * ((--t)*(t-2) - 1) + b; |
5. Callbacks & event handlers.
02 |
$( '.chart' ).easyPieChart({ |
03 |
onStart: function (from, to) { |
06 |
onStep: function (from, to, currentValue) { |
09 |
onStop: function (from, to) { |
6. API methods.
8 |
chart.enableAnimation(); |
This awesome jQuery plugin is developed by rendro. For more Advanced Usages, please check the demo page or visit the official website.