Date axis in linechart using primefaces and jqplot

随声附和 提交于 2019-11-29 17:35:01

Ok..I am not sure if you still need this, but I was facing a similar problem and this is how I solved it. I also needed to zoom into the dates.

Firstly, primefaces does not contain DateAxisRenderer . You need to download it and add it seperately in your code. You can get it here -

DateAxisRenderer.js

And then add it into your code like so -

<h:outputScript library="js/plugins" name="jqplot.dateAxisRenderer.min.js" target="head" />

Place the file under webapp/js/plugins ..this might ofcourse vary between projects...

Then send the date as long from the backing bean and remove the following line from your javascript -

this.cfg.axes.xaxis.ticks = this.cfg.categories;

It should work properly then.

I've solved my problem creating a new proyect like that and it works. I don't know what was the problem. But I have a new problem. I've just tried to plot a range of data between 01/01/2013 and 01/03/2013 and I only get data in January. It means, I get a plot with the data in January and February printing in the same date, in January.

You have to set the X axis value using epoch millis. I had to figure it out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!