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_scatter.php'); |
---|
5 | |
---|
6 | $datay1 = array(33,20,24,5,38,24,22); |
---|
7 | $datay2 = array(9,7,10,25,10,8,4); |
---|
8 | |
---|
9 | // Setup the graph |
---|
10 | $graph = new Graph(300,250); |
---|
11 | |
---|
12 | $graph->SetScale("textlin",0,50); |
---|
13 | |
---|
14 | $theme_class= new UniversalTheme; |
---|
15 | $graph->SetTheme($theme_class); |
---|
16 | |
---|
17 | $graph->title->Set("Line Plots with Markers"); |
---|
18 | |
---|
19 | $graph->SetBox(false); |
---|
20 | $graph->ygrid->SetFill(false); |
---|
21 | $graph->yaxis->HideLine(false); |
---|
22 | $graph->yaxis->HideTicks(false,false); |
---|
23 | $graph->yaxis->HideZeroLabel(); |
---|
24 | |
---|
25 | $graph->xaxis->SetTickLabels(array('A','B','C','D','E','F','G')); |
---|
26 | // Create the plot |
---|
27 | $p1 = new LinePlot($datay1); |
---|
28 | $graph->Add($p1); |
---|
29 | |
---|
30 | $p2 = new LinePlot($datay2); |
---|
31 | $graph->Add($p2); |
---|
32 | |
---|
33 | // Use an image of favourite car as marker |
---|
34 | $p1->mark->SetType(MARK_IMG,'new1.gif',0.8); |
---|
35 | $p1->SetColor('#aadddd'); |
---|
36 | $p1->value->SetFormat('%d'); |
---|
37 | $p1->value->Show(); |
---|
38 | $p1->value->SetColor('#55bbdd'); |
---|
39 | |
---|
40 | $p2->mark->SetType(MARK_IMG,'new2.gif',0.8); |
---|
41 | $p2->SetColor('#ddaa99'); |
---|
42 | $p2->value->SetFormat('%d'); |
---|
43 | $p2->value->Show(); |
---|
44 | $p2->value->SetColor('#55bbdd'); |
---|
45 | |
---|
46 | |
---|
47 | $graph->Stroke(); |
---|
48 | |
---|
49 | ?> |
---|