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(12,19,3,9,15,10);
|
---|
6 |
|
---|
7 | // The code to setup a very basic graph
|
---|
8 | $graph = new Graph(200,150);
|
---|
9 | $graph->SetScale('intlin');
|
---|
10 | $graph->SetMargin(30,15,40,30);
|
---|
11 | $graph->SetMarginColor('white');
|
---|
12 | $graph->SetFrame(true,'blue',3);
|
---|
13 |
|
---|
14 | $graph->title->Set('Label background');
|
---|
15 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
|
---|
16 |
|
---|
17 | $graph->subtitle->SetFont(FF_ARIAL,FS_NORMAL,10);
|
---|
18 | $graph->subtitle->SetColor('darkred');
|
---|
19 | $graph->subtitle->Set('"LABELBKG_XAXISFULL"');
|
---|
20 |
|
---|
21 | $graph->SetAxisLabelBackground(LABELBKG_XAXISFULL,'orange','red','lightblue','red');
|
---|
22 |
|
---|
23 | // Use Ariel font
|
---|
24 | $graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9);
|
---|
25 | $graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,9);
|
---|
26 | $graph->xgrid->Show();
|
---|
27 |
|
---|
28 | // Create the plot line
|
---|
29 | $p1 = new LinePlot($ydata);
|
---|
30 | $graph->Add($p1);
|
---|
31 |
|
---|
32 | // Output graph
|
---|
33 | $graph->Stroke();
|
---|
34 |
|
---|
35 | ?>
|
---|
36 |
|
---|
37 |
|
---|