Removed old references to Google [skip ci]

This commit is contained in:
James Cole
2015-08-01 07:22:48 +02:00
parent d8dcae856b
commit af7952f204
15 changed files with 20 additions and 862 deletions

View File

@@ -147,7 +147,7 @@ function lineChart(URL, container, options) {
new Chart(ctx).Line(newData, options);
}).fail(function () {
$('#' + container).addClass('google-chart-error');
$('#' + container).addClass('general-chart-error');
});
console.log('URL for line chart : ' + URL);
}
@@ -182,7 +182,7 @@ function areaChart(URL, container, options) {
new Chart(ctx).Line(newData, options);
}).fail(function () {
$('#' + container).addClass('google-chart-error');
$('#' + container).addClass('general-chart-error');
});
console.log('URL for area chart: ' + URL);
@@ -218,7 +218,7 @@ function columnChart(URL, container, options) {
new Chart(ctx).Bar(newData, options);
}).fail(function () {
$('#' + container).addClass('google-chart-error');
$('#' + container).addClass('general-chart-error');
});
console.log('URL for column chart : ' + URL);
}
@@ -253,7 +253,7 @@ function stackedColumnChart(URL, container, options) {
new Chart(ctx).StackedBar(newData, options);
}).fail(function () {
$('#' + container).addClass('google-chart-error');
$('#' + container).addClass('general-chart-error');
});
console.log('URL for stacked column chart : ' + URL);
}
@@ -286,7 +286,7 @@ function pieChart(URL, container, options) {
new Chart(ctx).Pie(data, options);
}).fail(function () {
$('#' + container).addClass('google-chart-error');
$('#' + container).addClass('general-chart-error');
});

View File

@@ -1,319 +0,0 @@
/* globals currencyCode, language */
/* exported lineChart, googleColumnChart, stackedColumnChart, comboChart, pieChart, defaultLineChartOptions, defaultAreaChartOptions, defaultBarChartOptions, defaultComboChartOptions, defaultColumnChartOptions, defaultStackedColumnChartOptions, defaultPieChartOptions */
var google = google || {};
google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'line'], 'language': language});
/* exported */
var defaultLineChartOptions = {
curveType: 'function',
legend: {
position: 'none'
},
interpolateNulls: true,
lineWidth: 1,
chartArea: {
left: 50,
top: 10,
width: '95%',
height: '90%'
},
height: 400,
colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
hAxis: {
textStyle: {
color: '#838383',
},
baselineColor: '#aaaaaa',
gridlines: {
color: 'transparent'
}
},
fontSize: 11,
vAxis: {
textStyle: {
color: '#838383',
},
baselineColor: '#aaaaaa',
format: '\u20AC #'
}
};
var defaultAreaChartOptions = {
curveType: 'function',
legend: {
position: 'none'
},
interpolateNulls: true,
lineWidth: 1,
chartArea: {
left: 50,
top: 10,
width: '95%',
height: '90%'
},
height: 400,
colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
hAxis: {
textStyle: {
color: '#838383',
},
baselineColor: '#aaaaaa',
gridlines: {
color: 'transparent'
}
},
fontSize: 11,
vAxis: {
textStyle: {
color: '#838383',
},
baselineColor: '#aaaaaa',
format: '\u20AC #'
}
};
var defaultBarChartOptions = {
height: 400,
bars: 'horizontal',
hAxis: {
textStyle: {
color: '#838383',
},
baselineColor: '#aaaaaa',
format: '\u20AC #'
},
fontSize: 11,
colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
vAxis: {
textStyle: {
color: '#838383'
},
textPosition: 'in',
gridlines: {
color: 'transparent'
},
baselineColor: '#aaaaaa'
},
chartArea: {
left: 15,
top: 10,
width: '100%',
height: '90%'
},
legend: {
position: 'none'
}
};
var defaultComboChartOptions = {
height: 300,
chartArea: {
left: 75,
top: 10,
width: '100%',
height: '90%'
},
vAxis: {
minValue: 0,
format: '\u20AC #'
},
colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
fontSize: 11,
legend: {
position: 'none'
},
series: {
0: {type: 'line'},
1: {type: 'line'},
2: {type: 'bars'}
},
bar: {groupWidth: 20}
};
var defaultColumnChartOptions = {
height: 400,
chartArea: {
left: 50,
top: 10,
width: '85%',
height: '80%'
},
fontSize: 11,
hAxis: {
textStyle: {
color: '#838383'
},
gridlines: {
color: 'transparent'
},
baselineColor: '#aaaaaa'
},
colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
vAxis: {
textStyle: {
color: '#838383'
},
baselineColor: '#aaaaaa',
format: '\u20AC #'
},
legend: {
position: 'none'
}
};
var defaultStackedColumnChartOptions = {
height: 400,
chartArea: {
left: 50,
top: 10,
width: '85%',
height: '80%'
},
legend: {
position: 'none'
},
fontSize: 11,
isStacked: true,
colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
hAxis: {
textStyle: {
color: '#838383',
},
gridlines: {
color: 'transparent'
}
},
vAxis: {
textStyle: {
color: '#838383',
},
format: '\u20AC #'
}
};
var defaultPieChartOptions = {
chartArea: {
left: 0,
top: 0,
width: '100%',
height: '100%'
},
fontSize: 11,
height: 200,
legend: {
position: 'none'
},
colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
};
function googleChart(chartType, URL, container, options) {
"use strict";
if ($('#' + container).length === 1) {
$.getJSON(URL).success(function (data) {
/*
Get the data from the JSON
*/
var gdata = new google.visualization.DataTable(data);
/*
Format as money
*/
var money = new google.visualization.NumberFormat({
decimalSymbol: ',',
groupingSymbol: '.',
prefix: currencyCode + ' '
});
for (var i = 1; i < gdata.getNumberOfColumns(); i++) {
money.format(gdata, i);
}
/*
Create a new google charts object.
*/
var chart = false;
var options = false;
if (chartType === 'line') {
chart = new google.visualization.LineChart(document.getElementById(container));
options = options || defaultLineChartOptions;
}
if (chartType === 'area') {
chart = new google.visualization.AreaChart(document.getElementById(container));
options = options || defaultAreaChartOptions;
}
if (chartType === 'column') {
chart = new google.visualization.ColumnChart(document.getElementById(container));
options = options || defaultColumnChartOptions;
}
if (chartType === 'pie') {
chart = new google.visualization.PieChart(document.getElementById(container));
options = options || defaultPieChartOptions;
}
if (chartType === 'bar') {
chart = new google.visualization.BarChart(document.getElementById(container));
options = options || defaultBarChartOptions;
}
if (chartType === 'stackedColumn') {
chart = new google.visualization.ColumnChart(document.getElementById(container));
options = options || defaultStackedColumnChartOptions;
}
if (chartType === 'combo') {
chart = new google.visualization.ComboChart(document.getElementById(container));
options = options || defaultComboChartOptions;
}
if (chart === false) {
alert('Cannot draw chart of type "' + chartType + '".');
} else {
chart.draw(gdata, options);
}
}).fail(function () {
$('#' + container).addClass('google-chart-error');
});
} else {
console.log('No container found called "' + container + '"');
}
}
function lineChart(URL, container, options) {
"use strict";
return googleChart('line', URL, container, options);
}
function areaChart(URL, container, options) {
"use strict";
return googleChart('area', URL, container, options);
}
function columnChart(URL, container, options) {
"use strict";
return googleChart('column', URL, container, options);
}
function stackedColumnChart(URL, container, options) {
"use strict";
return googleChart('stackedColumn', URL, container, options);
}
function comboChart(URL, container, options) {
"use strict";
return googleChart('combo', URL, container, options);
}
function pieChart(URL, container, options) {
"use strict";
return googleChart('pie', URL, container, options);
}

View File

@@ -2,13 +2,8 @@
$(function () {
"use strict";
if (typeof google !== 'undefined') {
// do google charts:
google.setOnLoadCallback(drawChart);
} else {
// do chart JS stuff.
drawChart();
}
// do chart JS stuff.
drawChart();
if (showTour) {
$.getJSON('json/tour').success(function (data) {
var tour = new Tour(

View File

@@ -2,11 +2,7 @@
$(function () {
"use strict";
if (typeof(google) !== 'undefined') {
google.setOnLoadCallback(drawChart);
} else {
drawChart();
}
drawChart();
});