Bonjour,
J'utilises actuellement un script qui permet de réaliser des graphiques via jpgraph!
Ce script utilise des fichiers TXT!
Mon système est asser vieux!
J'aimerai pouvoir rajouter une fonction de formulaire déroulant:
c'est à dire au lieu de rentré par copie coller le nom du fichier TXt j'aimerai que le formulaire sois déroulant en montrant tous les fichier avec l'extension .txt présent dans un répertoire de mon hébergeur!
voici les lignes de mon code:
<? include ( "/***share/jpgraph/jpgraph.php"); include ("/***/jpgraph/jpgraph_line.php"); // The callback that converts timestamp to minutes and seconds function TimeCallback($aVal) { return Date('H:i:s',$aVal); } if ($nomfile == "") { echo("<h3>Le champ nom est vide !</h3>"); $valide = false; } else { $readfile = file($nomfile); } for ($k=1; $k<=count($readfile)-1; $k++) { $fields = split("\t",$readfile[$k]); $temps[] = $fields[0]*60; $powerc[] = $fields[1]; $power[] = $fields[2]; $presc[] = $fields[3]; $press[] = $fields[4]; $temp[] = $fields[5]; $depla[]= $fields[6]/10; } //$delta_t = $temps[1]-$temps[0] //Set data to plot switch($plot1) { case 0: $ydata = $power; break; case 1: $ydata = $temp; break; case 2: $ydata = $press; break; case 3: $ydata = $presc; break; case 4: $ydata = $powerc; break; case 5: $ydata = $depla; break; } switch($plot2) { case 0: $y2data = $power; break; case 1: $y2data = $temp; break; case 2: $y2data = $press; break; case 3: $y2data = $presc; break; case 4: $y2data = $powerc; break; case 5: $y2data = $depla; break; } // Create the graph. These two calls are always required $graph = new Graph(750,375,"auto"); $graph->img->SetMargin(50,100,50,75); //$graph->SetScale("textlin"); $graph->SetScale("linlin"); $graph->SetShadow(); $interval=$k/10; $graph->xaxis->SetTextTickInterval($interval,1); $graph->SetY2Scale("lin"); // Create the linear plot $xdata=$temps; $lineplot=new LinePlot($ydata,$xdata); $lineplot2=new LinePlot($y2data,$xdata); switch($plot1) { case 0: $lineplot ->SetLegend("P(W)"); break; case 1: $lineplot ->SetLegend("T©"); break; case 2: $lineplot ->SetLegend("P(bar)"); break; case 3: $lineplot ->SetLegend("Pc(bar)"); break; case 4: $lineplot ->SetLegend("Pc(W)"); break; case 5: $lineplot ->SetLegend("d(mm)"); break; } switch($plot2) { case 0: $lineplot2 ->SetLegend("P(W)"); break; case 1: $lineplot2 ->SetLegend("T©"); break; case 2: $lineplot2 ->SetLegend("P(bar)"); break; case 3: $lineplot2 ->SetLegend("Pc(bar)"); break; case 4: $lineplot2 ->SetLegend("Pc(W)"); break; case 5: $lineplot2 ->SetLegend("d(mm)"); break; } $graph ->legend->Pos( 0.01,0.5,"right" ,"center"); // Add the plot to the graph $graph->Add($lineplot); $graph->AddY2($lineplot2); $lineplot2->SetColor("orange"); $lineplot2->SetWeight(2); $graph->y2axis->SetColor("orange"); $graph->title->Set("Belt parameters ON LINE"); //$graph->xaxis->title->Set("Time x step "); //$graph->yaxis->title->Set("Belt on line"); $graph->title->SetFont(FF_FONT1,FS_BOLD); $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); $graph->xaxis->SetLabelFormatCallback('TimeCallback'); $graph->xaxis->SetLabelAngle(90); $lineplot->SetColor("blue"); $lineplot->SetWeight(2); $lineplot2->SetColor("orange"); $lineplot2->SetWeight(2); $graph->yaxis->SetColor("blue");// Display the graph $graph->Stroke(); //$graph ->Stroke("***/images/result2002.png" ); ?>
Merci de votre aide