Skip to content

Commit ef4fc28

Browse files
committed
Built for : fusioncharts.component
1 parent 3cf9609 commit ef4fc28

File tree

5 files changed

+26
-43
lines changed

5 files changed

+26
-43
lines changed

dist/README.md

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,24 @@ import { AppComponent } from './app.component';
2424
import { 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
})
4658
export 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-
5160
Once the library is imported, you can use its components, directives in your Angular application:
5261

5362
In 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

dist/dist/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ var FusionChartsComponent = /** @class */ (function () {
504504
return events;
505505
};
506506
FusionChartsComponent.prototype.ngAfterViewInit = function () {
507+
var _this_1 = this;
507508
var _this = this, params = _this.constructerParams, configObj = _this.configObj || (_this.configObj = {});
508509
var _chartConfig = _this.chartConfig || {};
509510
if (typeof _chartConfig === 'string') {
@@ -524,12 +525,12 @@ var FusionChartsComponent = /** @class */ (function () {
524525
else {
525526
configObj['events'] = Object.assign(events, configObj['events']);
526527
}
527-
_this.chartObj = FusionChartsConstructor(_this.fusionchartsService, configObj);
528-
this.initialized.emit({ chart: _this.chartObj });
529528
// configObj['renderAt'] = 'container-' + _this.chartObj.id;
530529
// _this.containerId = _this.chartObj.id;
531530
this.zone.runOutsideAngular(function () {
532531
setTimeout(function () {
532+
_this.chartObj = FusionChartsConstructor(_this.fusionchartsService, configObj);
533+
_this_1.initialized.emit({ chart: _this.chartObj });
533534
_this.chartObj.render(_this.element.nativeElement.querySelector('div'));
534535
}, 1);
535536
});

0 commit comments

Comments
 (0)