source: trunk/xgraph/jpgraph/Examples/example16.1.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.1 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_line.php');
4
5$l1datay = array(11,9,2,4,3,13,17);
6$l2datay = array(23,12,5,19,17,10,15);
7$datax=array('Jan','Feb','Mar','Apr','May');
8
9// Create the graph.
10$graph = new Graph(400,200);   
11$graph->SetScale('textlin');
12
13$graph->img->SetMargin(40,130,20,40);
14$graph->SetShadow();
15
16// Create the linear error plot
17$l1plot=new LinePlot($l1datay);
18$l1plot->SetColor('red');
19$l1plot->SetWeight(2);
20$l1plot->SetLegend('Prediction');
21
22// Create the bar plot
23$l2plot = new LinePlot($l2datay);
24$l2plot->SetFillColor('orange');
25$l2plot->SetLegend('Result');
26
27// Add the plots to the graph
28$graph->Add($l2plot);
29$graph->Add($l1plot);
30
31$graph->title->Set('Mixing line and filled line');
32$graph->xaxis->title->Set('X-title');
33$graph->yaxis->title->Set('Y-title');
34
35$graph->title->SetFont(FF_FONT1,FS_BOLD);
36$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
37$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
38
39//$graph->xaxis->SetTickLabels($datax);
40//$graph->xaxis->SetTextTickInterval(2);
41
42// Display the graph
43$graph->Stroke();
44?>
Note: See TracBrowser for help on using the repository browser.