1 | <?php
|
---|
2 | require_once ('jpgraph/jpgraph.php');
|
---|
3 | require_once ('jpgraph/jpgraph_canvas.php');
|
---|
4 | require_once ('jpgraph/jpgraph_table.php');
|
---|
5 |
|
---|
6 | // Create a canvas graph where the table can be added
|
---|
7 | $graph = new CanvasGraph(150,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 | // Set default font in entire table
|
---|
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(35);
|
---|
23 |
|
---|
24 | // Setup grid on row 2
|
---|
25 | $table->SetRowGrid(2,1,'black',TGRID_DOUBLE2);
|
---|
26 |
|
---|
27 | // Add table to the graph
|
---|
28 | $graph->Add($table);
|
---|
29 |
|
---|
30 | // and send it back to the client
|
---|
31 | $graph->Stroke();
|
---|
32 |
|
---|
33 | ?>
|
---|
34 |
|
---|