I've tried to show a linechart with primefaces and jqplot. But I don't get it. I have this code in my bean:
CartesianChartModel graphic = new CartesianChartModel();
LineChartSeries series = new LineChartSeries();
DateFormat dateFormat = new SimpleDateFormat("mm/dd/yy");
String date1 = "01/10/13";
String date2= "01/15/13";
String date3= "02/20/13";
p=dateFormat.parse(date1);
series.set(p.getTime(), 10);
p=dateFormat.parse(date2);
series.set(p.getTime(), 20);
p=dateFormat.parse(date3);
series.set(p.getTime(), 15);
graphic.addSeries(series);
And I have this code in my extender function:
function extender(){
this.cfg.axes = {
xaxis :{
renderer:$.jqplot.DateAxisRenderer,
rendererOptions : {
tickRenderer:$.jqplot.CanvasAxisTickRenderer
},
tickOptions : {
fontSize:'10pt',
fontFamily:'Tahoma',
angle:-40,
formatString:'%D'
}
};
this.cfg.axes.xaxis.ticks = this.cfg.categories;
}
PROBLEM
It doesn't work properly because I get date3 before the others and the date is not shown in the x axis.
I've just tried to do like PrimeFaces - customise Date Chart. I've changed the time format and I've added the tickInterval
element. With these changes I get an empty graphic. And if I remove the tickInterval
element I get on the x axis something like that on each tick 111011000001110111000000000-%y