Choisir valeur abscisse JpGraph

Résolu
Melooo Messages postés 1476 Statut Membre -  
Melooo Messages postés 1476 Statut Membre -
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.

2 réponses

  1. pitxu Messages postés 708 Statut Membre 95
     
    Bonjour,

    il faut utiliser la fonction SetTextLabelInterval()
    0
    1. Melooo Messages postés 1476 Statut Membre 84
       
      Merci, mais comme j'ai dis dans mon post, cela ne fonctionne pas.
      0
    2. pitxu Messages postés 708 Statut Membre 95
       
      alors mets nous le code de ton graph
      0
    3. Melooo Messages postés 1476 Statut Membre 84
       
      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
  2. pitxu Messages postés 708 Statut Membre 95
     
    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
    1. Melooo Messages postés 1476 Statut Membre 84
       
      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