[ Index ] |
|
Code source de jpGraph 2.2 |
1 <?php 2 include ("../jpgraph.php"); 3 include ("../jpgraph_bar.php"); 4 5 $datay=array(2,3,5,8,12,6,3); 6 $datax=array("Jan","Feb","Mar","Apr","May","Jun","Jul"); 7 8 // Size of graph 9 $width=400; 10 $height=500; 11 12 // Set the basic parameters of the graph 13 $graph = new Graph($width,$height,'auto'); 14 $graph->SetScale("textlin"); 15 16 // Rotate graph 90 degrees and set margin 17 $graph->Set90AndMargin(50,20,50,30); 18 19 // Nice shadow 20 $graph->SetShadow(); 21 22 // Setup title 23 $graph->title->Set("Horizontal bar graph ex 1"); 24 $graph->title->SetFont(FF_VERDANA,FS_BOLD,14); 25 $graph->subtitle->Set("(No Y-axis)"); 26 27 // Setup X-axis 28 $graph->xaxis->SetTickLabels($datax); 29 $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,12); 30 31 // Some extra margin looks nicer 32 $graph->xaxis->SetLabelMargin(10); 33 34 // Label align for X-axis 35 $graph->xaxis->SetLabelAlign('right','center'); 36 37 // Add some grace to y-axis so the bars doesn't go 38 // all the way to the end of the plot area 39 $graph->yaxis->scale->SetGrace(20); 40 41 // We don't want to display Y-axis 42 $graph->yaxis->Hide(); 43 44 // Now create a bar pot 45 $bplot = new BarPlot($datay); 46 $bplot->SetFillColor("orange"); 47 $bplot->SetShadow(); 48 49 //You can change the width of the bars if you like 50 //$bplot->SetWidth(0.5); 51 52 // We want to display the value of each bar at the top 53 $bplot->value->Show(); 54 $bplot->value->SetFont(FF_ARIAL,FS_BOLD,12); 55 $bplot->value->SetAlign('left','center'); 56 $bplot->value->SetColor("black","darkred"); 57 $bplot->value->SetFormat('%.1f mkr'); 58 59 // Add the bar to the graph 60 $graph->Add($bplot); 61 62 // .. and stroke the graph 63 $graph->Stroke(); 64 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:27:55 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |