[42] | 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 | // 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(35);
|
---|
| 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 | // Add the table to the graph
|
---|
| 37 | $graph->Add($table);
|
---|
| 38 |
|
---|
| 39 | // and send it back to the browser
|
---|
| 40 | $graph->Stroke();
|
---|
| 41 |
|
---|
| 42 | ?>
|
---|
| 43 |
|
---|