From 7374f0f9dde042c5859f7e82cb498b8bebe00a28 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 16 Mar 2015 18:02:52 +0100 Subject: [PATCH] Removed Material Design. --- public/js/gcharts.js | 27 +++++--------- public/js/gcharts.options.js | 68 ++++++++++++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 20 deletions(-) diff --git a/public/js/gcharts.js b/public/js/gcharts.js index 5f72099f64..e1d057551b 100644 --- a/public/js/gcharts.js +++ b/public/js/gcharts.js @@ -1,5 +1,5 @@ var google = google || {}; -google.load('visualization', '1.1', {'packages': ['corechart', 'bar','line', 'sankey', 'table']}); +google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'line', 'sankey', 'table']}); function googleChart(chartType, URL, container, options) { if ($('#' + container).length === 1) { @@ -13,10 +13,10 @@ function googleChart(chartType, URL, container, options) { Format as money */ var money = new google.visualization.NumberFormat({ - decimalSymbol: ',', - groupingSymbol: '.', - prefix: currencyCode + ' ' - }); + decimalSymbol: ',', + groupingSymbol: '.', + prefix: currencyCode + ' ' + }); for (var i = 1; i < gdata.getNumberOfColumns(); i++) { money.format(gdata, i); } @@ -26,25 +26,21 @@ function googleChart(chartType, URL, container, options) { */ var chart = false; var options = false; - var isMaterialDesign = false; if (chartType === 'line') { - chart = new google.charts.Line(document.getElementById(container)); + chart = new google.visualization.LineChart(document.getElementById(container)); options = options || defaultLineChartOptions; - isMaterialDesign = true; } if (chartType === 'column') { - chart = new google.charts.Bar(document.getElementById(container)); + chart = new google.visualization.ColumnChart(document.getElementById(container)); options = options || defaultColumnChartOptions; - isMaterialDesign = true; } if (chartType === 'pie') { chart = new google.visualization.PieChart(document.getElementById(container)); options = options || defaultPieChartOptions; } if (chartType === 'bar') { - chart = new google.charts.Bar(document.getElementById(container)); + chart = new google.visualization.BarChart(document.getElementById(container)); options = options || defaultBarChartOptions; - isMaterialDesign = true; } if (chartType === 'stackedColumn') { chart = new google.visualization.ColumnChart(document.getElementById(container)); @@ -58,12 +54,7 @@ function googleChart(chartType, URL, container, options) { if (chart === false) { alert('Cannot draw chart of type "' + chartType + '".'); } else { - if(isMaterialDesign && chartType == 'line') { - chart.draw(gdata, google.charts.Line.convertOptions(options)); - } else { - chart.draw(gdata, options); - } - + chart.draw(gdata, options); } }).fail(function () { diff --git a/public/js/gcharts.options.js b/public/js/gcharts.options.js index 52562d9bab..f910c05b7d 100644 --- a/public/js/gcharts.options.js +++ b/public/js/gcharts.options.js @@ -12,13 +12,56 @@ var defaultLineChartOptions = { height: '80%' }, height: 400, + colors: ["#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"], + hAxis: { + textStyle: { + color: '#838383', + fontName: 'Roboto2', + fontSize: '12' + }, + baselineColor: '#aaaaaa', + gridlines: { + color: 'transparent' + } + }, + vAxis: { + textStyle: { + color: '#838383', + fontName: 'Roboto2', + fontSize: '12' + }, + baselineColor: '#aaaaaa', + format: '\u20AC #' + } + }; var defaultBarChartOptions = { height: 400, bars: 'horizontal', - hAxis: {format: '\u20AC #'}, + hAxis: { + textStyle: { + color: '#838383', + fontName: 'Roboto2', + fontSize: '12' + }, + baselineColor: '#aaaaaa', + format: '\u20AC #' + + }, + colors: ["#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"], + vAxis: { + textStyle: { + color: '#838383', + fontName: 'Roboto2', + fontSize: '12' + }, + gridlines: { + color: 'transparent' + }, + baselineColor: '#aaaaaa' + }, chartArea: { left: 75, top: 10, @@ -62,7 +105,28 @@ var defaultColumnChartOptions = { width: '85%', height: '80%' }, - vAxis: {format: '\u20AC #'}, + hAxis: { + textStyle: { + color: '#838383', + fontName: 'Roboto2', + fontSize: '12' + }, + gridlines: { + color: 'transparent' + }, + baselineColor: '#aaaaaa' + + }, + colors: ["#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"], + vAxis: { + textStyle: { + color: '#838383', + fontName: 'Roboto2', + fontSize: '12' + }, + baselineColor: '#aaaaaa', + format: '\u20AC #' + }, legend: { position: 'none' },