[ Index ] |
|
Code source de jpGraph 2.2 |
1 <?php 2 include ("../jpgraph.php"); 3 include ("../jpgraph_bar.php"); 4 5 $datay=array(12,0,-19,-7,17,-6); 6 7 // Create the graph. 8 $graph = new Graph(400,300,"auto"); 9 $graph->img->SetMargin(60,30,50,40); 10 $graph->SetScale("textlin"); 11 $graph->SetShadow(); 12 13 $graph->title->SetFont(FF_ARIAL,FS_BOLD,15); 14 $graph->title->Set("Cash flow "); 15 $graph->subtitle->Set("Shows some possible patterns for bands"); 16 17 // Show both X and Y grid 18 $graph->xgrid->Show(true,false); 19 20 // Add 10% grace ("space") at top and botton of Y-scale. 21 $graph->yscale->SetGrace(10,10); 22 23 // Turn the tick mark out from the plot area 24 $graph->xaxis->SetTickSide(SIDE_DOWN); 25 $graph->yaxis->SetTickSide(SIDE_LEFT); 26 27 // Create a bar pot 28 $bplot = new BarPlot($datay); 29 $bplot->SetFillColor("orange"); 30 $bplot->SetShadow(); 31 32 // Show the actual value for each bar on top/bottom 33 $bplot->value->Show(true); 34 $bplot->value->SetFormat("%02d kr"); 35 36 // Position the X-axis at the bottom of the plotare 37 $graph->xaxis->SetPos("min"); 38 39 // .. and add the plot to the graph 40 $graph->Add($bplot); 41 42 // Add upper and lower band and use no frames 43 $band[0]=new PlotBand(HORIZONTAL,BAND_RDIAG,10,20,"green"); 44 $band[0]->ShowFrame(false); 45 $band[1]=new PlotBand(HORIZONTAL,BAND_LDIAG,-20,-10,"red"); 46 $band[1]->ShowFrame(false); 47 $band[1]->SetDensity(20); 48 $band[2]=new PlotBand(HORIZONTAL,BAND_DIAGCROSS,"min",-20,"red"); 49 $band[2]->ShowFrame(false); 50 $band[2]->SetDensity(40); 51 $band[3]=new PlotBand(VERTICAL,BAND_HLINE,0,1,"darkgray"); 52 $band[3]->ShowFrame(false); 53 $band[3]->SetOrder(DEPTH_FRONT); 54 $band[4]=new PlotBand(VERTICAL,BAND_HVCROSS,5,"max","darkgray"); 55 $band[4]->ShowFrame(false); 56 $band[4]->SetOrder(DEPTH_FRONT); 57 $band[5]=new PlotBand(HORIZONTAL,BAND_SOLID,20,"max","lightgreen"); 58 $band[6]=new PlotBand(HORIZONTAL,BAND_3DPLANE,-10,0,"blue"); 59 $band[6]->SetDensity(70); 60 $graph->AddBand($band); 61 62 $graph->AddLine(new PlotLine(HORIZONTAL,0,"black",2)); 63 64 //$graph->title->Set("Test of bar gradient fill"); 65 $graph->xaxis->title->Set("X-title"); 66 $graph->yaxis->title->Set("Y-title"); 67 68 $graph->yaxis->title->SetFont(FF_ARIAL,FS_BOLD,11); 69 $graph->xaxis->title->SetFont(FF_ARIAL,FS_BOLD,11); 70 71 $graph->Stroke(); 72 ?>
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 |
![]() |