I\'m using jqPlot to create a bar graph, but I ran into a few problems.
Problem 1: The first and last bars on the graph are cut off. Only half of it is
Here is a simple hack that I used to show a margin.
I create a starting date and an ending date which are respectively one day before and one day after the contents I want to show.
For example if I want to show the month of January 2012
var startingDate = new Date(2012, 0, 0); //=> 31th Dec 2011
var endingDate = new Date(2012, 1, 1); //=> 1st Feb 2012
Then I declare my own DateTickFormatter
where I will not printout these two dates.
$.jqplot.DateTickFormatter = function(format, val) {
if (!format) {
format = '%Y/%m/%d';
}
if(val==startingDate.getTime() || val==endingDate.getTime()){
return "";
}else{
return $.jsDate.strftime(val, format);
}
};
Then in the xaxis
I put the following options:
xaxis : {
renderer:$.jqplot.DateAxisRenderer,
min:startingDate,
max:endingDate,
tickInterval:'1 day'
}