11# angular-fusioncharts
22
3- ## Installation
3+ A simple and lightweight official Angular component for FusionCharts JavaScript charting library. angular-fusioncharts enables you to add JavaScript charts in your Angular application without any hassle.
4+
5+ ## [ Demo] ( https://fusioncharts.github.io/angular-fusioncharts/ )
6+
7+ - Github Repo: [ https://github.com/fusioncharts/angular-fusioncharts ] ( https://github.com/fusioncharts/angular-fusioncharts )
8+ - Documentation: [ https://www.fusioncharts.com/dev/getting-started/angular/angular/your-first-chart-using-angular ] ( https://www.fusioncharts.com/dev/getting-started/angular/angular/your-first-chart-using-angular )
9+ - Support: [ https://www.fusioncharts.com/contact-support ] ( https://www.fusioncharts.com/contact-support )
10+ - FusionCharts
11+ - Official Website: [ https://www.fusioncharts.com/ ] ( https://www.fusioncharts.com/ )
12+ - Official NPM Package: [ https://www.npmjs.com/package/fusioncharts ] ( https://www.npmjs.com/package/fusioncharts )
13+ - Issues: [ https://github.com/fusioncharts/angular-fusioncharts/issues ] ( https://github.com/fusioncharts/angular-fusioncharts/issues )
14+
15+ ---
16+
17+ ## Table of Contents
18+
19+ - [ Getting Started] ( #getting-started )
20+ - [ Requirements] ( #requirements )
21+ - [ Installation] ( #installation )
22+ - [ Working with chart API] ( #working-with-apis )
23+ - [ Working with events] ( #working-with-events )
24+ - [ Quick Start] ( #quick-start )
25+ - [ Going Beyond Charts] ( #going-beyond-charts )
26+ - [ For Contributors] ( #for-contributors )
27+ - [ Licensing] ( #licensing )
28+
29+ ## Getting Started
30+
31+ ### Requirements
32+
33+ - ** Node.js** , ** NPM/Yarn** installed globally in your OS.
34+ - You've an ** Angular** Application.
35+ - ** FusionCharts** installed in your project, as detailed below:
36+
37+ ### Installation
438
539To install ` angular-fusioncharts ` library, run:
640
@@ -9,10 +43,16 @@ $ npm install angular-fusioncharts --save
943```
1044
1145To install ` fusioncharts ` library:
46+
1247``` bash
1348$ npm install fusioncharts --save
1449```
15- And then in your Angular ` AppModule ` :
50+
51+ ## Quick Start
52+
53+ Here is a basic sample that shows how to create a chart using ` angular-fusioncharts ` :
54+
55+ Add this in your Angular ` AppModule ` :
1656
1757``` typescript
1858import { BrowserModule } from ' @angular/platform-browser' ;
@@ -34,7 +74,6 @@ import * as Charts from 'fusioncharts/fusioncharts.charts';
3474// To know more about suites,
3575// read this https://www.fusioncharts.com/dev/getting-started/plain-javascript/install-using-plain-javascript
3676
37-
3877// For Map definition files
3978// import * as World from 'fusioncharts/maps/fusioncharts.world';
4079
@@ -44,9 +83,7 @@ import * as FusionTheme from 'fusioncharts/themes/fusioncharts.theme.fusion';
4483FusionChartsModule .fcRoot (FusionCharts , Charts , FusionTheme );
4584
4685@NgModule ({
47- declarations: [
48- AppComponent
49- ],
86+ declarations: [AppComponent ],
5087 imports: [
5188 BrowserModule ,
5289 // Specify FusionChartsModule as import
@@ -55,14 +92,15 @@ FusionChartsModule.fcRoot(FusionCharts, Charts, FusionTheme);
5592 providers: [],
5693 bootstrap: [AppComponent ]
5794})
58- export class AppModule { }
95+ export class AppModule {}
5996```
97+
6098Once the library is imported, you can use its components, directives in your Angular application:
6199
62100In your Angular AppComponent:
63101
64102``` javascript
65- import {Component } from ' @angular/core' ;
103+ import { Component } from ' @angular/core' ;
66104
67105@Component ({
68106 selector: ' my-app' ,
@@ -73,33 +111,32 @@ export class AppComponent {
73111 title: string;
74112
75113 constructor () {
76- this .title = " Angular FusionCharts Sample" ;
114+ this .title = ' Angular FusionCharts Sample' ;
77115
78116 this .dataSource = {
79- " chart" : {
80- " caption" : " Countries With Most Oil Reserves [2017-18]" ,
81- " subCaption" : " In MMbbl = One Million barrels" ,
82- " xAxisName" : " Country" ,
83- " yAxisName" : " Reserves (MMbbl)" ,
84- " numberSuffix" : " K " ,
85- " theme" : " fusion" ,
117+ chart: {
118+ caption: ' Countries With Most Oil Reserves [2017-18]' ,
119+ subCaption: ' In MMbbl = One Million barrels' ,
120+ xAxisName: ' Country' ,
121+ yAxisName: ' Reserves (MMbbl)' ,
122+ numberSuffix: ' K ' ,
123+ theme: ' fusion'
86124 },
87- " data" : [
88- { " label" : " Venezuela" , " value" : " 290" },
89- { " label" : " Saudi" , " value" : " 260" },
90- { " label" : " Canada" , " value" : " 180" },
91- { " label" : " Iran" , " value" : " 140" },
92- { " label" : " Russia" , " value" : " 115" },
93- { " label" : " UAE" , " value" : " 100" },
94- { " label" : " US " , " value" : " 30 " },
95- { " label" : " China" , " value" : " 30 " }
125+ data: [
126+ { label: ' Venezuela' , value: ' 290' },
127+ { label: ' Saudi' , value: ' 260' },
128+ { label: ' Canada' , value: ' 180' },
129+ { label: ' Iran' , value: ' 140' },
130+ { label: ' Russia' , value: ' 115' },
131+ { label: ' UAE' , value: ' 100' },
132+ { label: ' US ' , value: ' 30 ' },
133+ { label: ' China' , value: ' 30 ' }
96134 ]
97135 };
98136 }
99137}
100138```
101139
102-
103140``` xml
104141<!-- You can now use fusioncharts component in app.component.html -->
105142<h1 >
@@ -114,9 +151,11 @@ export class AppComponent {
114151></fusioncharts >
115152```
116153
117- ## Listening to events
154+ ## Working with Events
155+
118156Fusincharts events can be subscribed from component's output params.
119157Usage in template :
158+
120159``` xml
121160<fusioncharts
122161 width =" 600"
@@ -127,8 +166,10 @@ Usage in template :
127166 (dataplotRollOver)=" plotRollOver($event)" >
128167</fusioncharts >
129168```
169+
130170And in component's code , ` $event ` will be an object ` { eventObj : {...}, dataObj: {...} } `
131171For more on this read [ here] ( https://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-events )
172+
132173``` js
133174import {Component } from ' @angular/core' ;
134175
@@ -157,14 +198,16 @@ export class AppComponent {
157198
158199}
159200```
201+
160202Get the list of fusioncharts' [ events] ( https://www.fusioncharts.com/dev/advanced-chart-configurations/events/classifying-events )
161203
204+ ## Working with APIs
162205
163- ## Chart API
164206Using api of charts involves getting the FusionCharts chart instance from the ` initialized ` event.
165- It emits chart object which can be operated upon later.
166-
207+ It emits chart object which can be operated upon later.
208+
167209In template, we add ` initialized ` event
210+
168211``` xml
169212<fusioncharts
170213 type =" column2d"
@@ -177,7 +220,7 @@ In template, we add `initialized` event
177220<button (click)=" changeLabel()" >Change label</button >
178221```
179222
180- And in component's code , we get ` $event ` as ` { chart : ChartInstance } `
223+ And in component's code , we get ` $event ` as ` { chart : ChartInstance } `
181224
182225So in order to use the chart instance , we need to store the chart instance.
183226
@@ -210,18 +253,24 @@ export class AppComponent {
210253
211254}
212255
256+ ```
213257
214- ## Development
258+ ## For Contributors
215259
216- To generate all ` *.js ` , ` *.js.map ` and ` *.d.ts ` files :
260+ - Clone the repository and install dependencies
217261
218- ` ` ` bash
219- $ npm run tsc
262+ ```
263+ $ git clone https://github.com/fusioncharts/angular-fusioncharts.git
264+ $ cd angular-component
265+ $ npm i
266+ $ npm start
220267```
221268
222- To lint all ` *.ts ` files :
269+ ## Going Beyond Charts
223270
224- ` ` ` bash
225- $ npm run lint
226- ` ` `
227- ### [Demos and Documentation ](http :// fusioncharts.github.io/angular-fusioncharts/)
271+ - Explore 20+ pre-built business specific dashboards for different industries like energy and manufacturing to business functions like sales, marketing and operations [ here] ( https://www.fusioncharts.com/explore/dashboards ) .
272+ - See [ Data Stories] ( https://www.fusioncharts.com/explore/data-stories ) built using FusionCharts’ interactive JavaScript visualizations and learn how to communicate real-world narratives through underlying data to tell compelling stories.
273+
274+ ## Licensing
275+
276+ The FusionCharts React component is open-source and distributed under the terms of the MIT/X11 License. However, you will need to download and include FusionCharts library in your page separately, which has a [ separate license] ( https://www.fusioncharts.com/buy ) .
0 commit comments