Fixed chart x limits.
This commit is contained in:
parent
af30952228
commit
36efe79dd1
@ -183,8 +183,6 @@ var ListViewModel = function() {
|
|||||||
self.savedItem=ko.toJS(item);
|
self.savedItem=ko.toJS(item);
|
||||||
self.selectedItem(item);
|
self.selectedItem(item);
|
||||||
|
|
||||||
console.debug(self.savedItem);
|
|
||||||
|
|
||||||
$("#value_date").datepicker().on('changeDate', function(ev){
|
$("#value_date").datepicker().on('changeDate', function(ev){
|
||||||
self.selectedItem().value_date(ev.date.format(ev.currentTarget.dataset.dateFormat));
|
self.selectedItem().value_date(ev.date.format(ev.currentTarget.dataset.dateFormat));
|
||||||
});
|
});
|
||||||
@ -284,12 +282,20 @@ drawChart = function(entries, element) {
|
|||||||
today.setHours(0);
|
today.setHours(0);
|
||||||
today.setMinutes(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
|
// plot chart
|
||||||
window.chart = $.jqplot(element.id, chartValues, {
|
window.chart = $.jqplot(element.id, chartValues, {
|
||||||
title: "Évolution du solde",
|
title: "Évolution du solde",
|
||||||
axes:{
|
axes:{
|
||||||
xaxis:{
|
xaxis:{
|
||||||
|
autoscale: true,
|
||||||
renderer:$.jqplot.DateAxisRenderer,
|
renderer:$.jqplot.DateAxisRenderer,
|
||||||
|
min: firstDate,
|
||||||
|
max: lastDate,
|
||||||
tickOptions: {formatString: "%F"}
|
tickOptions: {formatString: "%F"}
|
||||||
},
|
},
|
||||||
yaxis: {
|
yaxis: {
|
||||||
|
Loading…
Reference in New Issue
Block a user