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

@leantechniques/pie-chart

v1.1.0

Published

Yummy pies and donuts for [AngularJS](http://angularjs.org/) applications. Built on top of the wonderful [D3.js](http://d3js.org/) library.

Downloads

91

Readme

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

  • Copy pie-chart.min.js wherever you want
  • Reference it in your index.html file
  • Reference the module in your app file : angular.module('myApp', [ 'n3-pie-chart' ])

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"}
];
  • complementBrightness : optional (disabled by default). Expects a number between 0 and 100. If set, it will take the color of the chart, increase the brightness by a given percentage and use the new color for the complement.
  • colorComplement : optional (default is "white"). Defines the color of the complement. Will be ignored if complementBrightness is set.

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};
  • thickness : optional (default is 10). Defines the chart's thickness and has an impact on the legend display (thicker chart means less space for legend).
Gauge
$scope.gauge_options = {thickness: 5, mode: "gauge", total: 100};
  • thickness : optional (default is 10). Defines the chart's thickness and has an impact on the legend display (thicker chart means less space for legend).
  • mode : optional (default is ""). Can be "gauge" or anything else (but anything else will default to standard pie/donut mode). "gauge" only works when there is exactly one data row in the chart's data attribute.
  • total : optional (default is 100). Ignored if mode is not "gauge". Make the chart able to display the data relatively to a maximum (for instance, if you want to display a percentage, the maximum should be 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.