Bonjour

Voulant modifier un projet existant, je suis bloqué : je n'arrive pas à afficher les valeurs de chaque barre dans un histogramme malgré le code suivant

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
function draw_histogramme($titre,$tab)
	{
		include ('../lib/jpgraph/src/jpgraph.php'); 
		include ('../lib/jpgraph/src/jpgraph_bar.php'); 
 
		$valeurs=array();
		$legendes=array();
		foreach ($tab as $item)
		{
			$valeurs[]=$item['valeur'];
			$legendes[]=$item['libelle'];
		}
 
		if (empty($valeurs))
		{
			$valeurs[]=0;
			$legendes[]=0;
		}
 
		$graph = new Graph(650,350, "auto");
		$graph->SetScale('textint');
		$graph->xaxis->SetTickLabels($legendes);
 
		// Titre pour l'axe vertical (axe y)
		$graph->yaxis->title->Set("Nombre de visites");
 
		$barplot = new BarPlot($valeurs);
		$barplot->value->Show();
		// Fixer l'aspect de la police
		$barplot->value->SetFont(FF_FONT1,FS_BOLD);
		// Modifier le rendu de chaque valeur
		$barplot->value->SetFormat('%d');
		$graph->Add($barplot);
		$graph->Stroke();
	}