@@ -24,12 +24,24 @@ import { AppComponent } from './app.component';
2424import { FusionChartsModule } from ' angular-fusioncharts' ;
2525
2626// Import FusionCharts library and chart modules
27- import FusionCharts from ' fusioncharts/core' ;
28- import Column2d from ' fusioncharts/viz/column2d' ;
29- import FusionTheme from ' fusioncharts/themes/es/fusioncharts.theme.fusion' ;
27+ import * as FusionCharts from ' fusioncharts' ;
28+ import * as Charts from ' fusioncharts/fusioncharts.charts' ;
29+
30+ // For Powercharts , Widgets, and Maps
31+ // import * as PowerCharts from 'fusioncharts/fusioncharts.powercharts';
32+ // import * as Widgets from 'fusioncharts/fusioncharts.widgets';
33+ // import * as Maps from 'fusioncharts/fusioncharts.maps';
34+ // To know more about suites,
35+ // read this https://www.fusioncharts.com/dev/getting-started/plain-javascript/install-using-plain-javascript
36+
37+
38+ // For Map definition files
39+ // import * as World from 'fusioncharts/maps/fusioncharts.world';
40+
41+ import * as FusionTheme from ' fusioncharts/themes/fusioncharts.theme.fusion' ;
3042
3143// Pass the fusioncharts library and chart modules
32- FusionChartsModule .fcRoot (FusionCharts , Column2d , FusionTheme );
44+ FusionChartsModule .fcRoot (FusionCharts , Charts , FusionTheme );
3345
3446@NgModule ({
3547 declarations: [
@@ -45,9 +57,6 @@ FusionChartsModule.fcRoot(FusionCharts, Column2d, FusionTheme);
4557})
4658export class AppModule { }
4759```
48- NOTE : If you are using angular 2, please refer [ Rendering chart in Angular 2] ( #Rendering-chart-in-Angular-2 )
49-
50-
5160Once the library is imported, you can use its components, directives in your Angular application:
5261
5362In your Angular AppComponent:
@@ -113,7 +122,7 @@ Usage in template :
113122 width =" 600"
114123 height =" 350"
115124 type =" Column2D"
116- dataFormat =" JSON "
125+ dataFormat =" json "
117126 [dataSource]=" dataSource"
118127 (dataplotRollOver)=" plotRollOver($event)" >
119128</fusioncharts >
@@ -192,43 +201,15 @@ export class AppComponent {
192201 }
193202
194203 initialized($event ){
195- this .chart = $event .chart ;
204+ this .chart = $event .chart ; // Storing the chart instance
196205 }
197206
198207 changeLabel(){
199208 this .chart .setChartAttribute (' caption' , ' Changed caption' );
200209 }
201210
202211}
203- ```
204-
205- ## Rendering chart in Angular 2
206- For angular version 2.x.x , we cannot use ` 'fusioncharts/core' ` as it uses dynamic imports , which is not compatible with older version typescripts used by Angular 2.
207- To render a chart, we need to use the older way,
208-
209- ``` ts
210- import { BrowserModule } from ' @angular/platform-browser' ;
211- import { NgModule } from ' @angular/core' ;
212-
213- import { AppComponent } from ' ./app.component' ;
214-
215- // Import angular-fusioncharts
216- import { FusionChartsModule } from ' angular-fusioncharts' ;
217-
218- // Import FusionCharts library and chart modules
219- import * as FusionCharts from ' fusioncharts' ; // Change fusioncharts/core to fusioncharts and use `* as` syntax
220- import * as Charts from ' fusioncharts/fusioncharts.charts' ; // Contains all the charts under FusionCharts XT , Read below for details
221-
222- import * as FusionTheme from ' fusioncharts/themes/fusioncharts.theme.fusion' ;
223-
224- // Pass the fusioncharts library and chart modules
225- FusionChartsModule .fcRoot (FusionCharts , Charts , FusionTheme );
226-
227- ```
228- Note: All other code for the component and template remain same as above.
229212
230- We have used ` fusioncharts/fusioncharts.charts ` file to use all the charts which come under FusionCharts XT.
231- To know more about other charts and widgets, read this [ link] ( https://www.fusioncharts.com/dev/getting-started/plain-javascript/install-using-plain-javascript )
232213
233214## Development
234215
0 commit comments