11angular-charts [ ![ Build Status] ( https://travis-ci.org/chinmaymk/angular-charts.svg?branch=master )] ( https://travis-ci.org/chinmaymk/angular-charts )
22==============
33
4- angular directives for common charts using d3, for more information visit
4+ angular directives for common charts using d3.
55
6- http://chinmaymk.github.io/angular-charts/
6+ Download zip - [ releases] ( https://github.com/chinmaymk/angular-charts/releases ) .
7+ Playground - [ plunkr] ( http://plnkr.co/edit/T9J7bz?p=preview ) .
78
8- ###Downloading zip from this page won't work!!!
9- We recommend downloading a copy of angular-charts from [ releases] ( https://github.com/chinmaymk/angular-charts/releases ) .
10- Releases sit on the bower branch. If you want to build from master download and run grunt
9+ ##Features
10+ 1 . One click chart change
11+ 2 . Tiny - 4.4kb minified and gzipped
12+ 3 . Auto tooltips
13+ 4 . Auto h,w dimensions updates automatically when resizing
14+ 5 . Beautiful animations
15+ 6 . Callback events
16+ 7 . Simple data format
1117
12- ###Playground
13- You can try out angular-charts on [ plunkr ] ( http://plnkr.co/edit/T9J7bz?p=preview ) .
18+ ##Installation
19+ Installation is very straight forward. Grab the latest zip from github. Copy angular-chart.min.js in your root, and refer it in your page .
1420
15- ### How to contribite
21+ ``` html
22+ <script src =' path/to/js/angular-charts.min.js' type =' text/javascript' ></script >
23+ ```
24+ Add as dependency in your module
25+
26+ ``` js
27+ angular .module (' yourApp' , [' angularCharts' ]);
28+ ```
29+ ###Dependencies
30+ 1 . angular
31+ 2 . d3
32+
33+ ###Install using bower
34+
35+ ``` js
36+ bower install angular- charts
37+ ```
38+ Refer all dependencies in your page in right order
39+
40+ ``` html
41+ <script src =' ./bower_components/angular/angular.min.js' type =' text/javascript' ></script >
42+ <script src =' ./bower_components/d3/d3.min.js' type =' text/javascript' ></script >
43+ <script src =' ./bower_components/angular-charts/dist/angular-charts.min.js' type =' text/javascript' ></script >
44+ ```
45+
46+ ##Configuration
47+ Directive syntax
48+
49+ ``` html
50+ <div ac-chart =" chartType" ac-data =" data" ac-config =" config" id =' chart' class =' chart' ></div >
51+ ```
52+ ** Note:** chartType, data and config are properties of scope. Not the actual values.
53+
54+
55+ ###ac-chart - string
56+ Allowed values - ` 'pie', 'bar', 'line', 'point', 'area' `
57+
58+ ###ac-config - object
59+ ``` js
60+ var config = {
61+ title: ' ' , // chart title
62+ tooltips: true ,
63+ labels: false , // labels on data points
64+ // exposed events
65+ mouseover : function () {},
66+ mouseout : function () {},
67+ click : function () {},
68+ // legend config
69+ legend: {
70+ display: true , // can be either 'left' or 'right'.
71+ position: ' left' ,
72+ // you can have html in series name
73+ htmlEnabled: false
74+ },
75+ // override this array if you're not happy with default colors
76+ colors: [],
77+ innerRadius: 0 , // Only on pie Charts
78+ lineLegend: ' lineEnd' , // Only on line Charts
79+ lineCurveType: ' cardinal' , // change this as per d3 guidelines to avoid smoothline
80+ isAnimate: true // run animations while rendering chart
81+ };
82+ ```
83+
84+ ###ac-data - object
85+
86+ Entire data structure looks like this
87+ ``` js
88+ var acData = {
89+ series: [
90+ " Sales" ,
91+ " Income" ,
92+ " Expense"
93+ ],
94+ data: [
95+ {
96+ " x" : " Computers" ,
97+ " y" : [
98+ 54 ,
99+ 0 ,
100+ 879
101+ ],
102+ " tooltip" : " This is a tooltip"
103+ }
104+ ]
105+ }
106+ ```
107+
108+ ** series - string array**
109+ ``` js
110+ var series = [
111+ " Sales" ,
112+ " Income" ,
113+ " Expense"
114+ ]
115+ ```
116+ ** data - object array**
117+
118+ x defines what goes on x axis, must be a string, y defines what goes on y axis, must be an array of numbers.
119+ Values are mapped to series by index. y[ 0] belongs to series[ 0] , y[ 1] belongs to series[ 1] and so on. Tooltip is optional.
120+
121+ Each data point looks like this
122+
123+ ``` js
124+ var dataPoint = {
125+ " x" : " Computers" ,
126+ " y" : [
127+ 54 ,
128+ 0 ,
129+ 879
130+ ],
131+ " tooltip" : " This is a tooltip"
132+ }
133+ ```
134+ ** Note:** series and data are arrays
135+
136+ ##Events
137+ Three events are exposed via config objects.
138+
139+ ``` js
140+ click : function (d ) {
141+ $scope .messages .push (' clicked!' );
142+ },
143+ mouseover : function (d ) {
144+ $scope .messages .push (' mouseover!' );
145+ },
146+ mouseout : function (d ) {
147+ $scope .messages .push (' mouseout!' );
148+ }
149+ ```
150+
151+ ## How to contribite
152+ Make sure all tests are passing. Thats about it.
153+
154+ ** Note** : Please don't send any PRs until you see this. I'm refactoring angular-charts.
16155
17156 git clone [email protected] :chinmaymk/angular-charts.git 18157 npm install
@@ -27,10 +166,5 @@ Thanks to all awesome [contributors](https://github.com/chinmaymk/angular-charts
27166
28167License - MIT.
29168
30- ###Collaborator instructions
31- Please make sure all tests are passing. Thats about it.
32-
33- ** Note** : Please don't send any PRs until you see this. I'm refactoring angular-charts.
34-
35- ###Got suggestions ?
169+ ##Got suggestions ?
36170Feel free to submit a pull request, file an issue, or get in touch on twitter [ @_ chinmaymk] ( https://twitter.com/_chinmaymk )
0 commit comments