bonjour ,

j'ai un problème avec les catégories de primfaces , j'ai pris l'exemple du site mais au lieu des catégories il m'affiche des float

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.apnf.supervision.server.util;
 
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import org.primefaces.model.chart.Axis;
import org.primefaces.model.chart.AxisType;
import org.primefaces.model.chart.CategoryAxis;
import org.primefaces.model.chart.LineChartModel;
import org.primefaces.model.chart.ChartSeries;
 
@ManagedBean
public class graphe {
 
	private LineChartModel lineModel2;
 
	@PostConstruct
	public void init() {
		createLineModels();
	}
 
	public LineChartModel getLineModel2() {
		return lineModel2;
	}
 
	private void createLineModels() {
 
		lineModel2 = initCategoryModel();
		lineModel2.setTitle("Category Chart");
		lineModel2.setLegendPosition("e");
		lineModel2.setShowPointLabels(true);
		lineModel2.getAxes().put(AxisType.X, new CategoryAxis("Years"));
		Axis yAxis = lineModel2.getAxis(AxisType.Y);
		yAxis.setLabel("Births");
		yAxis.setMin(0);
		yAxis.setMax(200);
	}
 
	private LineChartModel initCategoryModel() {
		LineChartModel model = new LineChartModel();
 
		ChartSeries boys = new ChartSeries();
		boys.setLabel("Boys");
		boys.set("2004", 120);
		boys.set("2005", 100);
		boys.set("2006", 44);
		boys.set("2007", 150);
		boys.set("2008", 25);
 
		ChartSeries girls = new ChartSeries();
		girls.setLabel("Girls");
		girls.set("2004", 52);
		girls.set("2005", 60);
		girls.set("2006", 110);
		girls.set("2007", 90);
		girls.set("2008", 120);
 
		model.addSeries(boys);
		model.addSeries(girls);
 
		return model;
	}
 
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	>
<ui:composition>
	<ui:decorate template="/accueil.xhtml">
		<ui:param name="pageTitle" value="HELLO" />
 
		<ui:define name="pageBody">
 
 
			<p:chart type="line" model="#{graphe.lineModel2}" style="height:300px;"/>
 
		</ui:define>
	</ui:decorate>
</ui:composition>
 
</html>
Voilà le résultat :
Nom : gra.png
Affichages : 173
Taille : 16,8 Ko

Merci