| Line |  | 
|---|
| 1 | <?php // content="text/plain; charset=utf-8" | 
|---|
| 2 |  | 
|---|
| 3 | require_once ('jpgraph/jpgraph.php'); | 
|---|
| 4 | require_once ('jpgraph/jpgraph_bar.php'); | 
|---|
| 5 | require_once ('jpgraph/jpgraph_line.php'); | 
|---|
| 6 |  | 
|---|
| 7 |  | 
|---|
| 8 | $ydata = array(12,15,22,19,5); | 
|---|
| 9 |  | 
|---|
| 10 | $graph = new Graph(400,200); | 
|---|
| 11 | $graph->img->SetMargin(40,80,40,40); | 
|---|
| 12 | $graph->SetScale("textlin"); | 
|---|
| 13 | $graph->SetShadow(); | 
|---|
| 14 |  | 
|---|
| 15 | $graph->title->Set('Center the line points in bars'); | 
|---|
| 16 |  | 
|---|
| 17 | $line = new LinePlot($ydata); | 
|---|
| 18 | $line->SetBarCenter(); | 
|---|
| 19 | $line->SetWeight(2); | 
|---|
| 20 |  | 
|---|
| 21 | $bar = new BarPlot($ydata); | 
|---|
| 22 | $bar2 = new BarPlot($ydata); | 
|---|
| 23 | $bar2->SetFillColor("red"); | 
|---|
| 24 |  | 
|---|
| 25 | $gbar = new GroupbarPlot(array($bar,$bar2)); | 
|---|
| 26 |  | 
|---|
| 27 | $graph->Add($gbar); | 
|---|
| 28 | $graph->Add($line); | 
|---|
| 29 |  | 
|---|
| 30 | // Output line | 
|---|
| 31 | $graph->Stroke(); | 
|---|
| 32 |  | 
|---|
| 33 | ?> | 
|---|
| 34 |  | 
|---|
| 35 |  | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.