[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | require_once ('jpgraph/jpgraph.php'); |
---|
| 3 | require_once ('jpgraph/jpgraph_line.php'); |
---|
| 4 | |
---|
| 5 | $datay1 = array(20,15,23,15); |
---|
| 6 | $datay2 = array(12,9,42,8); |
---|
| 7 | $datay3 = array(5,17,32,24); |
---|
| 8 | |
---|
| 9 | // Setup the graph |
---|
| 10 | $graph = new Graph(300,200); |
---|
| 11 | $graph->SetMarginColor('white'); |
---|
| 12 | $graph->SetScale("textlin"); |
---|
| 13 | $graph->SetFrame(false); |
---|
| 14 | $graph->SetMargin(30,50,30,30); |
---|
| 15 | |
---|
| 16 | $graph->tabtitle->Set(' Year 2003 ' ); |
---|
| 17 | $graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,13); |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | $graph->yaxis->HideZeroLabel(); |
---|
| 21 | $graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5'); |
---|
| 22 | $graph->xgrid->Show(); |
---|
| 23 | |
---|
| 24 | $graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth()); |
---|
| 25 | |
---|
| 26 | // Create the first line |
---|
| 27 | $p1 = new LinePlot($datay1); |
---|
| 28 | $p1->SetColor("navy"); |
---|
| 29 | $p1->SetLegend('Line 1'); |
---|
| 30 | $graph->Add($p1); |
---|
| 31 | |
---|
| 32 | // Create the second line |
---|
| 33 | $p2 = new LinePlot($datay2); |
---|
| 34 | $p2->SetColor("red"); |
---|
| 35 | $p2->SetLegend('Line 2'); |
---|
| 36 | $graph->Add($p2); |
---|
| 37 | |
---|
| 38 | // Create the third line |
---|
| 39 | $p3 = new LinePlot($datay3); |
---|
| 40 | $p3->SetColor("orange"); |
---|
| 41 | $p3->SetLegend('Line 3'); |
---|
| 42 | $graph->Add($p3); |
---|
| 43 | |
---|
| 44 | $graph->legend->SetShadow('gray@0.4',5); |
---|
| 45 | $graph->legend->SetPos(0.1,0.1,'right','top'); |
---|
| 46 | // Output line |
---|
| 47 | $graph->Stroke(); |
---|
| 48 | |
---|
| 49 | ?> |
---|
| 50 | |
---|
| 51 | |
---|