[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_line.php');
|
---|
| 4 | require_once ('jpgraph/jpgraph_iconplot.php');
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | //$datay = array(20,15,23,15,17,35,22);
|
---|
| 8 | $datay = array(30,25,33,25,27,45,32);
|
---|
| 9 | $datay2 = array(3,25,10,15,50,5,18);
|
---|
| 10 | $datay3 = array(10,5,10,15,5,2,1);
|
---|
| 11 |
|
---|
| 12 | // Setup the graph
|
---|
| 13 | $graph = new Graph(400,250);
|
---|
| 14 | $graph->SetMargin(40,40,20,30);
|
---|
| 15 | $graph->SetScale("textlin");
|
---|
| 16 |
|
---|
| 17 | $graph->title->Set('Adding an icon ("tux") in the background');
|
---|
| 18 | $graph->title->SetFont(FF_ARIAL,FS_NORMAL,12);
|
---|
| 19 |
|
---|
| 20 | //$graph->SetBackgroundGradient('red','blue');
|
---|
| 21 |
|
---|
| 22 | $graph->xaxis->SetPos('min');
|
---|
| 23 |
|
---|
| 24 | $p1 = new LinePlot($datay);
|
---|
| 25 | $p1->SetColor("blue");
|
---|
| 26 | $p1->SetFillGradient('yellow@0.4','red@0.4');
|
---|
| 27 |
|
---|
| 28 | $p2 = new LinePlot($datay2);
|
---|
| 29 | $p2->SetColor("black");
|
---|
| 30 | $p2->SetFillGradient('green@0.4','white');
|
---|
| 31 |
|
---|
| 32 | $p3 = new LinePlot($datay3);
|
---|
| 33 | $p3->SetColor("blue");
|
---|
| 34 | $p3->SetFillGradient('navy@0.4','white@0.4');
|
---|
| 35 |
|
---|
| 36 | $graph->Add($p1);
|
---|
| 37 | $graph->Add($p2);
|
---|
| 38 | $graph->Add($p3);
|
---|
| 39 |
|
---|
| 40 | $icon = new IconPlot('penguin.png',0.2,0.3,1,30);
|
---|
| 41 | $icon->SetAnchor('center','center');
|
---|
| 42 | $graph->Add($icon);
|
---|
| 43 |
|
---|
| 44 | // Output line
|
---|
| 45 | $graph->Stroke();
|
---|
| 46 |
|
---|
| 47 | ?>
|
---|
| 48 |
|
---|
| 49 |
|
---|