cs_prim
Messages postés12Date d'inscriptionmardi 17 juin 2003StatutMembreDernière intervention23 mars 2009
-
15 août 2005 à 13:07
Evangun
Messages postés1980Date d'inscriptiondimanche 20 février 2005StatutMembreDernière intervention24 septembre 2012
-
15 août 2005 à 13:53
Salut tout le monde !
Bon voilà j'ai un petit problème avec JPGraph...
Je veux juste créer un graphe sous forme de ligne qui représente l'évolution d'un classement d'un joueur qui va du numéro 1 à un numéro X.
Voici ce que j'ai fait :
http://legroupedcachan.free.fr/evolution.php?joueur=Prim Mais le seul problème c'est que la valeur du classement est négatif puisque j'ai inversé le graphe pour l'avoir dans le sens décroissant...
Si quelqu'un a compris mon problème et qu'il peut m'aider ça serait sympa
Voici mon code :
<?php
include ("outils/jpgraph/source/jpgraph.php");
include ("outils/jpgraph/source/jpgraph_line.php");
include ("outils/jpgraph/source/jpgraph_error.php");
require_once("connexion_base.php");
// Callback to negate the argument
function _cb_negate($aVal) {
return round(-$aVal);
}
//fonction d'affichage du graphe pour l'évolution d'UN joueur
function evolution()
{
$joueur=$_GET["joueur"];
$titre="Evolution du classement de ".$joueur;
// Negate all data
$n = count($datay);
for($i=0; $i<$n; ++$i)
{
$datay[$i] = round(-$datay[$i]);
}
$graph = new Graph($largeur,400,"auto");
$graph->img->SetMargin(40,40,40,40);
$graph->img->SetAntiAliasing();
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->title->Set($titre);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->SetTickLabels($datax);
// Use 20% "grace" to get slightly larger scale then min/max of data
$graph->yscale->SetGrace(20);