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_bar.php'); |
---|
5 | |
---|
6 | $ydata = array(2,3,4,5,6,7,8,9,10,11); |
---|
7 | $ydata2 = array(1,2,3,4,5,6,7,8,9,10); |
---|
8 | $targ = array("#1","#2","#3","#4","#5","#6","#7","#8","#9","#10"); |
---|
9 | $alt = array(1,2,3,4,5,6,7,8,9,10); |
---|
10 | |
---|
11 | // Create the graph. |
---|
12 | $graph = new Graph(300,200); |
---|
13 | $graph->SetScale("textlin"); |
---|
14 | $graph->img->SetMargin(40,20,30,40); |
---|
15 | $graph->title->Set("CSIM example with bar and line"); |
---|
16 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
17 | |
---|
18 | // Setup axis titles |
---|
19 | $graph->xaxis->title->Set("X-title"); |
---|
20 | $graph->yaxis->title->Set("Y-title"); |
---|
21 | |
---|
22 | // Create the linear plot |
---|
23 | $lineplot=new LinePlot($ydata); |
---|
24 | $lineplot->mark->SetType(MARK_FILLEDCIRCLE); |
---|
25 | $lineplot->mark->SetWidth(5); |
---|
26 | $lineplot->mark->SetColor('black'); |
---|
27 | $lineplot->mark->SetFillColor('red'); |
---|
28 | $lineplot->SetCSIMTargets($targ,$alt); |
---|
29 | |
---|
30 | // Create line plot |
---|
31 | $barplot=new barPlot($ydata2); |
---|
32 | $barplot->SetCSIMTargets($targ,$alt); |
---|
33 | |
---|
34 | // Add the plots to the graph |
---|
35 | $graph->Add($lineplot); |
---|
36 | $graph->Add($barplot); |
---|
37 | |
---|
38 | $graph->StrokeCSIM(); |
---|
39 | |
---|
40 | ?> |
---|
41 | |
---|
42 | |
---|