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

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