Animated Donut/Pie/Ring Charts With jQuery And SVG - Donutty

Animated Donut/Pie/Ring Charts With jQuery And SVG - Donutty
File Size: 40.1 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Donutty is a JavaScript/jQuery charting library which lets you generate smoothly animated, fully scalable Donut/Pie/Ring Charts or Circular/Radial progressbars using SVG and CSS3 animations.

Also comes with a vanilla JavaScript version which allows you to implement the charting library without any 3rd dependencies.

How to use it (jQuery Version):

1. Load the latest jQuery (slim build) and the JavaScript file 'donutty-jquery.js' in the document.

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" 
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 
        crossorigin="anonymous"></script>
<script src="dist/donutty-jquery.js"></script>

2. To create a default chart, just add the 'data-donutty' attribute to the placeholder element and done.

<div data-donutty></div>

3. Or call the function on the placeholder element:

const myChart = $("#example").donutty({
      // options here
});

4. Customize the chart via data-OPTION attributes or by passing the options to the donutty() method as follows:

<div data-donutty 
     data-radius=20 
     data-thickness=40 
     data-padding=0 
     data-round=false 
     data-color="lightcoral" 
     data-value=80
     ...>
</div>
// or
const myChart = $("#example").donutty({
      min: -100, 
      max: 100, 
      value: 50
});

5. All default configuration options.

const myChart = $("#example").donutty({

      // min/max values
      min: 0,
      max: 100,

      // current value
      value: 50,

      // rounded edges or not
      round: true,

      // complete circle or not
      circle: true,

      // padding in pixels
      padding: 4,

      // radius in pixels
      radius: 50,

      // thickness in pixels
      thickness: 10,

      // background color
      bg: "rgba(70, 130, 180, 0.15)",

      // bar color
      color: "mediumslateblue",

      // transition effect
      transition: "all 1.2s cubic-bezier(0.57, 0.13, 0.18, 0.98)"
      
});

6. Update the options/values/stats of the chart.

// min, max, value
myChart.set( "value", 60 )

// min, max, value, bg, color, etc
myChart.setState({ 
  options here
})

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