@@ -7,14 +7,37 @@ Use this AngularJS charts plugin to add interactive charts to your web and mobil
7
7
8
8
You can access all the rich charting features like events, annotations, macros, themes, image-export etc. to make your visualizations stand-out.
9
9
10
+ ### Installation
11
+
12
+
13
+ Install fusioncharts library
14
+ ``` bash
15
+ $ npm install fusioncharts --save
16
+ ```
17
+ Alternatively you can use downloaded fusioncharts files.
18
+
19
+
20
+ Install angular 1.x.x
21
+ ``` bash
22
+ # Any angular 1.x version is compatible
23
+ $ npm install
[email protected] --save
24
+ ```
25
+
26
+ Install angularjs-fusioncharts module
27
+ ``` bash
28
+ $ npm install angularjs-fusioncharts --save
29
+ ```
30
+ Alternatively you can use downloaded angularjs-fusioncharts wrapper.
31
+
32
+
10
33
### Demos
11
34
To learn what you can do using this Angular charts plugin, explore some [ live demos] ( http://www.fusioncharts.com/angularjs-charts/ ) .
12
35
13
36
### Usage
14
37
#### Step 1: Include angularjs-fusioncharts.js and fusioncharts
15
38
In your index.html
16
39
``` xml
17
- <script type =" text/javascript" src =" /path/to /fusioncharts.js" ></script >
40
+ <script type =" text/javascript" src =" node_modules/fusioncharts /fusioncharts.js" ></script >
18
41
<script type =" text/javascript" src =" /path/to/angular.js" ></script >
19
42
<script type =" text/javascript" src =" /path/to/angularjs-fusioncharts.js" ></script >
20
43
```
@@ -72,6 +95,80 @@ app.controller('MyController', function($scope){
72
95
```
73
96
And your chart should display when you load the page.
74
97
98
+ ### Using ` require() ` syntax
99
+ In script.js
100
+ ``` javascript
101
+ // Require AngularJS
102
+ var angular = require (' angular' );
103
+
104
+ // Require FusionCharts
105
+ var FusionCharts = require (' fusioncharts' );
106
+
107
+ // Include angularjs-fusioncharts
108
+ require (' angular-fusioncharts' );
109
+
110
+ // Require Chart modules
111
+ var Charts = require (' fusioncharts/fusioncharts.charts' );
112
+
113
+ // Initialize Charts with FusionCharts instance
114
+ Charts (FusionCharts);
115
+
116
+ var app = angular .module (' myApp' , [ ' ng-fusioncharts' ]);
117
+
118
+ app .controller (' MyController' , [' $scope' , function ($scope ) {
119
+ $scope .dataSource = {
120
+ " chart" : {
121
+ " caption" : " Countries With Most Oil Reserves [2017-18]" ,
122
+ " subCaption" : " In MMbbl = One Million barrels" ,
123
+ " xAxisName" : " Country" ,
124
+ " yAxisName" : " Reserves (MMbbl)" ,
125
+ " numberSuffix" : " K" ,
126
+ " theme" : " fusion"
127
+ },
128
+ " data" : [
129
+ { " label" : " Venezuela" , " value" : " 290" },
130
+ { " label" : " Saudi" , " value" : " 260" },
131
+ { " label" : " Canada" , " value" : " 180" },
132
+ { " label" : " Iran" , " value" : " 140" },
133
+ { " label" : " Russia" , " value" : " 115" },
134
+ { " label" : " UAE" , " value" : " 100" },
135
+ { " label" : " US" , " value" : " 30" },
136
+ { " label" : " China" , " value" : " 30" }
137
+ ]
138
+ };
139
+ }]);
140
+ ```
141
+ Use a bundler like ` browserify ` to bundle the script
142
+ See the installation docs [ here] ( http://browserify.org/ )
143
+
144
+ ``` bash
145
+ $ browserify script.js -o bundle.js
146
+ ```
147
+ In ` index.html `
148
+ ``` xml
149
+ <html >
150
+ <head >
151
+
152
+ <!-- Include compiled bundle in script tag -->
153
+ <script type =" text/javascript" src =" ./bundle.js" ></script >
154
+ </head >
155
+
156
+ <body ng-app =" myApp" >
157
+ <div ng-controller =" MyController" >
158
+ <div
159
+ fusioncharts
160
+ width =" 600"
161
+ height =" 400"
162
+ type =" column2d"
163
+ datasource =" {{myDataSource}}" >
164
+ </div >
165
+ </div >
166
+ </body >
167
+ </html >
168
+
169
+
170
+ ```
171
+ Load it in browser , Chart should get displayed
75
172
76
173
### Tutorial
77
174
0 commit comments