1 | <?php |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_canvas.php'); |
---|
4 | require_once ('jpgraph/jpgraph_table.php'); |
---|
5 | |
---|
6 | // Setup graph context |
---|
7 | $graph = new CanvasGraph(165,90); |
---|
8 | |
---|
9 | // Setup the basic table |
---|
10 | $data = array( array(1,2,3,4),array(5,6,7,8), array(6,8,10,12)); |
---|
11 | $table = new GTextTable(); |
---|
12 | $table->Set($data); |
---|
13 | |
---|
14 | // Setup overall table font |
---|
15 | $table->SetFont(FF_ARIAL,FS_NORMAL,11); |
---|
16 | |
---|
17 | // Setup font and color for row = 2 |
---|
18 | $table->SetRowFont(2,FF_ARIAL,FS_BOLD,11); |
---|
19 | $table->SetRowFillColor(2,'orange@0.5'); |
---|
20 | |
---|
21 | // Setup minimum color width |
---|
22 | $table->SetMinColWidth(40); |
---|
23 | |
---|
24 | // Setup overall cell alignment for the table |
---|
25 | $table->SetAlign('right'); |
---|
26 | |
---|
27 | // Setup overall table border |
---|
28 | $table->SetBorder(0,'black'); |
---|
29 | |
---|
30 | // Setup overall table grid |
---|
31 | $table->setGrid(0,'black'); |
---|
32 | |
---|
33 | // Set specific frid for row = 2 |
---|
34 | $table->SetRowGrid(2,1,'black',TGRID_DOUBLE2); |
---|
35 | |
---|
36 | // Setup overall number format in all cells |
---|
37 | $table->SetNumberFormat("%0.1f"); |
---|
38 | |
---|
39 | // Add table to the graph |
---|
40 | $graph->Add($table); |
---|
41 | |
---|
42 | // and send it back to the browser |
---|
43 | $graph->Stroke(); |
---|
44 | |
---|
45 | ?> |
---|
46 | |
---|