Skip to content

Commit bf1ed41

Browse files
committed
Merge branch 'release/5.0.1'
2 parents cc78883 + a38f9d6 commit bf1ed41

File tree

8 files changed

+209
-49
lines changed

8 files changed

+209
-49
lines changed

README.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A simple and lightweight official AngularJS component for FusionCharts JavaScript charting library. angularjs-fusioncharts enables you to add JavaScript charts in your AngularJS application without any hassle.
44

5-
## [Demo](https://fusioncharts.github.io/angular-fusioncharts/)
5+
## [Demo](https://fusioncharts.github.io/angularjs-fusioncharts/)
66

77
- Github Repo: [https://github.com/fusioncharts/angularjs-fusioncharts](https://github.com/fusioncharts/angularjs-fusioncharts)
88
- Documentation: [https://www.fusioncharts.com/dev/getting-started/angular/angularjs/your-first-chart-using-angularjs](https://www.fusioncharts.com/dev/getting-started/angular/angularjs/your-first-chart-using-angularjs)
@@ -24,6 +24,7 @@ A simple and lightweight official AngularJS component for FusionCharts JavaScrip
2424
- [Quick Start](#quick-start)
2525
- [Going Beyond Charts](#going-beyond-charts)
2626
- [Usage and Integration of FusionTime](#usage-and-integration-of-fusiontime)
27+
- [Special note for IE Users](#special-note)
2728
- [For Contributors](#for-contributors)
2829
- [Licensing](#licensing)
2930

@@ -40,7 +41,7 @@ A simple and lightweight official AngularJS component for FusionCharts JavaScrip
4041
To install `angularjs-fusioncharts` library, run:
4142

4243
```bash
43-
$ npm install angular-fusioncharts --save
44+
$ npm install angularjs-fusioncharts --save
4445
```
4546

4647
To install `fusioncharts` library:
@@ -339,25 +340,33 @@ var app = angular.module('myApp', ['ng-fusioncharts']);
339340

340341
var jsonify = res => res.json();
341342
var dataFetch = fetch(
342-
'https://raw.githubusercontent.com/fusioncharts/dev_centre_docs/fusiontime-beta-release/charts-resources/fusiontime/online-sales-single-series/data.json'
343+
'https://s3.eu-central-1.amazonaws.com/fusion.store/ft/data/line-chart-with-time-axis-data.json'
343344
).then(jsonify);
344345
var schemaFetch = fetch(
345-
'https://raw.githubusercontent.com/fusioncharts/dev_centre_docs/fusiontime-beta-release/charts-resources/fusiontime/online-sales-single-series/schema.json'
346+
'https://s3.eu-central-1.amazonaws.com/fusion.store/ft/schema/line-chart-with-time-axis-schema.json'
346347
).then(jsonify);
347348

348349
var app = angular.module('myApp', ['ng-fusioncharts']);
349350

350351
app.controller('MyController', function($scope) {
351352
$scope.dataSource = {
352-
caption: { text: 'Online Sales of a SuperStore in the US' },
353353
data: null,
354+
caption: {
355+
text: 'Sales Analysis'
356+
},
357+
subcaption: {
358+
text: 'Grocery'
359+
},
354360
yAxis: [
355361
{
356-
plot: [
357-
{
358-
value: 'Sales ($)'
359-
}
360-
]
362+
plot: {
363+
value: 'Grocery Sales Value',
364+
type: 'line'
365+
},
366+
format: {
367+
prefix: '$'
368+
},
369+
title: 'Sale Value'
361370
}
362371
]
363372
};
@@ -414,6 +423,30 @@ Useful links for FusionTime
414423
- [How FusionTime works](https://www.fusioncharts.com/dev/fusiontime/getting-started/how-fusion-time-works)
415424
- [Create your first chart](https://www.fusioncharts.com/dev/fusiontime/getting-started/create-your-first-chart-in-fusiontime)
416425

426+
## Special Note
427+
428+
If you want to support your application on IE(11 and below), then you need to take following steps:
429+
430+
### Firstly
431+
432+
You have to update your `angularjs-fusioncharts` and `fusioncharts` modules to latest versions. For `angularjs-fusioncharts` install `v5.0.1` and above; for `fusioncharts` install `v3.13.3-sr.1` and above.
433+
434+
### Secondly
435+
436+
In your template, modify your code like so,
437+
438+
```html
439+
<div
440+
fusioncharts
441+
width="600"
442+
height="400"
443+
type="ANY_CHART_TYPE"
444+
datasource-dt="dataSource"
445+
>
446+
// Instead of passing data in datasouce, use datasource-dt.
447+
</div>
448+
```
449+
417450
## For Contributors
418451

419452
- Clone the repository and install dependencies

dist/angular-fusioncharts.js

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,10 @@
199199
scope: scope,
200200
link: function(scope, element, attrs) {
201201
function updateData(key, data) {
202-
scope.datasourceDt.key = data;
203-
chart.setJSONData(scope.datasourceDt);
202+
if (key) {
203+
scope.datasourceDt.key = data;
204+
chart.setJSONData(scope.datasourceDt);
205+
}
204206
}
205207

206208
function createWatchersForAttrs(datasource) {
@@ -217,17 +219,6 @@
217219
});
218220
}
219221

220-
if (scope.datasourceDt) {
221-
scope.$watch(
222-
'datasourceDt.data',
223-
function(newData, oldData) {
224-
if (newData !== oldData) updateData(newData, 'data');
225-
},
226-
false
227-
);
228-
createWatchersForAttrs(scope.datasourceDt);
229-
}
230-
231222
var observeConf = {
232223
// non-data componenet observers
233224
NDCObserver: {
@@ -627,7 +618,6 @@
627618
chart.setJSONData(chartConfigObject.dataSource);
628619
}
629620
}, 0);
630-
631621
// chart.setJSONData(chartConfigObject.dataSource);
632622
},
633623
createFCChart = function() {
@@ -689,6 +679,7 @@
689679
}
690680
}
691681
}
682+
692683
for (i = 0; i < attribs.length; i++) {
693684
attr = attribs[i];
694685
if (attr.match(/^on/i)) {
@@ -752,6 +743,44 @@
752743

753744
createFCChart();
754745

746+
if (attrs.type.toLowerCase() === 'timeseries' && scope.datasourceDt) {
747+
scope.$watch(
748+
'datasourceDt.data',
749+
function(newData, oldData) {
750+
if (newData !== oldData) updateData(newData, 'data');
751+
},
752+
false
753+
);
754+
createWatchersForAttrs(scope.datasourceDt);
755+
} else if (scope.datasourceDt) {
756+
attrs.datasourceDt = scope.datasourceDt;
757+
chartConfigObject.dataSource = scope.datasourceDt;
758+
dataStringStore.dataSource = scope.datasourceDt;
759+
setChartData();
760+
scope.$watch(
761+
'datasourceDt',
762+
function(newData, oldData) {
763+
if (newData !== oldData) {
764+
chartConfigObject.dataSource = scope.datasourceDt;
765+
dataStringStore.dataSource = scope.datasourceDt;
766+
setChartData();
767+
if (chartConfigObject.dataFormat === 'json') {
768+
setChartData();
769+
} else {
770+
if (chartConfigObject.dataFormat === 'xml') {
771+
chart.setXMLData(newData);
772+
} else if (chartConfigObject.dataFormat === 'jsonurl') {
773+
chart.setJSONUrl(newData);
774+
} else if (chartConfigObject.dataFormat === 'xmlurl') {
775+
chart.setXMLUrl(newData);
776+
}
777+
}
778+
}
779+
},
780+
true
781+
);
782+
}
783+
755784
scope.$on('$destroy', function() {
756785
// on destroy free used resources to avoid memory leaks
757786
if (chart && chart.dispose) {

dist/angular-fusioncharts.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/data.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"chart": {
3+
"caption": "Countries With Most Oil Reserves [2017-18]",
4+
"subCaption": "In MMbbl = One Million barrels",
5+
"xAxisName": "Country",
6+
"yAxisName": "Reserves (MMbbl)",
7+
"numberSuffix": "K",
8+
"theme": "fusion"
9+
},
10+
"data": [
11+
{
12+
"label": "Venezuela",
13+
"value": "290"
14+
},
15+
{
16+
"label": "Saudi",
17+
"value": "260"
18+
},
19+
{
20+
"label": "Canada",
21+
"value": "180"
22+
},
23+
{
24+
"label": "Iran",
25+
"value": "140"
26+
},
27+
{
28+
"label": "Russia",
29+
"value": "115"
30+
},
31+
{
32+
"label": "UAE",
33+
"value": "100"
34+
},
35+
{
36+
"label": "US",
37+
"value": "30"
38+
},
39+
{
40+
"label": "China",
41+
"value": "30"
42+
}
43+
]
44+
}

example/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,25 @@
3030
height="400"
3131
type="timeseries"
3232
></div>
33+
<div
34+
fusioncharts
35+
datasource-dt="columnDS"
36+
width="600"
37+
height="400"
38+
type="column2d"
39+
></div>
3340
<div
3441
fusioncharts
3542
datasource="{{ columnDS }}"
43+
dataFormat="json"
44+
width="600"
45+
height="400"
46+
type="column2d"
47+
></div>
48+
<div
49+
fusioncharts
50+
datasource="data.json"
51+
dataFormat="jsonurl"
3652
width="600"
3753
height="400"
3854
type="column2d"

example/index.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
var jsonify = res => res.json();
22
var dataFetch = fetch(
3-
'https://raw.githubusercontent.com/fusioncharts/dev_centre_docs/fusiontime-beta-release/charts-resources/fusiontime/online-sales-single-series/data.json'
3+
'https://s3.eu-central-1.amazonaws.com/fusion.store/ft/data/line-chart-with-time-axis-data.json'
44
).then(jsonify);
55
var schemaFetch = fetch(
6-
'https://raw.githubusercontent.com/fusioncharts/dev_centre_docs/fusiontime-beta-release/charts-resources/fusiontime/online-sales-single-series/schema.json'
6+
'https://s3.eu-central-1.amazonaws.com/fusion.store/ft/schema/line-chart-with-time-axis-schema.json'
77
).then(jsonify);
88

99
var app = angular.module('myApp', ['ng-fusioncharts']);
1010

1111
app.controller('MyController', function($scope) {
1212
$scope.timeSeriesDS = {
13-
caption: { text: 'Online Sales of a SuperStore in the US' },
1413
data: null,
14+
caption: {
15+
text: 'Sales Analysis'
16+
},
17+
subcaption: {
18+
text: 'Grocery'
19+
},
1520
yAxis: [
1621
{
17-
plot: [
18-
{
19-
value: 'Sales ($)'
20-
}
21-
]
22+
plot: {
23+
value: 'Grocery Sales Value',
24+
type: 'line'
25+
},
26+
format: {
27+
prefix: '$'
28+
},
29+
title: 'Sale Value'
2230
}
2331
]
2432
};
@@ -47,6 +55,7 @@ app.controller('MyController', function($scope) {
4755
$scope.update = function() {
4856
$scope.timeSeriesDS.caption.text = 'Something Else';
4957
$scope.columnDS.chart.caption = 'Something Else';
58+
$scope.columnDS.data[1].value = '340';
5059
};
5160

5261
Promise.all([dataFetch, schemaFetch]).then(res => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularjs-fusioncharts",
3-
"version": "5.0.0",
3+
"version": "5.0.1",
44
"description": "Angular plugin for FusionCharts",
55
"main": "dist/angular-fusioncharts.js",
66
"repository": {

0 commit comments

Comments
 (0)