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

angular-chartjs

v0.0.5

Published

Angular bindings for the HTML5 Canvas Chart library-- Chart.js

Downloads

652

Readme

angular-chartjs

Build Status Coverage NPM Downloads NPM Version Github Issues

A fully functional directive set for the ChartJS library. Supports data bindings and attribute-level specification for chart specific options.

Installation

Using Bower
bower install ng-chartjs
Using NPM
npm install angular-chartjs
Setup
<!--
Include Angular ~1.2.21
Include Chart.js >= v1.0.1-beta.3
-->
<script type="text/javascript" src="bower_components/ng-chartjs/src/angular-chartjs.js"></script>

and in your app init...

var app = angular.module('myApp', ['chartjs']);

Usage

There is a directive for each of the 6 chart types in ChartJS. Data is set on the $scope in the controller and the options can be passed in via the controller and / or overridden on the directive call.

In the template...

<div ng-controller="testCtrl">
	<cjs-doughnut dataset="someData" options="someOptions" segement-stroke-width="5"></cjs-doughnut>

	<!--
	<cjs-bar></cjs-bar>
	<cjs-line></cjs-line>
	<cjs-radar></cjs-radar>
	<cjs-polar></cjs-polar>
	<cjs-pie></cjs-pie>
	-->
</div>

In the controller...

myapp.controller('testCtrl', function ($scope) {
	$scope.someData = [
		labels: [
        'Apr', 
        'May', 
        'Jun'
      ],
      datasets: [
        {
          data: [1, 7, 15, 19, 31, 40]
        },
        {
          data: [6, 12, 18, 24, 30, 36]
        }
      ]
	];

	$scope.someOptions = {
		segementStrokeWidth: 20,
		segmentStrokeColor: '#000'
	};
});

This will result in a Doughnut chart using the dataset from the controller with a StrokeColor of #000 and a StrokeWidth of 5 because options set on the directive attributes override controller level settings for maximum flexibility.

Examples

If you want to see an example for every chart, download the library and go to the test/app directory. Launch index.html in a browser and all of the charts will load. You will find the test controller in the test/app/js directory.

All charts and options work. No actual JS (beyond the dataset) is required to use this directive set unless you want to bulk specify many options, in which case it's better to do that in the controller.

You can also run this example online through the following plunker: http://embed.plnkr.co/pC7gJ7/preview

Tests

gulp test

Demo

Open a browser pointed at demo/index.html