angular chart example

HTML

<div class="angular" ng-controller="chartCtrl">
                <span class="chart" easypiechart ng-init="options = { animate:false, barColor:'#E67E22', scaleColor:false, lineWidth:3, lineCap:'butt' }" percent="percent" options="options">
                        <span class="percent" ng-bind="percent"></span>
                </span>
                <input type="range" min="-100" max="100" step="1" ng-model="percent" />
                <span class="chart" easypiechart percent="anotherPercent" options="anotherOptions">
                        <span class="percent" ng-bind="percent"></span>
                </span>
                <input type="range" min="-100" max="100" step="1" ng-model="anotherPercent" />
        </div>

CSS

html {
  padding: 0;
  margin: 0;
}
body {
  text-align: center;
  padding: 0;
  margin: 0;
  font: 18px / 1.4 'Arial', 'Helvetica', sans-serif;
}
body {
  padding-top: 60px;
}
ul {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0;
  height: 60px;
  background: #2c3e50;
  font-size: 0;
  line-height: 0;
  letter-spacing: -0.3em;
}
li {
  position: relative;
  display: inline-block;
  vertical-align: top;
  width: 33.333333333333336%;
  text-align: center;
  font-size: 18px;
  line-height: 60px;
  letter-spacing: normal;
}
li a {
  display: block;
  color: #ecf0f1;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  -webkit-transition: all 0.5s ease-in-out;
  transition: all 0.5s ease-in-out;
}
li a:hover,
li a.active {
  background: #e67e22;
  color: #2c3e50;
}
li a.active:after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -10px;
  border: 10px solid;
  border-color: transparent;
  border-top-color: #e67e22;
}
.chart {
  position: relative;
  display: inline-block;
  width: 110px;
  height: 110px;
  margin-top: 50px;
  margin-bottom: 50px;
  text-align: center;
}
.chart canvas {
  position: absolute;
  top: 0;
  left: 0;
}
.percent {
  display: inline-block;
  line-height: 110px;
  z-index: 2;
}
.percent:after {
  content: '%';
  margin-left: 0.1em;
  font-size: .8em;
}
.angular {
  margin-top: 100px;
}
.angular .chart {
  margin-top: 0;
}
input {
  display: block;
  margin: auto;
  margin-bottom: 3em;
}
.btn {
  display: block;
  width: 200px;
  margin: 0 auto;
  padding: 10px 20px;
  background: #2c3e50;
  color: #ecf0f1;
  text-transform: uppercase;
  cursor: pointer;
  font-size: 0.8em;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-transition: all 0.5s ease-in-out;
  transition: all 0.5s ease-in-out;
}
.btn:hover {
  background: #e67e22;
  color: #2c3e50;
}
@media only screen and (max-width: 600px) {
  li {
    font-size: 14.4px;
  }
}
@media only...

JavaScript

/**!
 * easyPieChart
 * Lightweight plugin to render simple, animated and retina optimized pie charts
 *
 * @license Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * @author Robert Fleischmann <[email protected]> (http://robert-fleischmann.de)
 * @version 2.1.3
 **/

(function(root, factory) {
    if(typeof exports === 'object') {
        module.exports = factory(require('anuglar'));
    }
    else if(typeof define === 'function' && define.amd) {
        define('EasyPieChart', ['anuglar'], factory);
    }
    else {
        factory(root.anuglar);
    }
}(this, function(anuglar) {
// Angular directives for easyPieChart
if ((typeof(angular) === 'object') && (typeof(angular.version) === 'object')) {
	angular.module('easypiechart',[])
	.directive('easypiechart', ['$timeout', function($timeout) {
        alert('alive');
		return {
			restrict: 'A',
			require: '?ngModel',
			scope: {
				percent: '=',
				options: '='
			},
			link: function (scope, element, attrs) {
				var options = {
					barColor: '#ef1e25',
					trackColor: '#f9f9f9',
					scaleColor: '#dfe0e0',
					scaleLength: 5,
					lineCap: 'round',
					lineWidth: 3,
					size: 110,
					rotate: 0,
					animate: {
						duration: 1000,
						enabled: true
					}
				};
				angular.extend(options, scope.options);

				var pieChart = new EasyPieChart(element[0], options);

				// initial pie rendering
				if (scope.percent) {
					pieChart.update(scope.percent);
				}

				// on change of value
				var timer = null;
				scope.$watch('percent', function(oldVal, newVal) {
					pieChart.update(newVal);

					// this is needed or the last value won't be updated
					if(timer) {
						$timeout.cancel(timer);
					}
					timer = $timeout(function() {
						pieChart.update(scope.percent);
					}, 1000 / 60);
				});
			}
		};
	}]);
} else{
	console.log('Angular not detected.');
}

/**
 * Renderer to render the...