Added option for other charts (chartJS currently).

This commit is contained in:
James Cole
2015-06-27 12:21:04 +02:00
parent f6b1ec27e5
commit c581080f3f
5 changed files with 60 additions and 5 deletions

11
public/js/Chart.min.js vendored Normal file

File diff suppressed because one or more lines are too long

34
public/js/charts.js Normal file
View File

@@ -0,0 +1,34 @@
function lineChart(URL, container, options) {
"use strict";
console.log('no impl for lineChart');
}
function areaChart(URL, container, options) {
"use strict";
console.log('no impl for areaChart');
}
function columnChart(URL, container, options) {
"use strict";
console.log('no impl for columnChart');
}
function stackedColumnChart(URL, container, options) {
"use strict";
console.log('no impl for stackedColumnChart');
}
function comboChart(URL, container, options) {
"use strict";
console.log('no impl for comboChart');
}
function pieChart(URL, container, options) {
"use strict";
console.log('no impl for pieChart');
}

View File

@@ -1,6 +1,15 @@
/* globals $, columnChart, google, lineChart, pieChart, stackedColumnChart, areaChart */
google.setOnLoadCallback(drawChart);
$(function () {
"use strict";
if (typeof google !== 'undefined') {
// do google charts:
google.setOnLoadCallback(drawChart);
} else {
// do chart JS stuff.
drawChart();
}
});
function drawChart() {
"use strict";

View File

@@ -223,8 +223,10 @@
{% if Config.get('firefly.chart') == 'google' %}
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/gcharts.js"></script>
{% else %}
<!-- no google-->
{% endif %}
{% if Config.get('firefly.chart') == 'chartjs' %}
<script type="text/javascript" src="js/Chart.min.js"></script>
<script type="text/javascript" src="js/charts.js"></script>
{% endif %}
<script type="text/javascript" src="js/index.js"></script>
{% endblock %}

View File

@@ -77,8 +77,7 @@
<script type="text/javascript">
var year = '{{start.year}}';
var shared = {% if shared %}'/shared'
{% else %}''{% endif %};
var shared = {% if shared %}'/shared'{% else %}''{% endif %};
var incomeTopLength = {{ incomeTopLength }};
var expenseTopLength = {{ expenseTopLength }};
var incomeRestShow = false; // starts hidden.