1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | |
---|
3 | require_once ('jpgraph/jpgraph.php'); |
---|
4 | require_once ('jpgraph/jpgraph_line.php'); |
---|
5 | |
---|
6 | // create the graph |
---|
7 | $graph= new Graph(400,250); |
---|
8 | |
---|
9 | $ydata = array(5,10,15,20,15,10); |
---|
10 | |
---|
11 | $graph->SetScale("textlin"); |
---|
12 | $graph->SetShadow(true); |
---|
13 | $graph->SetMarginColor("antiquewhite"); |
---|
14 | $graph->img->SetMargin(60,40,40,50); |
---|
15 | $graph->img->setTransparent("white"); |
---|
16 | $graph->xaxis->SetFont(FF_FONT1); |
---|
17 | $graph->xaxis->setTextTickInterval(1); |
---|
18 | $graph->xaxis->SetTextLabelInterval(1); |
---|
19 | $graph->legend->SetFillColor("antiquewhite"); |
---|
20 | $graph->legend->SetShadow(true); |
---|
21 | $graph->legend->SetLayout(LEGEND_VERT); |
---|
22 | $graph->legend->Pos(0.02,0.01); |
---|
23 | $graph->title->Set("Step Styled Example"); |
---|
24 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
25 | |
---|
26 | $lineplot = new LinePlot($ydata); |
---|
27 | $lineplot->SetColor("black"); |
---|
28 | $lineplot->setFillColor("gray7"); |
---|
29 | $lineplot->SetStepStyle(); |
---|
30 | $lineplot->SetLegend(" 2002 "); |
---|
31 | |
---|
32 | // add plot to the graph |
---|
33 | $graph->Add($lineplot); |
---|
34 | $graph->ygrid->show(false,false); |
---|
35 | |
---|
36 | // display graph |
---|
37 | $graph->Stroke(); |
---|
38 | |
---|
39 | ?> |
---|