Choisir valeur abscisse JpGraph

Résolu/Fermé
Melooo Messages postés 1405 Date d'inscription vendredi 28 novembre 2008 Statut Membre Dernière intervention 18 mars 2013 - 16 janv. 2012 à 15:13
Melooo Messages postés 1405 Date d'inscription vendredi 28 novembre 2008 Statut Membre Dernière intervention 18 mars 2013 - 19 janv. 2012 à 10:20
Bonjour,
Je suis en train de réaliser un graphe en courbe de 90°.
J'ai bien toutes mes courbes qui s'affichent, mon souci est sur l'axe des abscisses, actuellement j'ai 10 valeurs en abscisse, or je n'en veux que 6 (0, 0.005, 0.010, 0.015, 0.020, 0.025)

Mais quoique je fasse il me mets pas ce que je veux même en utilisant les intervalles.

Merci de votre aide.


A voir également:

2 réponses

pitxu Messages postés 689 Date d'inscription vendredi 7 septembre 2007 Statut Membre Dernière intervention 25 mars 2015 94
16 janv. 2012 à 19:48
Bonjour,

il faut utiliser la fonction SetTextLabelInterval()
0
Melooo Messages postés 1405 Date d'inscription vendredi 28 novembre 2008 Statut Membre Dernière intervention 18 mars 2013 84
17 janv. 2012 à 08:36
Merci, mais comme j'ai dis dans mon post, cela ne fonctionne pas.
0
pitxu Messages postés 689 Date d'inscription vendredi 7 septembre 2007 Statut Membre Dernière intervention 25 mars 2015 94
17 janv. 2012 à 09:57
alors mets nous le code de ton graph
0
Melooo Messages postés 1405 Date d'inscription vendredi 28 novembre 2008 Statut Membre Dernière intervention 18 mars 2013 84
17 janv. 2012 à 10:00
Ok, le voici :
$datay = array($_GET['al'],$_GET['an'],$_GET['a'],$_GET['be'],$_GET['cd'],$_GET['pb'],$_GET['hg'],$_GET['ni']);

$graph = new Graph(450,500,'auto');
$graph->SetScale("textlin");
$graph->SetShadow();

$graph->Set90AndMargin(70,30,90,30);
$graph->img->SetAngle(90);

$graph->xaxis->hide();
$y_labels = array(0, 0.005, 0.010, 0.015, 0.020, 0.025);
$graph->yaxis->SetTickLabels($y_labels);
$graph->yaxis->SetLabelFormat('%0.3f');

$graph->yaxis->scale->SetGrace(1);
$bplot = new BarPlot($datay);

$bplot->SetFillColor(array("green","red", "blue"));

$bplot->SetShadow();




$bplot->value->Show();
$bplot->value->SetColor("blue","darkred");
$bplot->value->SetFormat('%d Eur.');

$graph->Add($bplot);

$graph->Stroke();$datay = array($_GET['al'],$_GET['an'],$_GET['a'],$_GET['be'],$_GET['cd'],$_GET['pb'],$_GET['hg'],$_GET['ni']);

$graph = new Graph(450,500,'auto');
$graph->SetScale("textlin");
$graph->SetShadow();

$graph->Set90AndMargin(70,30,90,30);
$graph->img->SetAngle(90);

$graph->xaxis->hide();
$y_labels = array(0, 0.005, 0.010, 0.015, 0.020, 0.025);
$graph->yaxis->SetTickLabels($y_labels);
$graph->yaxis->SetLabelFormat('%0.3f');

$graph->yaxis->scale->SetGrace(1);
$bplot = new BarPlot($datay);

$bplot->SetFillColor(array("green","red", "blue"));

$bplot->SetShadow();




$bplot->value->Show();
$bplot->value->SetColor("blue","darkred");
$bplot->value->SetFormat('%d Eur.');

$graph->Add($bplot);

$graph->Stroke();

En abscisse il m'affiche seulement des 0.
Mon histogramme est horizontale !
0
pitxu Messages postés 689 Date d'inscription vendredi 7 septembre 2007 Statut Membre Dernière intervention 25 mars 2015 94
19 janv. 2012 à 09:29
et as-tu essayé d'inscrire les valeurs en 'dur' dans le tableau ?

$y_labels = array('0', '0.005', '0.010', '0.015', '0.020', '0.025');
0
Melooo Messages postés 1405 Date d'inscription vendredi 28 novembre 2008 Statut Membre Dernière intervention 18 mars 2013 84
19 janv. 2012 à 10:20
La solution a été trouvé :

$datay = array($_GET['al'],$_GET['an'],$_GET['a'],$_GET['be'],$_GET['cd'],$_GET['pb'],$_GET['hg'],$_GET['ni']);
$graph = new Graph(450,400,'auto');
$valmax=max($datay);
$echelle='0.005';

$graph->SetScale("textlin",0,'0.025');
$graph->SetShadow();
$graph->Set90AndMargin(70,30,90,30);  
$graph->xaxis->hide();
$graph->yaxis->scale->ticks->Set(0.005,0.0005);

$bplot = new BarPlot($datay);
$bplot->SetFillColor(array("green","red", "blue"));
$bplot->SetShadow();
$bplot->SetWidth(0.5);
$bplot->value->Show();
$bplot->value->SetColor("blue","darkred");
$bplot->value->SetFormat('%3f');

$graph->Add($bplot);
$graph->Stroke();

Merci
0