Date axis on bar chart primefaces (jqplot)

301 views
Skip to first unread message

Imran Khurram

unread,
Jan 25, 2016, 10:30:00 AM1/25/16
to jqplot-users
I have data according to dates and values are 0 and 1 only. I want to show it in bar chart with date axis. How to implement this? I am trying but I use date axis, it do not show any bars in the graph. How to do it?

I cannot post it to jsfiddle or codepen because its not a front end code. but the code is as follows:

BarChartModel sensorDigitalModel = new BarChartModel(); 
ChartSeries series = new ChartSeries();
series.set("02:01",4);

Axis yAxis = sensorDigitalModel.getAxis(AxisType.Y);
yAxis.setMin(0); yAxis.setMax(1);

sensorDigitalModel.getAxes().put(AxisType.Y, yAxis);
sensorDigitalModel.setExtender("ext");
sensorDigitalModel.addSeries(series);

Axis xAxis = sensorDigitalModel.getAxis(AxisType.X);
xAxis.setLabel("Time Hours");
xAxis.setMin("00:00");
xAxis.setMax("24:00");
xAxis.setTickFormat("%H:%M");

sensorDigitalModel.getAxes().put(AxisType.X, xAxis);

and My extender function is as follows:

function ext() { 
 this.cfg.axes = { 
  xaxis : { 
      renderer: $.jqplot.DateAxisRenderer, 
      rendererOptions: { tickRenderer:$.jqplot.CanvasAxisTickRenderer }, 
      tickOptions:{ 
             angle:-50, 
             formatString: '%H:%M' 
      }
  }, 
  yaxis : { 
      min: 0, 
      max: 1 
  } 
 } 
}

Imran Khurram

unread,
Jan 25, 2016, 10:41:22 AM1/25/16
to jqplot-users
Also I want to fix the x-axis ticks...
Reply all
Reply to author
Forward
0 new messages