PhpGraphWeather n'est pas prévu pour que les graphs soient modifiés. Tu peux le faire mais il va falloir réécrire completement une partie du script, et c'est le plus difficile car il faut maitriser JPGraph et tout ce qui est placements. Si tu t'y connais un peu en php c'est faisable, faut juste y passer une matinée complète.
Sur le deuxième graph (pluie et vent), il y'a un axe avec la date et l'heure.
J'ai reussi a faire a peu près ce que je voulais, sauf que je n'arrive pas a mettre cet axe sous le premier graph.
Si tu as juste un indice après je me débrouillerai ...
Est ce que quelqu'un a un idée pour faire en sorte que l'image par défaut soit celle du jour?
Car si je ne remplie pas le formulaire, il n'y a pas de graph par défaut ...
Je suis un peu Hors-Sujet, mais il ne me manque pas grand chose
J'ai mis un peu de temps a voir comment fonctionner jpgraph. Mais c'est une bibliotheque qui permet de faire pas mal de truc sympa.
Je me suis donc permis de faire quelque modif sur le source mis a dispo par Titoine, et j'ai crée un nouveau script qui permet de sortir les stats annuelles.
J'arrive a peu près a faire ce que je veux :p, c'est génial jpgraph!
Il me reste juste deux questions:
L'axe des températures va jusqu'a 86 °C, est ce que je peux faire en sorte qu'il ne mette que les t° min et max de la période?
EDIT : j'ai trouvé pour ca:
Et comment faire pour afficher les données courantes dans "min and max", car je souhaiterais faire comme dans Graphweather, afficher les mini, maxi et actuel ...
J'ai fait une nouvelle requete pour afficher les derniers enregistrements ....
Si quelqu'un a la solution ...
PS: si vous avez le temps ... je ne veux pas paraitre ennuyeux avec mes questions :p
Voici le résultat:http://www.webnature.net/index.php?page=station
Dernière modification par siegfried le mar. avr. 03, 2007 11:08 am, modifié 1 fois.
Pour ton echelle de temp, le pb vient sans doute du fait de la courbe d'humidité.
En effet sur ton graph tu as 3 types de données sur l'axe des ordonnées (temp en °C, pression en mb, et humidite en %). Il faut utilser la commande ynaxis[n] pour la pression et l'humidté. Et la commande yaxis pour l'echelle des température.
/* Axe des ordonnées pour la température à gauche*/
$graph->yaxis->HideFirstTicklabel() ;
$graph->yaxis->SetFont(FF_COMIC,FS_NORMAL,8);
$graph->yaxis->title->SetFont(FF_COMIC,FS_NORMAL,10);
$graph->yaxis->title->SetColor('red');
$graph->yaxis->SetColor('red');
$graph->yaxis->title->Set("Température (C°)");
$graph->yaxis->title->SetMargin(10);
$graph->yaxis->SetTextLabelInterval(1);
$graph->yscale->ticks->Set($YTICK_INTERVAL+1,1);
$graph->ygrid->Show(true ,false);
/* Axe des ordonnées pour la pression a droite */
$graph->SetYScale(0,"int",$y1min-10,$y1max+10);
$graph->ynaxis[0]->SetTickSide(SIDE_LEFT);
$graph->ynaxis[0]->SetColor('lime');
$graph->ynaxis[0]->SetFont(FF_COMIC,FS_NORMAL,8);
$graph->ynaxis[0]->title->SetFont(FF_COMIC,FS_NORMAL,10);
$graph->ynaxis[0]->title->Set("Pression (hPa)");
$graph->ynaxis[0]->title->SetMargin(15);
$graph->ynaxis[0]->title->SetColor('lime');
$graph->ynaxis[0]->SetPosAbsDelta($MARGIN_MIDDLE_H1);
$graph->ynaxis[0]->SetTitleSide(SIDE_RIGHT);
/* Axe des ordonnées pour l'humidité a droite */
$graph->SetYScale(1,"int",0,100);
$graph->ynaxis[1]->SetTickSide(SIDE_RIGHT);
$graph->ynaxis[1]->SetColor('blue@0.8');
$graph->ynaxis[1]->SetFont(FF_COMIC,FS_NORMAL,8);
$graph->ynaxis[1]->title->SetFont(FF_COMIC,FS_NORMAL,10);
$graph->ynaxis[1]->title->Set("Humidité (%)");
$graph->ynaxis[1]->title->SetColor('blue@0.8');
$graph->ynaxis[1]->SetPosAbsDelta($MARGIN_MIDDLE_H1+60);
$graph->ynaxis[1]->SetTitleSide(SIDE_RIGHT);
Enfin pour determiner les min et max de la période sélectionner voila ce que j'ai ajouter dans le fichier graph.php :
.........
while ($list=mysql_fetch_array($query))
{
$y1data[$i]=$list[0];//press
$y2data[$i]=$list[1];//humi
$y3data[$i]=$list[2];//temp
$y4data[$i]=$list[3];//pt rose
$y5data[$i]=$list[4];//fact vent
$count[round($list[5])]=$count[round($list[5])]+1;//dir vent
$y6data[$i]=$list[6];//vit vent
$y7data[$i]=$list[7];//pluie
switch($MYSQL_TIMESTAMP)
{
case 0 :
$timestamp[$i]=$list[8];
break;
default: case 1:
sscanf($list[8],"%4d%2d%2d%2d%2d%2d",$a_year,$a_month,$a_day,$a_hours,$a_minutes,$a_seconds);
$timestamp[$i]=intval(mktime($a_hours,$a_minutes,$a_seconds,$a_month,$a_day,$a_year,-1));
break;
}
/* AJOUT DU CODE SUIVANT POUR AFFICHER LES MINI ET MAXI SUR LA PERIODE SELECTIONNEE */
if ($y1data[$i] > $y1max)
{
$y1max = $y1data[$i];
$y1tmax =date("H:i d/m",$timestamp[$i]);
}
if ($y1data[$i] < $y1min)
{
$y1min = $y1data[$i];
$y1tmin =date("H:i d/m",$timestamp[$i]);
}
if ($y2data[$i] > $y2max)
{
$y2max = $y2data[$i];
$y2tmax =date("H:i d/m",$timestamp[$i]);
}
if ($y2data[$i] < $y2min)
{
$y2min = $y2data[$i];
$y2tmin =date("H:i d/m",$timestamp[$i]);
}
if ($y3data[$i] > $y3max)
{
$y3max = $y3data[$i];
$y3tmax =date("H:i d/m",$timestamp[$i]);
}
if ($y3data[$i] < $y3min)
{
$y3min = $y3data[$i];
$y3tmin =date("H:i d/m",$timestamp[$i]);
}
if ($y4data[$i] > $y4max)
{
$y4max = $y4data[$i];
$y4tmax =date("H:i d/m",$timestamp[$i]);
}
if ($y4data[$i] < $y4min)
{
$y4min = $y4data[$i];
$y4tmin =date("H:i d/m",$timestamp[$i]);
}
if ($y6data[$i] > $y6max)
{
$y6max = $y6data[$i];
$y6tmax =date("H:i d/m",$timestamp[$i]);
}
if ($y6data[$i] < $y6min)
{
$y6min = $y6data[$i];
$y6tmin =date("H:i d/m",$timestamp[$i]);
}
if ($y7data[$i] > $y7max)
{
$y7max = $y7data[$i];
$y7tmax =date("H:i d/m",$timestamp[$i]);
}
if ($y7data[$i] < $y7min)
{
$y7min = $y7data[$i];
$y7tmin =date("H:i d/m",$timestamp[$i]);
}
$i++;
}
.......
/* FIN AJOUT DU CODE SUIVANT POUR AFFICHER LES MINI ET MAXI SUR LA PERIODE SELECTIONNEE */
Super pour ynaxis[n] ... le résultat est impeccable.
Par contre j'ai toujours le même soucis pour la température ... je cherche.
Je vais quand meme faire une recherche dans ma base SQL pour voir si il n'y a pas eu un bug dans les températures ...
Edit: pas de données éronnées dans la base ... je ne comprend pas ... mais je cherche activement
Dernière modification par siegfried le mar. avr. 03, 2007 5:11 pm, modifié 1 fois.