Forum de discussion et d'aide au php
Vous n'êtes pas identifié.
|
Regles d'utilisation des forums : pensez à toujours les respecter si vous désirez obtenir des réponses rapides. FAQ : pensez à toujours chercher dedans si la réponse à votre question est dedans. Proposez vos news : si vous avez un evenement à annoncer le chat : venez discuter de php. |
||
Bonjour tout le monde j'ai besoin de votre aide pour une application relativement simple.
A l'adresse suivante :
http://pasqua.ovh.org/resultats.php
Login : user
Pass : user
Je fais un affichage dynamique des résultats récupérés dans une base de données, quand je clique dessus j'ouvre une nouvelle page
http://pasqua.ovh.org/details.php?id=36 et l'image générée par php ne correspond pas aux données que j'ai il faut obligatoirement que je rafraichisse ma page pour obtenir la bonne image.
*******************************Le code de ma page resultats.php*****************************
<?php
include ("include/header.php");
?>
<?php
$nom = $_SESSION['nom_utilisateur'];
$prenom = $_SESSION['prenom_utilisateur'];
?>
<div class="titre">Résultats des évaluations</div>
<br />
<table cellpadding="0" cellspacing="0" width="300px" align="center">
<tr>
<td><a href="index.php"><img src="images/btn_prec.gif" border="0" /></a></td>
</tr>
</table>
<br />
<table border="0" cellspacing="0" cellpadding="0">
<?php
//Requete à la base de données de séléctionner toutes les données de la table résultats en les classant par "date_heure" et ordre alphabétique.
$req_resultats= mysql_query("SELECT * FROM resultats WHERE nom='$nom' AND prenom='$prenom' ORDER BY date_heure ASC");
while ($data_resultats = mysql_fetch_array($req_resultats)) // On fait une boucle pour lister les news
{
?>
<tr>
<td width="120px" align="center">Résultats du </td>
<td><?php echo '<a href="details.php?id='.$data_resultats['id'].'">'.$data_resultats['date_heure'].' '.$data_resultats['nom'].' '.$data_resultats['prenom'].'</a>' ?></td>
</tr>
<?php
} // Fin de la boucle qui liste les news
?>
</table>
<?php
include ("include/footer.php");
?>******************Le code de ma page details.php****************************
<?php include("include/header.php");
//Récupération des données de la base
extract($_GET);
$sql_res = "SELECT * FROM resultats WHERE id='$id'"; // Récupérer les données lorsque id ='$id'
$req_res = mysql_query($sql_res, $connection);
$data_res = mysql_fetch_assoc($req_res);
//<div class="titre">Détails concernant le test du echo $data_res['date_heure']</div>
//<br />
include("class.graphique3dbars.php");
//Création de la fonction graphique
$Graphique = new GraphiqueCommande;
//Création des bordures (taille en pixel, couleur)
$Graphique->SetBorder (1, "Noir");
//Création des espaces (gauche, droite, haut, bas )
$Graphique->SetGraphPadding (70, 10, 20, 20);
//Affichage des valeurs sur la gauche
$Graphique->SetValueShow (true);
//Taille du graph en pixel (hauteur , largeur)
$Graphique->SetGraphSize (300, 600);
//Affichage du titre (titre, alignement, taille)
$Graphique->SetGraphTitle ("Vos compétences génériques ", "center", 3);
//Paramètrage des polices (taille, couleur)
$Graphique->SetGraphFont (2, "FontNoir");
//Paramètrage de la transparence (valeur)
$Graphique->SetGraphDeepness(10);
//affichage de l'échelle du graph en pourcentage (valeur)
$Graphique->SetGraphYScale (4);
//Affichage des barres en couleurs (couleur de la barre , couleur de la bordure)
$Graphique->SetBarsColor ("BleuPale", "BleuFonce");
//Affichage des données dans un tableau
$Data = array(round($data_res['val_mark_com'],1), round($data_res['val_manager'],1), round($data_res['val_gest_fin'],1), round($data_res['val_gest_ress'],1));
//Afficahge des compétences en ordonnées
$Values = array("Marketing & Commerciale", "Managériale", "Gest. Financière", "Gest. en Ress. Humaine");
$Graphique->SetGraphData ($Values, $Data);
//Nom de l'image à creer
$Graphique->DrawGraphArea ("temp");
echo $data_res['id'].'<br>';
echo round($data_res['val_mark_com'],1).'<br>';
echo round($data_res['val_manager'],1).'<br>';
echo round($data_res['val_gest_fin'],1).'<br>';
echo round($data_res['val_gest_ress'],1).'<br>';
?>
<div class="legende">
Le classement se fait selon 4 niveaux :
<br />
Niveau 1 : 0-25 % de bonnes réponses dans la compétence correspondante
<br />
Niveau 2 : 25-50 % de bonnes réponses dans la compétence correspondante
<br />
Niveau 3 : 50-75 % de bonnes réponses dans la compétence correspondante
<br />
Niveau 4 : 75-100 % de bonnes réponses dans la compétence correspondante
</div>
<table width="200px" align="center">
<tr>
<td width="100px"><a href="resultats.php"><img src="images/btn_prec.gif" border="0"/></a></td>
<td width="100px"></td>
</tr>
</table>
<?php
include ("include/footer.php");
?>*****************Le code de ma page class.graphique3dbars.php*********
<?php
/**
*
* Cette classe permet de créer des graphiques à barres en 3D entièrement personnalisable.
*
* @version 0.2.0
* @todo - Prendre en charge les valeurs négatives
* - Permettre la position horizontale du graphique
*/
class GraphiqueCommande
{
var $Img;
var $Colors;
var $Values = array();
var $Data = array();
//Calcul de la taille du graph
var $Graph_Size = array('AreaHeight' => 0, 'OverallHeight' => 0, 'AreaWidth' => 0, 'OverallWidth' => 0);
//Calcul des espaces du tableau
var $Graph_Padding = array('Left' => 0, 'Right' => 0, 'Top' => 0, 'Bottom' => 0);
//Couleur de fond d'écran
//Couleur demandé par l'idap : Vanille
var $Graph_BackColor = 'Vanille';
//Couleur de fond
var $Graph_AreaBackColor = 'BleuClair';
//paramètre de la zone d'image (taille des bordures, couleur)
var $Graph_Border = array('AreaBorder' => 1, 'AreaBorderColor' => 'Noir', 'Border' => 1, 'BorderColor' => 'Noir');
//Défini comme valeur par défaut la valeur des Y
var $Graph_BiggestValue = 4;
//Valeur de l'opacité
var $Graph_Deepness = 10;
//Couler des barres
var $Graph_BarColor = 'Mauve';
//Couleur des bordures des barres
var $Graph_BarBorderColor = 'Noir';
//Taille d'espacement des barres
var $Graph_BarSpacing = 10;
//Affichage des graduations
var $Graph_ShowValues = true;
//
var $Graph_DashedFirst = 'Noir';
var $Graph_DashedSecond = 'BleuPale';
//Echelle de l'axe Y
var $AxisYScale = 4;
//Couleur des axes
var $AxisColor = 'Noir';
//Couleur de la police en EM
var $Graph_FontSize = 2;
//Couleur de la police
var $Graph_FontColor = 'FontNoir';
//Position du titre du graphique (left, center, right)
var $Graph_TitlePosition = 'center';
//Titre du graphique
var $Graph_Title = 'Classe de création de graphique';
//Marges entre le titre et le haut
var $Graph_TitleTop = 3;
/* --------------------------------------- */
/* Fonctions de paramétrages du graphiques */
/* --------------------------------------- */
/**
*
* Paramètrage de l'affichage des valeurs
*
* @name SetValueShow();
* @param (bool) $Show ( Afficher oui ou non la valeur des barres)
*
*/
function SetValueShow($Show)
{
$this->Graph_ShowValues = $Show;
}
/**
*
* Paramètrage de l'échelle sur l'axe des Y
*
* @name SetGraphYScale();
* @param (string) $Color ( Couleur des barres )
* @param (string) $BorderColor ( Couleur des bordures des barres )
*
*/
function SetBarsColor($Color, $BorderColor)
{
$this->Graph_BarColor = $Color;
$this->Graph_BarBorderColor = $BorderColor;
}
/**
*
* Paramètrage de l'échelle sur l'axe des Y
*
* @name SetGraphYScale();
* @param (int) $Y ( Une ligne apparaîtera à tout les multiples de X )
*
*/
function SetGraphYScale($Y)
{
$this->AxisYScale = $Y;
}
/**
*
* Paramètrage de la profondeur du graphique
*
* @name SetGraphDeepness();
* @param (int) $Deepness ( La profondeur du graphique )
*
*/
function SetGraphDeepness($Deepness)
{
if(is_numeric($Deepness))
$this->Graph_Deepness = $Deepness;
}
/**
*
* Paramètrage du titre et de ses caractéristiques
*
* @name SetGraphTitle();
* @param (string) $Title ( Le titre du graphique
* @param (string) $Position ( 'center', 'right', 'left' )
* @param (int) $Top ( La position en hauteur du graphique )
*
*/
function SetGraphTitle($Title, $Position, $Top)
{
if($Position != 'center' && $Position != 'left' && $Position != 'right')
$Position = 'center';
$this->Graph_Title = $Title;
$this->Graph_TitlePosition = $Position;
}
/**
*
* Paramètrage de la police du graphique
*
* @name SetGraphFont();
* @param (int) $Size ( La taille du texte )
* @param (string) $Color ( Couleur du graphique dans la liste )
*
*/
function SetGraphFont($Size, $Color)
{
$this->Graph_FontSize = $Size;
$this->Graph_FontColor = $Color;
}
/**
*
* Paramètrage des données du graphique
*
* @name SetGraphData();
* @param (array(string)) $Values ( Les titres des barres )
* @param (array(int)) $Data ( La valeur numérique des barres )
*
*/
function SetGraphData($Values, $Data)
{
$this->Values = $Values;
$this->Data = $Data;
}
/**
*
* Paramètrage de l'espacement du graphique
*
* @name SetGraphPadding();
* @param (int) $Left ( L'espacement à gauche )
* @param (int) $Right ( L'espacement à droite )
* @param (int) $Top ( L'espacement en haut )
* @param (int) $Bottom ( L'espacement en bas )
*
*/
function SetGraphPadding($Left, $Right, $Top, $Bottom)
{
$this->Graph_Padding['Left'] = (int)$Left;
$this->Graph_Padding['Right'] = (int)$Right;
$this->Graph_Padding['Top'] = (int)$Top;
$this->Graph_Padding['Bottom'] = (int)$Bottom;
}
/**
*
* Paramètrage de l'espacement du graphique
*
* @name SetGraphPadding();
* @param (int) $Left ( L'espacement à gauche )
* @param (int) $Right ( L'espacement à droite )
* @param (int) $Top ( L'espacement en haut )
* @param (int) $Bottom ( L'espacement en bas )
*
*/
function SetGraphSize($Height, $Width)
{
if($this->Graph_ShowValues)
$HeightAddition = imagefontheight($this->Graph_FontSize);
else
$HeightAddition = 0;
$this->Graph_Size['AreaHeight'] = $Height - $this->Graph_Padding['Top'] - $this->Graph_Padding['Bottom'] - 1 - $this->Graph_Deepness - $HeightAddition;
$this->Graph_Size['OverallHeight'] = $Height;
$this->Graph_Size['AreaWidth'] = $Width - $this->Graph_Padding['Left'] - $this->Graph_Padding['Right'] - 1 + $this->Graph_Deepness;
$this->Graph_Size['OverallWidth'] = $Width + $this->Graph_Deepness;
}
/**
*
* Paramètrage de l'espacement du graphique
*
* @name SetBorder();
* @param (int) $GraphWidth ( La grosseur de la bordure )
* @param (string) $GraphColor ( La couleur de la bordure )
*
*/
function SetBorder($GraphWidth, $GraphColor)
{
$this->Graph_Border['BoderColor'] = $GraphColor;
$this->Graph_Border['Border'] = $GraphWidth;
}
/**
*
* Paramètrage de la palette de couleur
* * Appelé automatiquement lors de la création du graphique
*
* @name SetColorPalette();
*
*/
function SetColorPalette()
{
/* Ajouter vos couleurs personnalisées ici */
/* $this->Colors['NOM'] = imagecolorallocatealpha($this->Img, ROUGE, VERT, BLEU, TRANSPARENCE); */
#- Couleur pour les barres et les fonds
$this->Colors['Blanc'] = imagecolorallocatealpha($this->Img, 255, 255, 255, 0);
$this->Colors['Noir'] = imagecolorallocatealpha($this->Img, 0, 0, 0, 100);
$this->Colors['BleuPale'] = imagecolorallocatealpha($this->Img, 100, 150, 255, 20);
$this->Colors['Vert'] = imagecolorallocatealpha($this->Img, 0, 150, 0, 0);
$this->Colors['Mauve'] = imagecolorallocatealpha($this->Img, 215, 0, 215, 0);
$this->Colors['Rouge'] = imagecolorallocatealpha($this->Img, 255, 0, 0, 0);
$this->Colors['Orange'] = imagecolorallocatealpha($this->Img, 240, 150, 40, 0);
$this->Colors['Jaune'] = imagecolorallocatealpha($this->Img, 255, 255, 0, 0);
$this->Colors['BleuClair'] = imagecolorallocatealpha($this->Img, 215, 238, 254, 0);
$this->Colors['BleuFonce'] = imagecolorallocatealpha($this->Img, 3, 33, 131, 0);
$this->Colors['Canel'] = imagecolorallocatealpha($this->Img, 161, 26, 26, 20);
$this->Colors['Vanille'] = imagecolorallocatealpha($this->Img, 253, 252, 222, 0);
#- Couleur pour les textes
$this->Colors['NoirFont'] = imagecolorallocatealpha($this->Img, 0, 0, 0, 0);
}
/* --------------------------------- */
/* Fonctions de dessin du graphiques */
/* --------------------------------- */
/**
*
* Affichage des bordures du graphique
*
* @name DrawBorders();
*
*/
function DrawBorders()
{
#- Bordure du graphique + fond
imagefilledrectangle( $this->Img,
0,
0,
$this->Graph_Size['OverallWidth'] - 1,
$this->Graph_Size['OverallHeight'] - 1,
$this->Colors[$this->Graph_BackColor]
);
if($this->Graph_Border['Border'] > 0)
for($i = 0; $i < $this->Graph_Border['Border']; $i++)
imagerectangle( $this->Img,
$i,
$i,
$this->Graph_Size['OverallWidth'] - 1 - $i,
$this->Graph_Size['OverallHeight'] - 1 - $i,
$this->Colors[$this->Graph_Border['BorderColor']]
);
#- Bordure de l'area + fond
imagefilledrectangle( $this->Img,
$this->Graph_Padding['Left'],
$this->Graph_Padding['Top'],
$this->Graph_Padding['Left'] + $this->Graph_Size['AreaWidth'],
$this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'],
$this->Colors[$this->Graph_AreaBackColor]
);
imagerectangle( $this->Img,
$this->Graph_Padding['Left'],
$this->Graph_Padding['Top'],
$this->Graph_Padding['Left'] + $this->Graph_Size['AreaWidth'],
$this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'],
$this->Colors[$this->Graph_Border['AreaBorderColor']]
);
}
/**
*
* Affichage du title du graphique
*
* @name WriteTitle();
*
*/
function WriteTitle()
{
if($this->Graph_TitlePosition == 'center')
$TitleLeft = ($this->Graph_Size['OverallWidth'] / 2) - (imagefontwidth($this->Graph_FontSize) * strlen($this->Graph_Title) / 2);
elseif($this->Graph_TitlePosition == 'right')
$TitleLeft = ($this->Graph_Size['OverallWidth'] - (imagefontwidth($this->Graph_FontSize) * strlen($this->Graph_Title)));
elseif($this->Graph_TitlePosition == 'left')
$TitleLeft = 0 + $this->Graph_Border['Border'] * 2;
imagestring( $this->Img,
$this->Graph_FontSize,
$TitleLeft,
$this->Graph_TitleTop,
$this->Graph_Title,
$this->Colors[$this->Graph_FontColor]
);
}
/**
*
* Affichage de la valeurs des barres
*
* @name ShowBarsValues();
*
*/
function ShowBarsValues()
{
if($this->Graph_ShowValues)
{
//Nombre de ligne totale
$NbLine = 8;
//largeur = taille du padding haut + taille de la zone de largeur + taille du padding bas + 1 + transparence + création de l'image de fond
$realHeight = $this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'] + $this->Graph_Padding['Bottom'] + 1 + ($this->Graph_Deepness) + imagefontheight($this->Graph_FontSize);
//largeur du graph = taille largeur de la taille du graph
$graphHeight = $this->Graph_Size['AreaHeight'];
//démarrage du graph = largeur réelle - (padding bas + 1 + transparence + image de fond)
$graphStart = $realHeight - ($this->Graph_Padding['Bottom'] + 1 + ($this->Graph_Deepness) + imagefontheight($this->Graph_FontSize));
//variable de la valeur de find du graph = valeur de démarrage - valeur de la largeur
$graphEnd = $graphStart - $graphHeight;
//pour i = 1 tant que i inférieur au NBline incrémenter jusqu'a arrivé au NBline
for($i = 1; $i <= $NbLine; $i++)
{
//echelle Y = valeur de départ - (valeur de la largeur divisé par nombre de ligne multiplié par i)
$ScaleY = $graphStart - (($graphHeight / $NbLine) * $i);
//fonction imageline
imageline( $this->Img,
$this->Graph_Padding['Left'],
$ScaleY,
$this->Graph_Padding['Left'] + $this->Graph_Size['AreaWidth'],
$ScaleY,
IMG_COLOR_STYLED);
$Valeur = ($this->Graph_BiggestValue / $NbLine) * $i;
imagestring($this->Img,
$this->Graph_FontSize,
10,
//Variable de l'échelle moins 7
$ScaleY - 7,
//Variable de la valeur
$Valeur,
$this->Colors[$this->Graph_FontColor]);
}
}
}
/**
*
* Affichage et création du graphique
*
* @name DrawGraphArea();
* @param (string) $Name ( Nom de l'image )
*
*/
function DrawGraphArea($Name)
{
$this->Img = imagecreatetruecolor($this->Graph_Size['OverallWidth'], $this->Graph_Size['OverallHeight']);
imagealphablending($this->Img, true);
//Calcul de valeur maximum des ordonnées pour la création de l'axe Y
//Pour i = 0 incrémenter jusqu'a ce que la valeur data des données soit atteinte
for($i = 0; $i < count($this->Data); $i++)
//Si les données de i sont supérieur à la la valeur maximum des y du graph
if($this->Data[$i] > $this->Graph_BiggestValue)
//alors la valeur maximum du graph sera
$this->Graph_BiggestValue = $this->Data[$i];
//Reglage la palette de couleur
$this->SetColorPalette();
// Dessin des bordures
$this->DrawBorders();
//Affichage du titre
$this->WriteTitle();
//Dessin des axes
$this->DrawAxis();
//Affichage des Barres de valeurs
$this->ShowBarsValues();
//Dessin des barres
$this->DrawBars();
imagepng($this->Img, $Name.'.png');
echo '<div align="center"><img src="'.$Name.'.png"></div>';
}
/**
*
* Affichage des axes et des côtées du graphiuqe
*
* @name DrawAxis();
*
*/
function DrawAxis()
{
#- Côtés du graphique pour l'échelle
$X1 = $this->Graph_Padding['Left'];
#- Droite
$Y1 = $this->Graph_Padding['Top'];
$Droite = array($X1 - $this->Graph_Deepness, $Y1 + $this->Graph_Deepness, $X1, $Y1, $X1, $Y1 + $this->Graph_Size['AreaHeight'], $X1 - $this->Graph_Deepness, $Y1 + $this->Graph_Size['AreaHeight'] + $this->Graph_Deepness);
imagefilledpolygon($this->Img, $Droite, 4, $this->Colors[$this->Graph_AreaBackColor]);
imagepolygon($this->Img, $Droite, 4, $this->Colors[$this->AxisColor]);
#- Bas
$Y1 = $this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'];
$Bas = array($X1 - $this->Graph_Deepness, $Y1 + $this->Graph_Deepness, $X1, $Y1, $X1 + $this->Graph_Size['AreaWidth'], $Y1, $X1 + $this->Graph_Size['AreaWidth'] - $this->Graph_Deepness, $Y1 + $this->Graph_Deepness);
imagefilledpolygon( $this->Img, $Bas, 4, $this->Colors[$this->Graph_AreaBackColor]);
imagepolygon($this->Img, $Bas, 4, $this->Colors[$this->AxisColor]);
#- Lignes pointillées
$NbLine = $this->Graph_Size['AreaHeight'] / ($this->AxisYScale / $this->Graph_BiggestValue * $this->Graph_Size['AreaHeight']);
$ScaleY = $this->Graph_Size['AreaHeight'] / $NbLine;
$st = array($this->Colors[$this->Graph_DashedFirst], $this->Colors[$this->Graph_DashedFirst], $this->Colors[$this->Graph_DashedSecond], $this->Colors[$this->Graph_DashedSecond], $this->Colors[$this->Graph_DashedSecond]);
ImageSetStyle($this->Img, $st);
for($i = 0; $i <= $NbLine; $i++)
{
imageline( $this->Img,
$this->Graph_Padding['Left'],
$this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'] - $i * $ScaleY,
$this->Graph_Padding['Left'] + $this->Graph_Size['AreaWidth'],
$this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'] - $i * $ScaleY,
IMG_COLOR_STYLED);
imageline( $this->Img,
$this->Graph_Padding['Left'],
$this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'] - $i * $ScaleY,
$this->Graph_Padding['Left'] - $this->Graph_Deepness,
$this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'] - $i * $ScaleY + $this->Graph_Deepness,
IMG_COLOR_STYLED);
imageline( $this->Img,
$this->Graph_Padding['Left'] - $this->Graph_Deepness,
$this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'] - $i * $ScaleY + $this->Graph_Deepness,
$this->Graph_Padding['Left'] - $this->Graph_Deepness - 5,
$this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'] - $i * $ScaleY + $this->Graph_Deepness,
IMG_COLOR_STYLED);
#- Écriture de la valeur
$Valeur = $this->AxisYScale * $i;
imagestring($this->Img,
$this->Graph_FontSize,
$this->Graph_Padding['Left'] - $this->Graph_Deepness - 10 - (imagefontwidth(i) * strlen($Valeur)),
$this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'] - $i * $ScaleY + $this->Graph_Deepness / 2,
$Valeur,
$this->Colors[$this->Graph_FontColor]);
}
}
/**
*
* Affichage des barres
*
* @name DrawBars();
*
*/
function DrawBars()
{
for($i = 0; $i < count($this->Data); $i++)
$Data2[] = $this->Data[$i] / $this->Graph_BiggestValue * $this->Graph_Size['AreaHeight'] - $this->Graph_Deepness;
$BarSize = $this->Graph_Size['AreaWidth'] - (count($this->Data) * ($this->Graph_BarSpacing + $this->Graph_Deepness));
$BarSize = floor($BarSize / count($this->Data));
$X1 = $this->Graph_Padding['Left'] + 1 + floor($this->Graph_BarSpacing / 2);
$X2 = $X1 + $BarSize;
$Y2 = $this->Graph_Padding['Top'] + $this->Graph_Size['AreaHeight'] + $this->Graph_Deepness;
for($i = 0; $i < count($Data2); $i++)
{
$Y1 = $this->Graph_Padding['Top'] + abs($Data2[$i] - $this->Graph_Size['AreaHeight']);
#- Base
$Base = array($X1, $Y2, $X1 + $this->Graph_Deepness, $Y2 - $this->Graph_Deepness, $X2 + $this->Graph_Deepness, $Y2 - $this->Graph_Deepness, $X2, $Y2);
imagefilledpolygon($this->Img, $Base, 4, $this->Colors[$this->Graph_BarColor]);
imagepolygon($this->Img, $Base, 4, $this->Colors[$this->Graph_BarBorderColor]);
#- Derrière
$Derriere = array($X1 + $this->Graph_Deepness, $Y1 - $this->Graph_Deepness, $X2 + $this->Graph_Deepness, $Y1 - $this->Graph_Deepness, $X2 + $this->Graph_Deepness, $Y2 - $this->Graph_Deepness, $X1 + $this->Graph_Deepness, $Y2 - $this->Graph_Deepness);
imagefilledpolygon($this->Img, $Derriere, 4, $this->Colors[$this->Graph_BarColor]);
imagepolygon($this->Img, $Derriere, 4, $this->Colors[$this->Graph_BarBorderColor]);
#- Gauche
$Gauche = array($X1, $Y2, $X1, $Y1, $X1 + $this->Graph_Deepness, $Y1 - $this->Graph_Deepness, $X1 + $this->Graph_Deepness, $Y2 - $this->Graph_Deepness);
imagefilledpolygon($this->Img, $Gauche, 4, $this->Colors[$this->Graph_BarColor]);
imagepolygon($this->Img, $Gauche, 4, $this->Colors[$this->Graph_BarBorderColor]);
#- Devant
$Devant = array($X1, $Y1, $X2, $Y1, $X2, $Y2, $X1, $Y2);
imagefilledpolygon($this->Img, $Devant, 4, $this->Colors[$this->Graph_BarColor]);
imagepolygon($this->Img, $Devant, 4, $this->Colors[$this->Graph_BarBorderColor]);
#- Droit
$Droit = array($X2, $Y1, $X2 + $this->Graph_Deepness, $Y1 - $this->Graph_Deepness, $X2 + $this->Graph_Deepness, $Y2 - $this->Graph_Deepness, $X2, $Y2);
imagefilledpolygon($this->Img, $Droit, 4, $this->Colors[$this->Graph_BarColor]);
imagepolygon($this->Img, $Droit, 4, $this->Colors[$this->Graph_BarBorderColor]);
#- Haut
$Haut = array($X1, $Y1, $X1 + $this->Graph_Deepness, $Y1 - $this->Graph_Deepness, $X2 + $this->Graph_Deepness, $Y1 - $this->Graph_Deepness, $X2, $Y1);
imagefilledpolygon($this->Img, $Haut, 4, $this->Colors[$this->Graph_BarColor]);
imagepolygon($this->Img, $Haut, 4, $this->Colors[$this->Graph_BarBorderColor]);
#- Écriture des valeurs
$TextWidth = imagefontwidth($this->Graph_FontSize) * strlen($this->Values[$i]);
$Left = ($X1 + ($BarSize / 2)) - ($TextWidth / 2);
imagestring( $this->Img,
$this->Graph_FontSize,
$Left,
$Y2 + 2,
$this->Values[$i],
$this->Colors[$this->Graph_FontColor]
);
if($this->Graph_ShowValues)
{
$TextWidth = imagefontwidth($this->Graph_FontSize) * strlen('('.$this->Data[$i].')');
//Remplacement des "2" par "1"
$Left = ($X1 + ($BarSize / 2)) - ($TextWidth / 2);
imagestring( $this->Img,
$this->Graph_FontSize,
$Left,
$Y2 + 2 + imagefontheight($this->Graph_FontSize),
'('.$this->Data[$i].')',
$this->Colors[$this->Graph_FontColor]
);
}
$X1 += $this->Graph_Deepness + $BarSize + $this->Graph_BarSpacing;
$X2 += $this->Graph_Deepness + $BarSize + $this->Graph_BarSpacing;
}
}
}
?>Hors ligne