1 | <?php // content="text/plain; charset=utf-8"
|
---|
2 | require_once ('jpgraph/jpgraph.php');
|
---|
3 | require_once ('jpgraph/jpgraph_line.php');
|
---|
4 |
|
---|
5 | $ydata = array(11,3,8,12,5,1,9,13,5,7);
|
---|
6 | $y2data = array(354,200,265,99,111,91,198,225,293,251);
|
---|
7 |
|
---|
8 | $graph = new Graph(350,300);
|
---|
9 | $graph->SetAngle(40);
|
---|
10 | $graph->img->SetMargin(80,80,80,80);
|
---|
11 | $graph->SetScale("textlin");
|
---|
12 | $graph->SetY2Scale("lin");
|
---|
13 | $graph->SetShadow();
|
---|
14 |
|
---|
15 | // Create the linear plot
|
---|
16 | $lineplot=new LinePlot($ydata);
|
---|
17 | $lineplot2=new LinePlot($y2data);
|
---|
18 |
|
---|
19 | // Add the plot to the graph
|
---|
20 | $graph->Add($lineplot);
|
---|
21 | $graph->AddY2($lineplot2);
|
---|
22 | $lineplot2->SetColor("orange");
|
---|
23 | $lineplot2->SetWeight(2);
|
---|
24 | $graph->y2axis->SetColor("orange");
|
---|
25 |
|
---|
26 | $graph->title->Set("Example 1 rotated graph (40 degree)");
|
---|
27 | $graph->legend->Pos(0.05,0.1,"right","top");
|
---|
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 |
|
---|
36 | $lineplot2->SetColor("orange");
|
---|
37 | $lineplot2->SetWeight(2);
|
---|
38 |
|
---|
39 | $graph->yaxis->SetColor("blue");
|
---|
40 |
|
---|
41 | $lineplot->SetLegend("Plot 1");
|
---|
42 | $lineplot2->SetLegend("Plot 2");
|
---|
43 |
|
---|
44 | // Display the graph
|
---|
45 | $graph->Stroke();
|
---|
46 | ?>
|
---|