2 pièce(s) jointe(s)
[PrimeFaces] Problème avec ChartSeries
bonjour;
je souhaite afficher un graphe pour réprésenter les années et les nombres des réservations pour chaque véhicule;
je veux même résultat de l'exemple suivant:
http://www.developpez.net/forums/att...1&d=1346170294
voilà code page jsf:
Code:
1 2
|
<p:barChart value="#{distributionChart.cartesianModel2}" legendPosition="ne" /> |
voilà code requête:
Code:
1 2 3 4 5 6 7 8 9 10 11
| @Override
public List<DTOAnnee> GrpheAnnee() throws Exception{
Query q=em.createQuery("select count(c) AS total,c.vehicule.matricule AS Nomvehicule, FUNC('YEAR',c.dateResv) AS DateRes from Reservation c GROUP BY c.vehicule.matricule");
List<Object[]> list = q.getResultList();
List<DTOAnnee> AnList = new ArrayList();
for (Object resultLine[] : list) {
AnList.add(new DTOAnnee(((Number) resultLine[0]).intValue(),(String) resultLine[1],(Date) resultLine[2]));
}
return AnList;
} |
et voila ma méthode de managed bean:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| public CartesianChartModel getCartesianModel2() {
return cartesianModel2;
}
public void createCartesianModel2() throws Exception{
for (DTOAnnee i: listAnnees)
{
ChartSeries VehSeries = new ChartSeries();
VehSeries.setLabel(i.getNomvehicule());
Map<Object , Number> groupData = new HashMap<Object, Number>();
groupData.put(i.getDateRes(),i.getTotal());
VehSeries.setData(groupData);
cartesianModel2.addSeries(VehSeries);
}
} |
quand je l'exécute ce message s'affiche, svp je veux la solution!!
http://www.developpez.net/forums/att...1&d=1346168433