[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,7,16,46); |
---|
| 6 | $datay2 = array(6,20,10,22); |
---|
| 7 | |
---|
| 8 | // Setup the graph |
---|
| 9 | $graph = new Graph(350,230); |
---|
| 10 | $graph->SetScale("textlin"); |
---|
| 11 | |
---|
| 12 | $theme_class= new UniversalTheme; |
---|
| 13 | $graph->SetTheme($theme_class); |
---|
| 14 | |
---|
| 15 | $graph->title->Set('Background Image'); |
---|
| 16 | $graph->SetBox(false); |
---|
| 17 | |
---|
| 18 | $graph->yaxis->HideZeroLabel(); |
---|
| 19 | $graph->yaxis->HideLine(false); |
---|
| 20 | $graph->yaxis->HideTicks(false,false); |
---|
| 21 | |
---|
| 22 | $graph->xaxis->SetTickLabels(array('A','B','C','D')); |
---|
| 23 | $graph->ygrid->SetFill(false); |
---|
| 24 | $graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME); |
---|
| 25 | |
---|
| 26 | $p1 = new LinePlot($datay1); |
---|
| 27 | $graph->Add($p1); |
---|
| 28 | |
---|
| 29 | $p2 = new LinePlot($datay2); |
---|
| 30 | $graph->Add($p2); |
---|
| 31 | |
---|
| 32 | $p1->SetColor("#55bbdd"); |
---|
| 33 | $p1->SetLegend('Line 1'); |
---|
| 34 | $p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0); |
---|
| 35 | $p1->mark->SetColor('#55bbdd'); |
---|
| 36 | $p1->mark->SetFillColor('#55bbdd'); |
---|
| 37 | $p1->SetCenter(); |
---|
| 38 | |
---|
| 39 | $p2->SetColor("#aaaaaa"); |
---|
| 40 | $p2->SetLegend('Line 2'); |
---|
| 41 | $p2->mark->SetType(MARK_UTRIANGLE,'',1.0); |
---|
| 42 | $p2->mark->SetColor('#aaaaaa'); |
---|
| 43 | $p2->mark->SetFillColor('#aaaaaa'); |
---|
| 44 | $p2->value->SetMargin(14); |
---|
| 45 | $p2->SetCenter(); |
---|
| 46 | |
---|
| 47 | $graph->legend->SetFrameWeight(1); |
---|
| 48 | $graph->legend->SetColor('#4E4E4E','#00A78A'); |
---|
| 49 | $graph->legend->SetMarkAbsSize(8); |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | // Output line |
---|
| 53 | $graph->Stroke(); |
---|
| 54 | |
---|
| 55 | ?> |
---|
| 56 | |
---|
| 57 | |
---|