Configuration jpGraph dans Wamp server !
aminenaruto
Messages postés
19
Statut
Membre
-
mpmp93 Messages postés 2931 Date d'inscription Statut Membre Dernière intervention -
mpmp93 Messages postés 2931 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
je suis entrain de réaliser un site web avec dreamweaver cs5 et je veux utiliser des graphes pour cela j'ai téléchargé jpgraph mais je connais vraiment pas comment le configurer (installer) .
je travaille avec wamp server avec php version 5.3 .
Merci d'avance !
je suis entrain de réaliser un site web avec dreamweaver cs5 et je veux utiliser des graphes pour cela j'ai téléchargé jpgraph mais je connais vraiment pas comment le configurer (installer) .
je travaille avec wamp server avec php version 5.3 .
Merci d'avance !
2 réponses
-
Salut,
Il ne faut pas l'installer, mais juste faire des appels de fichiers dans les fichiers concernés...<?php require_once ('jpgraph/jpgraph.php'); require_once ('jpgraph/jpgraph_line.php'); $datay1 = array(20,15,23,15); $datay2 = array(12,9,42,8); $datay3 = array(5,17,32,24); // Setup the graph $graph = new Graph(300,250); $graph->SetScale("textlin"); $theme_class=new UniversalTheme; $graph->SetTheme($theme_class); $graph->img->SetAntiAliasing(false); $graph->title->Set('Filled Y-grid'); $graph->SetBox(false); $graph->img->SetAntiAliasing(); $graph->yaxis->HideZeroLabel(); $graph->yaxis->HideLine(false); $graph->yaxis->HideTicks(false,false); $graph->xgrid->Show(); $graph->xgrid->SetLineStyle("solid"); $graph->xaxis->SetTickLabels(array('A','B','C','D')); $graph->xgrid->SetColor('#E3E3E3'); // Create the first line $p1 = new LinePlot($datay1); $graph->Add($p1); $p1->SetColor("#6495ED"); $p1->SetLegend('Line 1'); // Create the second line $p2 = new LinePlot($datay2); $graph->Add($p2); $p2->SetColor("#B22222"); $p2->SetLegend('Line 2'); // Create the third line $p3 = new LinePlot($datay3); $graph->Add($p3); $p3->SetColor("#FF1493"); $p3->SetLegend('Line 3'); $graph->legend->SetFrameWeight(1); // Output line $graph->Stroke(); ?>
Les deux premières lignes permettent d'appeller 2 fichiers pour te permettre de construire des graphes en lignes
Plein d'autres exemples ici :
https://jpgraph.net/features/gallery.php#line1
tu n'a qu'a cliquer sur les graphes qui t'intéresse, et faire un copier coller et vérifier les chemins vers les fichiers et c'est bon -
Bonjour,
Sinon, il y a RGRAPH qui a mon humble avis est moins prise de tête coté serveur:
https://www.rgraph.net/
Je fais mes graphes avec; Ils sont générés coté client, l'appli n'envoie que les données, exemple:
<script> window.onload = function () { var bar = new RGraph.Bar('Canvas1',[[13,48],[6,14],[0,15],[2,8],[0,15],[4,5], [5,3],[21,2],[69,12],[220,46],[617,74],[525,66],[347,50],[260,72], [364,159],[407,187],[340,219],[329,705],[275,584],[173,567],[87,460], [63,401],[47,294],[30,178]]); bar.Set('chart.labels', ['00','01','02','03','04','05','06','07','08','09', '10','11', '12','13','14','15','16','17','18','19','20','21','22','23']); bar.Set('chart.gutter', 45); bar.Set('chart.background.barcolor1', 'rgba(255,255,255,1)'); bar.Set('chart.background.barcolor2', 'rgba(255,255,255,1)'); bar.Set('chart.background.grid', true); bar.Set('chart.colors', ['#ffa640','#99cccc']); bar.Draw(); } </script>
Enfin, on intègre l'élément canvas:
<canvas id="Canvas1" width="800" height="350">[No canvas support]</canvas>
et coté navigateur on a très beau graphe...
A+