From 7431e18e4bc794ff47f0398ed13792243f2c6998 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 20 Dec 2019 17:28:49 +0100 Subject: [PATCH] Fix #2776 --- public/v1/js/ff/accounts/show.js | 3 ++- public/v1/js/ff/charts.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/public/v1/js/ff/accounts/show.js b/public/v1/js/ff/accounts/show.js index 46dcf06be8..0ae59c2815 100644 --- a/public/v1/js/ff/accounts/show.js +++ b/public/v1/js/ff/accounts/show.js @@ -33,7 +33,8 @@ var fixHelper = function (e, tr) { $(function () { "use strict"; - lineChart(chartUri, 'overview-chart'); + //lineChart(chartUri, 'overview-chart'); + lineNoStartZeroChart(chartUri, 'overview-chart'); if (!showAll) { multiCurrencyPieChart(incomeCategoryUri, 'account-cat-in'); multiCurrencyPieChart(expenseCategoryUri, 'account-cat-out'); diff --git a/public/v1/js/ff/charts.js b/public/v1/js/ff/charts.js index 958c91f447..9061fab523 100644 --- a/public/v1/js/ff/charts.js +++ b/public/v1/js/ff/charts.js @@ -92,6 +92,22 @@ function lineChart(URI, container) { drawAChart(URI, container, chartType, options, colorData); } +/** + * Function to draw a line chart that doesn't start at ZERO. + * @param URI + * @param container + */ +function lineNoStartZeroChart(URI, container) { + "use strict"; + + var colorData = true; + var options = $.extend(true, {}, defaultChartOptions); + var chartType = 'line'; + options.scales.yAxes[0].ticks.beginAtZero = false; + + drawAChart(URI, container, chartType, options, colorData); +} + /** * Overrules the currency the line chart is drawn in. *