source: trunk/xgraph/jpgraph/Examples/example7.php

Last change on this file 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_log.php');
4require_once ('jpgraph/jpgraph_line.php');
5
6$ydata = array(11,3,8,12,5,1,9,13,5,7);
7$y2data = array(354,70,265,29,111,91,198,225,593,251);
8
9// Create the graph.
10$graph = new Graph(350,200);   
11$graph->SetScale("textlin");
12$graph->SetY2Scale("log");
13$graph->SetShadow();
14$graph->img->SetMargin(40,110,20,40);
15
16// Create the linear plot
17$lineplot=new LinePlot($ydata);
18$lineplot2=new LinePlot($y2data);
19
20// Add the plot to the graph
21$graph->Add($lineplot);
22$graph->AddY2($lineplot2);
23$graph->yaxis->SetColor('blue');
24
25$graph->title->Set("Example 7");
26$graph->xaxis->title->Set("X-title");
27$graph->yaxis->title->Set("Y-title");
28
29$graph->title->SetFont(FF_FONT1,FS_BOLD);
30$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
31$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
32
33$lineplot->SetColor("blue");
34$lineplot->SetWeight(2);
35$lineplot2->SetWeight(2);
36
37$lineplot->SetLegend("Plot 1");
38$lineplot2->SetLegend("Plot 2");
39
40$graph->legend->Pos(0.05,0.5,"right","center");
41
42// Display the graph
43$graph->Stroke();
44?>
Note: See TracBrowser for help on using the repository browser.