Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > Images > JpGraph
JpGraph Forum d'entraide pour la bibliothèque JpGraph permettant de manipuler des images en PHP. Avant de poster -> tutoriels JpGraph
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 28/12/2007, 21h54   #1
Membre actif
 
Homme
Inscription : octobre 2006
Messages : 665
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Pas de Calais (Nord Pas de Calais)

Informations forums :
Inscription : octobre 2006
Messages : 665
Points : 197
Points : 197
Par défaut [JpGraph] Comment faire pour que la courbe remplisse bien le graph ?

Bonjour,

J'ai ma courbe qui ne va pas jusqu'au bout de chaque côté du graphique comme vous pouvez le voir ici :


Voici mon code :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
<?php
	include('JPGraph/jpgraph.php');
	include('JPGraph/jpgraph_date.php');
	include('JPGraph/jpgraph_regstat.php');
	include('JPGraph/jpgraph_line.php');
 
	function FormatXLabel($valeur)
	{
		return date("H:i\nd/m",$valeur);
	}
 
	function FormatYLabel($valeur)
	{
		return sprintf("%01.1f",$valeur);
	}		
 
	$temperature = new Graph(540,350);
	$temperature->SetAlphaBlending();
	$temperature->SetFrame(true,'white',1);
	$temperature->SetMarginColor('white');
	$temperature->SetMargin(65,25,45,75);
	$temperature->SetScale("datlin");
	$temperature->subtitle->Set('du '.date("d/m/Y H:i",$date_debut).' au '.date("d/m/Y H:i",$date_fin));	
	$temperature->xaxis->SetLabelFormatCallback('FormatXLabel');
	$temperature->xaxis->SetTextLabelInterval(2);
	$temperature->xaxis->SetPos('min');
	$temperature->xgrid->Show();
	$temperature->yaxis->SetLabelFormatCallback('FormatYLabel');
	$temperature->yaxis->title->Set("Température (°C)");
	$temperature->yaxis->SetTitleMargin(50);
 
	$temperature_spline = new Spline($temperature_datax,$temperature_datay);
	list($temperature_newx,$temperature_newy) = $temperature_spline->Get(50);
	$temperature_courbe = new LinePlot($temperature_newy,$temperature_newx);
 
	$temperature_courbe->SetColor('dodgerblue');
	$temperature_courbe->SetFillColor('dodgerblue@0.4');
 
	$temperature->Add($temperature_courbe);
 
	$temperature->Stroke(PATH_GRAPHIQUES.'temperature.png');
?>
Je penssai à ça :
Code :
1
2
 
$temperature->xaxis->SetTextLabelInterval(2);
Mais ce nest pas le cas.

Savez-vous de quoi ça peut venir et comment y remédier ?

Merci,
ZiP
[ZiP] est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/12/2007, 22h29   #2
Membre Expert
 
Avatar de eric.pommereau
 
Homme ERIC POMMEREAU
Ingénieur intégration
Inscription : décembre 2004
Messages : 683
Détails du profil
Informations personnelles :
Nom : Homme ERIC POMMEREAU
Âge : 38
Localisation : France

Informations professionnelles :
Activité : Ingénieur intégration
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : décembre 2004
Messages : 683
Points : 1 294
Points : 1 294
Salut,

Pourrais tu faire un
Code :
1
2
 
print_r($temperature_datax);
et
Code :
print_r($temperature_datay);
Et poster le résultat ???
eric.pommereau est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/12/2007, 22h33   #3
Membre actif
 
Homme
Inscription : octobre 2006
Messages : 665
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Pas de Calais (Nord Pas de Calais)

Informations forums :
Inscription : octobre 2006
Messages : 665
Points : 197
Points : 197
Salut,

J'ai trouvé ça peut vous être utile alors voici :
Code :
1
2
 
$graphique->xaxis->scale->SetTimeAlign(MINADJ_1);
La doc :
Citation:
function SetTimeAlign($aStartAlign,$aEndAlign)
Description
Specify the start and end alignment with the time granularity. For date granularity see SetDateAlign(). Note that only one of SetDateAlign() and SetTimeAlign() can be used. For start and end alignment the following values are valid

1. Alignment on seconds
* MINADJ_1, Align on a single second (This is the lowest resolution)
* MINADJ_5, Align on the nearest 5 seconds
* MINADJ_10, Align on the nearest 10 seconds
* MINADJ_15, Align on the nearest 15 seconds
* MINADJ_30, Align on the nearest 30 seconds
2. Alignment on minutes
* MINADJ_1, Align to the nearest minute
* MINADJ_5, Align on the nearest 5 minutes
* MINADJ_10, Align on the nearest 10 minutes
* MINADJ_15, Align on the nearest 15 minutes
* MINADJ_30, Align on the nearest 30 minutes
3. Alignment on hours
* HOURADJ_1, Align to the nearest hour
* HOURADJ_2, Align to the nearest two hour
* HOURADJ_3, Align to the nearest three hour
* HOURADJ_4, Align to the nearest four hour
* HOURADJ_6, Align to the nearest six hour
* HOURADJ_12, Align to the nearest tolw hour
ZiP
[ZiP] est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 02h51.


 
 
 
 
Partenaires

Hébergement Web