[ Index ]
 

Code source de jpGraph 2.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/src/Examples/ -> staticbandbarex7.php (source)

   1  <?php
   2  include  ("../jpgraph.php");
   3  include  ("../jpgraph_bar.php");
   4  
   5  $datay=array(12,5,19,22,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("Use of static line, 3D and solid band");
  16  
  17  // Turn off Y-grid (it's on by default)
  18  $graph->ygrid->Show(false);
  19  
  20  // Add 10% grace ("space") at top of Y-scale. 
  21  $graph->yscale->SetGrace(10);
  22  $graph->yscale->SetAutoMin(-20);
  23  
  24  // Turn the tick mark out from the plot area
  25  $graph->xaxis->SetTickSide(SIDE_DOWN);
  26  $graph->yaxis->SetTickSide(SIDE_LEFT);
  27  
  28  // Create a bar pot
  29  $bplot = new BarPlot($datay);
  30  $bplot->SetFillColor("orange");
  31  $bplot->SetShadow("darkblue");
  32  
  33  // Show the actual value for each bar on top/bottom
  34  $bplot->value->Show(true);
  35  $bplot->value->SetFormat("%02d kr");
  36  
  37  // Position the X-axis at the bottom of the plotare
  38  $graph->xaxis->SetPos("min");
  39  
  40  // .. and add the plot to the graph
  41  $graph->Add($bplot);
  42  
  43  // Add upper and lower band and use no frames
  44  $band[0]=new PlotBand(HORIZONTAL,BAND_3DPLANE,"min",0,"blue");
  45  $band[0]->ShowFrame(false);
  46  $band[0]->SetDensity(20);
  47  $band[1]=new PlotBand(HORIZONTAL,BAND_SOLID,0,"max","steelblue");
  48  $band[1]->ShowFrame(false);
  49  $graph->Add($band);
  50  
  51  $graph->Add(new PlotLine(HORIZONTAL,0,"black",2));
  52  
  53  //$graph->title->Set("Test of bar gradient fill");
  54  $graph->xaxis->title->Set("X-title");
  55  $graph->yaxis->title->Set("Y-title");
  56  
  57  $graph->yaxis->title->SetFont(FF_ARIAL,FS_BOLD,11);
  58  $graph->xaxis->title->SetFont(FF_ARIAL,FS_BOLD,11);
  59  
  60  $graph->Stroke();
  61  ?>


Généré le : Sat Nov 24 09:27:55 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics