Home

Awesome

n3-charts.pie-chart Build Status

Yummy pies and donuts for AngularJS applications. Built on top of the wonderful D3.js library.

Here is a demo page.

How to install

How to use

A pie chart is called using this syntax :

<pie-chart data="data" options="options"></pie-chart>

The pie chart directives needs two attributes : data and options. If one is missing, nothing happens.

Data

Your data must be an array. Depending whether you wan a pie/donut or a gauge, the array can contain at least two rows, or only one.

Standard
$scope.data = [
  {label: "one", value: 12.2, color: "red"}, 
  {label: "two", value: 45, color: "#00ff00"},
  {label: "three", value: 10, color: "rgb(0, 0, 255)"}
];
Gauge
$scope.gauge_data = [
  {label: "CPU", value: 75, suffix: "%", color: "steelblue"}
];

Options

Options must be an object. Depending whether you want a pie/donut or a gauge, additional settings can be required.

Standard
$scope.options = {thickness: 10};
Gauge
$scope.gauge_options = {thickness: 5, mode: "gauge", total: 100};

Building

Fetch the repo :

$ git clone https://github.com/angular-d3/pie-chart.git

Install stuff :

$ npm install

Install moar stuff :

$ bower install

Install teh uterz stuff :

$ grunt

Hack.

Testing

AngularJS is designed to be testable, and so is this project. It has a good coverage rate (between 85% and 95%), and we want to keep it this way.