mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 23:50:09 +00:00
Switched to Google Material design line charts.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
var google = google || {};
|
||||
google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'sankey', 'table']});
|
||||
google.load('visualization', '1.1', {'packages': ['corechart', 'bar','line', 'sankey', 'table']});
|
||||
|
||||
function googleChart(chartType, URL, container, options) {
|
||||
if ($('#' + container).length === 1) {
|
||||
@@ -26,13 +26,16 @@ function googleChart(chartType, URL, container, options) {
|
||||
*/
|
||||
var chart = false
|
||||
var options = false;
|
||||
var isMaterialDesign = false;
|
||||
if (chartType === 'line') {
|
||||
chart = new google.visualization.LineChart(document.getElementById(container));
|
||||
chart = new google.charts.Line(document.getElementById(container));
|
||||
options = options || defaultLineChartOptions;
|
||||
isMaterialDesign = true;
|
||||
}
|
||||
if (chartType === 'column') {
|
||||
chart = new google.charts.Bar(document.getElementById(container));
|
||||
options = options || defaultColumnChartOptions;
|
||||
isMaterialDesign = true;
|
||||
}
|
||||
if (chartType === 'pie') {
|
||||
chart = new google.visualization.PieChart(document.getElementById(container));
|
||||
@@ -41,6 +44,7 @@ function googleChart(chartType, URL, container, options) {
|
||||
if (chartType === 'bar') {
|
||||
chart = new google.charts.Bar(document.getElementById(container));
|
||||
options = options || defaultBarChartOptions;
|
||||
isMaterialDesign = true;
|
||||
}
|
||||
if (chartType === 'stackedColumn') {
|
||||
chart = new google.visualization.ColumnChart(document.getElementById(container));
|
||||
@@ -54,7 +58,12 @@ function googleChart(chartType, URL, container, options) {
|
||||
if (chart === false) {
|
||||
alert('Cannot draw chart of type "' + chartType + '".');
|
||||
} else {
|
||||
chart.draw(gdata, options);
|
||||
if(isMaterialDesign && chartType == 'line') {
|
||||
chart.draw(gdata, google.charts.Line.convertOptions(options));
|
||||
} else {
|
||||
chart.draw(gdata, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}).fail(function () {
|
||||
|
||||
Reference in New Issue
Block a user