Programmation php

Résolu/Fermé
wiwi1989 Messages postés 10 Date d'inscription mardi 21 avril 2015 Statut Membre Dernière intervention 7 mai 2015 - Modifié par jordane45 le 6/05/2015 à 13:21
jordane45 Messages postés 38138 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 17 avril 2024 - 6 mai 2015 à 14:40
Bonjour qui peut m'aider svp je veux que la légende de mon histogramme apparaît sous forme carré non trait. voila mon code et mon histogramme et merci de votre aide.
<?php
require_once ('C:\Program Files\EasyPHP-DevServer-14.1VC11\data\localweb\local\src\jpgraph.php');
require_once ('C:\Program Files\EasyPHP-DevServer-14.1VC11\data\localweb\local\src\jpgraph_bar.php');
require_once ('C:\Program Files\EasyPHP-DevServer-14.1VC11\data\localweb\local\src\jpgraph_line.php');

session_start();
$m = $_SESSION['m1'];
$m2 = $_SESSION['m3'];
$m3 = $_SESSION['m4'];
$m4 = $_SESSION['m5'];
$m5 = $_SESSION['m6'];
$m6 = $_SESSION['m7'];
$m7 = $_SESSION['m8'];
$m8 = $_SESSION['m9'];
$m9 = $_SESSION['m10'];
$m10 = $_SESSION['m11'];
$m11 = $_SESSION['m12'] ;
 
header ("Content-type: image/png");  
// donnees des axes Y et X
$ydata = array($m, $m2, $m3, $m4, $m5, $m6, $m7, $m8, $m9, $m10, $m11);
$xdata = array('C1', 'C2', 'C3', 'C4', 'C5', 'C6','C7','C8','C9','C10','C11');
// creation du graphique
$graph = new Graph(count($ydata)*70, 400);
$graph->SetScale("textint");
// style
$graph->SetShadow();
$graph->SetColor('white');
$graph->SetMarginColor('gray6');
$graph->SetMargin(40, 30, 20, 40);// marge gauche, droite, haut, bas
// donner des titres et etiquettes
$graph->title->Set("Resultat audit organisationnel et physique");
$graph->yaxis->title->Set("moyenne");
$graph->xaxis->title->Set("chapitre");
$graph->xaxis->SetTickLabels($xdata);

// creation histogramme
$hist = new BarPlot($ydata);
$hist->SetWidth(0.6) ;
$hist->SetFillColor(array('#6A455D', '#FD3F92', '#D2CAEC','#00CCCB','#FC5D5D','#6600FF','#FF00FF','#FEE7F0','#048B9A','#DD985C','#25FDE9'));
$graph->legend->Pos(0.02,0.05);
$hist1 = new LinePlot($m);
$graph->Add($hist1);
$hist1->SetColor("#6A455D");
$hist1->SetLegend('chapitre1');
$hist2 = new LinePlot($m2);
$graph->Add($hist2);
$hist2->SetColor("#FD3F92");
$hist2->SetLegend('chapitre2');
$hist3 = new LinePlot($m3);
$graph->Add($hist3);
$hist3->SetColor("#D2CAEC");
$hist3->SetLegend('chapitre3');
$hist4 = new LinePlot($m4);
$graph->Add($hist4);
$hist4->SetColor("#00CCCB");
$hist4->SetLegend('chapitre4');
$hist5 = new LinePlot($m5);
$graph->Add($hist5);
$hist5->SetColor("#FC5D5D");
$hist5->SetLegend('chapitre5');

$graph->Add($hist);


// envoi image au format PNG
$graph->img->SetImgFormat("png"); // formats autorises : png, gif, jpg
$graph->Stroke();
?>







EDIT : Ajout des balises de code (la coloration syntaxique).
Explications disponibles ici :
https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code

Merci d'y penser dans tes prochains messages.
.
A voir également:

2 réponses

jordane45 Messages postés 38138 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 17 avril 2024 4 649
6 mai 2015 à 13:20
Bonjour,

1 - EDIT : Ajout des balises de code (la coloration syntaxique).
Explications disponibles ici :
https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code

Merci d'y penser dans tes prochains messages.
.

2 - Tu as des discussions ouvertes qui sont visiblement résolues ...
Merci d'aller les CLORE.(en cliquant sur le lien "Marquer comme résolu" qui se trouve sous le titre de la question)
- https://forums.commentcamarche.net/forum/affich-31924636-histogramme
- https://forums.commentcamarche.net/forum/affich-31930284-legende

3 - Qu'as tu essayé ?
Et puis.. je ne sais même pas si c'est faisable.... as tu regardé la doc ?




Cordialement,
Jordane


0
wiwi1989 Messages postés 10 Date d'inscription mardi 21 avril 2015 Statut Membre Dernière intervention 7 mai 2015
6 mai 2015 à 14:10
bonjour oui c fait ..peut tu m'aider à rendre ma légende sous forme carré et non trait.?c ça mon problème et merci bcpp
0
jordane45 Messages postés 38138 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 17 avril 2024 4 649
Modifié par jordane45 le 6/05/2015 à 14:41
Toute la doc est là https://jpgraph.net/download/manuals/classref/Legend.html
Par contre.. tu peux jouer sur le SENS des traits et leur épaisseur ... mais pas changer le type ...

Peut être qu'en jouant avec ces deux paramètres tu pourras approcher de ce que tu veux :
LEGEND_SETLAYOUT

LEGEND_SETLINEWEIGHT

Cordialement,
Jordane
0