npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dt-easy-pie-chart

v2.1.7

Published

Lightweight plugin to render simple, animated and retina optimized pie charts

Downloads

35

Readme

easy-pie-chart

Lightweight plugin to render simple, animated and retina optimized pie charts

Version Build Status Dependencies Status Analytics

Features

  • highly customizable
  • very easy to implement
  • resolution independent (retina optimized)
  • uses requestAnimationFrame for smooth animations on modern devices and
  • works in all modern browsers, even in IE7+ with excanvas

framework support

  • Vanilla JS (no dependencies) (~872 bytes)
  • jQuery plugin (~921 bytes)
  • Angular Module (~983 bytes)

Get started

Installation

You can also use bower to install the component:

$ bower install jquery.easy-pie-chart

jQuery

To use the easy pie chart plugin you need to load the current version of jQuery (> 1.6.4) and the source of the plugin.

<div class="chart" data-percent="73" data-scale-color="#ffb400">73%</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/path/to/jquery.easy-pie-chart.js"></script>
<script>
    $(function() {
        $('.chart').easyPieChart({
            //your options goes here
        });
    });
</script>

Vanilla JS

If you don't want to use jQuery, implement the Vanilla JS version without any dependencies.

<div class="chart" data-percent="73">73%</div>

<script src="/path/to/easy-pie-chart.js"></script>
<script>
    var element = document.querySelector('.chart');
    new EasyPieChart(element, {
        // your options goes here
    });
</script>

AngularJS

<div ng-controller="chartCtrl">
    <div easypiechart options="options" percent="percent"></div>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js"></script>
<script src="../dist/angular.easypiechart.min.js"></script>
<script>
    var app = angular.module('app', ['easypiechart']);
    app.controller('chartCtrl', ['$scope', function ($scope) {
        $scope.percent = 65;
        $scope.options = {
            animate:{
                duration:0,
                enabled:false
            },
            barColor:'#2C3E50',
            scaleColor:false,
            lineWidth:20,
            lineCap:'circle'
        };
    }]);
</script>

Options

You can pass these options to the initialize function to set a custom look and feel for the plugin.

Callbacks

All callbacks will only be called if animate is not false.

Plugin api

jQuery

$(function() {
    // instantiate the plugin
    ...
    // update
    $('.chart').data('easyPieChart').update(40);
    ...
    // disable animation
    $('.chart').data('easyPieChart').disableAnimation();
    ...
    // enable animation
    $('.chart').data('easyPieChart').enableAnimation();
});

Vanilla JS

// instantiate the plugin
var chart = new EasyPieChart(element, options);
// update
chart.update(40);
// disable animation
chart.disableAnimation();
// enable animation
chart.enableAnimation();
Using a gradient
new EasyPieChart(element, {
  barColor: function(percent) {
    var ctx = this.renderer.getCtx();
    var canvas = this.renderer.getCanvas();
    var gradient = ctx.createLinearGradient(0,0,canvas.width,0);
        gradient.addColorStop(0, "#ffe57e");
        gradient.addColorStop(1, "#de5900");
    return gradient;
  }
});

AngularJS

For a value binding you need to add the percent attribute and bind it to your controller.

RequireJS

When using RequireJS you can define your own name. Examples can be found in the demo/requirejs.html.

Browser Support

Native support

  • Chrome
  • Safari
  • FireFox
  • Opera
  • Internet Explorer 9+

Support for Internet Explorer 7 and 8 with excanvas polyfill.

Test

To run the test just use the karma adapter of grunt: grunt test

Credits

Thanks to Rafal Bromirski for designing this dribble shot which inspired me building this plugin.

Copyright

Copyright (c) 2015 Robert Fleischmann, contributors. Released under the MIT, GPL licenses