HighChart and HighStock jquery chart libraries can be used with primefaces.
I used it and it's better than jqplot.
Line Chart Zoom is not feasible when X-Axis is of date type
Ramazan YILDIZ
Senior Software Developer Engineer
Netas RnD
ramazangsu[at]gmail.com
Senior Software Developer Engineer
Netas RnD
ramazangsu[at]gmail.com
-
- Posts: 5
- Joined: 21 Sep 2012, 16:56
Yes, I confirm you that I use key.getTime() because it doesn't work with dates but using long the "renderer:$.jqplot.DateAxisRenderer" converts it into a Date format.marcose wrote:@pescamillam,
Thank you very much for posting the sample code. I had a question on what you had posted.
Could you please confirm that when you build the series object in the bean, the key to the values you add is key.getTime() and not key (i.e. a long and not a Date) ?
Can jqplot work with epoch time and format it as a date ?
I tried following what you had suggested, but I am seeing nothing on my x-axis !!!! I have used different options though (numberTicks & tickOptions:{formatString:'%H:%M'}).
BTW I made some changes on my code to make it work with zoom and values are now amounts of money
xhtml:
Code: Select all
<td align="center">
<p:lineChart id="linear" value="#{cashBean.linearModel}" legendPosition="ne" animate="true" widgetVar="chart" zoom="true"
title="#{cashBean.linearModelTitle}" style="height:280px; width:480px" extender="ext2"/>
<script type="text/javascript" src="../src/plugins/jqplot.dateAxisRenderer.min.js"></script>
<script>
function ext2() {
//this = chart widget instance
//this.cfg = options
this.cfg.axes = {
xaxis:{
min:null,
max:null,
autoscale:true,
numberTicks:null,
pad:1.0,
tickInterval:'1 days',
renderer:$.jqplot.DateAxisRenderer,
rendererOptions: {
tickInset: 0
},
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickOptions:{
fontSize:'10pt',
fontFamily:'Tahoma',
angle:-40
}
},
yaxis:{
rendererOptions:{
tickRenderer:$.jqplot.CanvasAxisTickRenderer
},
tickOptions:{
fontSize:'10pt',
fontFamily:'Tahoma',
formatString: "$%'d",
angle:30
}
}
};
this.cfg.highlighter = {
show: true,
tooltipOffset: 2
}
}
</script>
</td>
bean:
Code: Select all
linearModel = new CartesianChartModel();
LineChartSeries series1 = new LineChartSeries();
series1.setLabel(evolution.getTag());
Map<Object, Number> data = getShowedEvolutionData(evolution.getEvolution());
TreeSet<Date> tree = new TreeSet<Date>();
for (Object lineChartSeries : data.keySet()) {
Date key = (Date)lineChartSeries;
tree.add(key);
}
Iterator<Date> it = tree.iterator();
while (it.hasNext()) {
Date key = it.next();
Number value = data.get(key);
series1.set(key.getTime(), value);
}
linearModel.addSeries(series1);
-
- Posts: 5
- Joined: 21 Sep 2012, 16:56
I recommend you downloading the documentation http://www.primefaces.org/documentation.html those options are covered in there and are really easy to implement, btw, I have it working on ie, chrome and firefox without using the minx
Last edited by pescamillam on 09 Oct 2012, 16:20, edited 1 time in total.
Hi Guys...
First of all... thank you for this post.. it was very helpful to integrate datetime data into my charts.
I have a question, anyone trying to use a localized timezone data in these charts?
As recommended in the original issue log (http://code.google.com/p/primefaces/iss ... %20Summary) I'm trying to use it like this:
<p:barChart>
<f:convertDateTime pattern="dd.MM.yyyy" timeZone="ACT" type="both"/>
</p:barChart>
It's assumed that parameter timezone is used to convert a localized data, however it's not used in the final result.... :S
First of all... thank you for this post.. it was very helpful to integrate datetime data into my charts.
I have a question, anyone trying to use a localized timezone data in these charts?
As recommended in the original issue log (http://code.google.com/p/primefaces/iss ... %20Summary) I'm trying to use it like this:
<p:barChart>
<f:convertDateTime pattern="dd.MM.yyyy" timeZone="ACT" type="both"/>
</p:barChart>
It's assumed that parameter timezone is used to convert a localized data, however it's not used in the final result.... :S
Last edited by ybendek on 09 Oct 2012, 21:09, edited 1 time in total.
Replying to myself. There is an attribute showMarkers that is per line chart not per series. This attribute should be made per series but hey at least we can control it on/off. Very useful is seriesDefaults http://www.jqplot.com/docs/files/jqPlotOptions-txt.html property.
-
- Posts: 1
- Joined: 02 Nov 2012, 21:06
Hi pescamillam
Perfect!
Thank you! Helped me a lot!
Perfect!
Thank you! Helped me a lot!
-
- Information
-
Who is online
Users browsing this forum: No registered users and 9 guests