Skip to content

Commit 2d27e14

Browse files
committed
Removed fc-json-url and made the datasource to detect the type using fc-data-format, added xml as a datasource, added a demo for xml
1 parent 5023a15 commit 2d27e14

File tree

14 files changed

+95
-20
lines changed

14 files changed

+95
-20
lines changed

demos/data/data.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<chart caption="Top 10 Most Popular Sports in the World" subcaption="Based on number of viewers" yaxisname="Number of Viewers" plotgradientcolor="" bgcolor="FFFFFF" showplotborder="0" divlinecolor="CCCCCC" showvalues="1" showcanvasborder="0" canvasbordercolor="CCCCCC" canvasborderthickness="1" showyaxisvalues="0" showlegend="1" showshadow="0" labelsepchar=": " basefontcolor="000000" labeldisplay="AUTO" numberscalevalue="1000,1000,1000" numberscaleunit="K,M,B" palettecolors="#008ee4,#9b59b6,#6baa01,#e44a00,#f8bd19,#d35400,#bdc3c7,#95a5a6,#34495e,#1abc9c" showborder="0">
2+
<set label="Football" value="3500000000" tooltext="Popular in: {br}Europe{br}Africa{br}Asia{br}Americas" />
3+
<set label="Cricket" value="3000000000" tooltext="Popular in: {br}India{br}UK{br}Pakistan{br}Australia" />
4+
<set label="Field Hockey" value="2200000000" tooltext="Popular in: {br}Asia{br}Europe{br}Africa{br}Australia" />
5+
<set label="Tennis" value="1000000000" color="e44a00" tooltext="Popular in: {br}Europe{br}Americas{br}Asia" />
6+
<set label="Volleyball" value="900000000" tooltext="Popular in: {br}Asia{br}Europe{br}Americas{br}Australia" />
7+
<set label="Table Tennis" value="900000000" tooltext="Popular in: {br}Asia{br}Europe{br}Africa{br}Americas" />
8+
<set label="Baseball" value="500000000" tooltext="Popular in: {br}US{br}Japan{br}Cuba{br}Dominican Republic" />
9+
<set label="Golf" value="400000000" tooltext="Popular in: {br}US{br}Canada{br}Europe" />
10+
<set label="Basketball" value="400000000" tooltext="Popular in: {br}US{br}Canada" />
11+
<set label="American football" value="390000000" tooltext="Popular in:{br}US" />
12+
</chart>

demos/demosources/ex5/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<fc-chart fc-json-url="data/data.json" fc-type="column2d" fc-width="600" fc-height="400"></fc-chart>
1+
<fc-chart fc-data-format="jsonurl" fc-datasource="data/data.json" fc-type="column2d" fc-width="600" fc-height="400"></fc-chart>

demos/demosources/ex5/src.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% if(src=== "js") { %>
22
33
<% } else if(src==="html") { %>
4-
<fc-chart fc-json-url="data/data.json" fc-type="column2d" fc-width="600" fc-height="400"></fc-chart>
4+
<fc-chart fc-data-format="jsonurl" fc-datasource="data/data.json" fc-type="column2d" fc-width="600" fc-height="400"></fc-chart>
55
<% } %>

demos/demosources/ex5a/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "Fetch data from a XML URL",
3+
"desc": "Fetch data remotely from a XML file or URL"
4+
}

demos/demosources/ex5a/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<fc-chart fc-data-format="xmlurl" fc-datasource="data/data.xml" fc-type="column2d" fc-width="600" fc-height="400"></fc-chart>

demos/demosources/ex5a/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(function () {
2+
app.config(['$routeProvider', function ($routeProvider) {
3+
$routeProvider.when ('/demos/ex5a', {
4+
templateUrl: 'views/ex5a.html',
5+
controller: 'ex5aController'
6+
});
7+
}]);
8+
9+
app.controller('ex5aController', function ($scope, $rootScope) {
10+
$rootScope.demoId = 'ex5a';
11+
});
12+
}());
13+

demos/demosources/ex5a/src.ejs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<% if(src=== "js") { %>
2+
3+
<% } else if(src==="html") { %>
4+
<fc-chart fc-data-format="xmlurl" fc-datasource="data/data.xml" fc-type="column2d" fc-width="600" fc-height="400"></fc-chart>
5+
<% } %>

demos/index.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
<script type="text/javascript" src="js/demos/ex5.js"></script>
2525

26+
<script type="text/javascript" src="js/demos/ex5a.js"></script>
27+
2628
<script type="text/javascript" src="js/demos/ex6.js"></script>
2729

2830
<script type="text/javascript" src="js/demos/ex7.js"></script>
@@ -56,7 +58,12 @@
5658

5759
window.fcDemos['ex5'] = {
5860
js: "\n\n",
59-
html: "\n<fc-chart fc-json-url=\"data/data.json\" fc-type=\"column2d\" fc-width=\"600\" fc-height=\"400\"></fc-chart>\n"
61+
html: "\n<fc-chart fc-data-format=\"jsonurl\" fc-datasource=\"data/data.json\" fc-type=\"column2d\" fc-width=\"600\" fc-height=\"400\"></fc-chart>\n"
62+
};
63+
64+
window.fcDemos['ex5a'] = {
65+
js: "\n\n",
66+
html: "\n<fc-chart fc-data-format=\"xmlurl\" fc-datasource=\"data/data.xml\" fc-type=\"column2d\" fc-width=\"600\" fc-height=\"400\"></fc-chart>\n"
6067
};
6168

6269
window.fcDemos['ex6'] = {
@@ -124,6 +131,11 @@ <h4>Fetch data from a JSON URL</h4>
124131
<p>Fetch data remotely from a JSON file or URL</p>
125132
</a>
126133

134+
<a href="#/demos/ex5a" class="list-group-item">
135+
<h4>Fetch data from a XML URL</h4>
136+
<p>Fetch data remotely from a XML file or URL</p>
137+
</a>
138+
127139
<a href="#/demos/ex6" class="list-group-item">
128140
<h4>Update chart data from scope</h4>
129141
<p>Change the data dynamically in the scope and watch the chart update automatically</p>

demos/js/demos/ex10.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(function () {
2+
app.config(['$routeProvider', function ($routeProvider) {
3+
$routeProvider.when ('/demos/ex10', {
4+
templateUrl: 'views/ex10.html',
5+
controller: 'ex10Controller'
6+
});
7+
}]);
8+
9+
app.controller('ex10Controller', function ($scope, $rootScope) {
10+
$rootScope.demoId = 'ex10';
11+
});
12+
}());
13+

demos/js/demos/ex5a.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(function () {
2+
app.config(['$routeProvider', function ($routeProvider) {
3+
$routeProvider.when ('/demos/ex5a', {
4+
templateUrl: 'views/ex5a.html',
5+
controller: 'ex5aController'
6+
});
7+
}]);
8+
9+
app.controller('ex5aController', function ($scope, $rootScope) {
10+
$rootScope.demoId = 'ex5a';
11+
});
12+
}());
13+

0 commit comments

Comments
 (0)