From 36efe79dd1d90fdfcec175ed488d25a75c6b56bb Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sun, 13 Jan 2013 12:24:33 +0100 Subject: [PATCH] Fixed chart x limits. --- src/html/js/entries.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/html/js/entries.js b/src/html/js/entries.js index 71e18d8..78610a9 100644 --- a/src/html/js/entries.js +++ b/src/html/js/entries.js @@ -183,8 +183,6 @@ var ListViewModel = function() { self.savedItem=ko.toJS(item); self.selectedItem(item); - console.debug(self.savedItem); - $("#value_date").datepicker().on('changeDate', function(ev){ self.selectedItem().value_date(ev.date.format(ev.currentTarget.dataset.dateFormat)); }); @@ -284,12 +282,20 @@ drawChart = function(entries, element) { today.setHours(0); today.setMinutes(0); + var day = 24 * 60 * 60 * 1000; + + var firstDate = new Date(Date.parse(entries[0][0]).valueOf() - day).format('yyyy-mm-dd'); + var lastDate = new Date(Date.parse(entries[entries.length -1][0]).valueOf() + day).format('yyyy-mm-dd'); + // plot chart window.chart = $.jqplot(element.id, chartValues, { title: "Évolution du solde", axes:{ xaxis:{ + autoscale: true, renderer:$.jqplot.DateAxisRenderer, + min: firstDate, + max: lastDate, tickOptions: {formatString: "%F"} }, yaxis: {