[ Index ] |
|
Code source de jpGraph 2.2 |
1 <?php 2 // Example for use of JpGraph, 3 // ljp, 01/03/01 19:44 4 include ("../jpgraph.php"); 5 include ("../jpgraph_bar.php"); 6 include ("../jpgraph_line.php"); 7 8 // We need some data 9 $datay=array(0.3031,0.3044,0.3049,0.3040,0.3024,0.3047); 10 11 // Setup the graph. 12 $graph = new Graph(400,200,"auto"); 13 $graph->img->SetMargin(60,30,30,40); 14 $graph->SetScale("textlin"); 15 $graph->SetMarginColor("teal"); 16 $graph->SetShadow(); 17 18 // Create the bar pot 19 $bplot = new BarPlot($datay); 20 $bplot->SetWidth(0.6); 21 22 // This is how you make the bar graph start from something other than 0 23 $bplot->SetYMin(0.302); 24 25 // Setup color for gradient fill style 26 $tcol=array(100,100,255); 27 $fcol=array(255,100,100); 28 $bplot->SetFillGradient($fcol,$tcol,GRAD_HOR); 29 $bplot->SetFillColor("orange"); 30 $graph->Add($bplot); 31 32 // Set up the title for the graph 33 $graph->title->Set("Bargraph which doesn't start from y=0"); 34 $graph->title->SetColor("yellow"); 35 $graph->title->SetFont(FF_VERDANA,FS_BOLD,12); 36 37 // Setup color for axis and labels 38 $graph->xaxis->SetColor("black","white"); 39 $graph->yaxis->SetColor("black","white"); 40 41 // Setup font for axis 42 $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10); 43 $graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10); 44 45 // Setup X-axis title (color & font) 46 $graph->xaxis->title->Set("X-axis"); 47 $graph->xaxis->title->SetColor("white"); 48 $graph->xaxis->title->SetFont(FF_VERDANA,FS_BOLD,10); 49 50 // Finally send the graph to the browser 51 $graph->Stroke(); 52 ?>
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 |
![]() |