[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 | // Setup graph context
|
---|
| 7 | $graph = new CanvasGraph(430,150);
|
---|
| 8 |
|
---|
| 9 | // Setup the basic table
|
---|
| 10 | $data = array(
|
---|
| 11 | array('', 'w631', 'w632', 'w633', 'w634', 'w635', 'w636'),
|
---|
| 12 | array('Critical (sum)',13,17,15,8,3,9),
|
---|
| 13 | array('High (sum)',34,35,26,20,22,16),
|
---|
| 14 | array('Low (sum)',41,43,49,45,51,47),
|
---|
| 15 | array('Sum',88,95,90,73,76,72)
|
---|
| 16 | );
|
---|
| 17 |
|
---|
| 18 | // Setup the basic table and font
|
---|
| 19 | $table = new GTextTable();
|
---|
| 20 | $table->Set($data);
|
---|
| 21 | $table->SetFont(FF_ARIAL,FS_NORMAL,11);
|
---|
| 22 |
|
---|
| 23 | // Setup default column width
|
---|
| 24 | $table->SetMinColWidth(40);
|
---|
| 25 |
|
---|
| 26 | // Setup defalt table alignment
|
---|
| 27 | $table->SetAlign('right');
|
---|
| 28 |
|
---|
| 29 | // Turn off border
|
---|
| 30 | $table->SetBorder(0);
|
---|
| 31 |
|
---|
| 32 | // Turn off grid
|
---|
| 33 | $table->setGrid(0);
|
---|
| 34 |
|
---|
| 35 | // Setup font for row 4 and 0
|
---|
| 36 | $table->SetRowFont(4,FF_ARIAL,FS_BOLD,11);
|
---|
| 37 | $table->SetRowFont(0,FF_ARIAL,FS_BOLD,11);
|
---|
| 38 |
|
---|
| 39 | // Setup color
|
---|
| 40 | $table->SetRowFillColor(4,'orange@0.5');
|
---|
| 41 | $table->SetFillColor(0,1,0,6,'teal@0.8');
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | // Setup grids
|
---|
| 45 | $table->SetRowGrid(4,1,'black',TGRID_DOUBLE2);
|
---|
| 46 | $table->SetColGrid(1,1,'black',TGRID_SINGLE);
|
---|
| 47 | $table->SetRowGrid(1,1,'black',TGRID_SINGLE);
|
---|
| 48 |
|
---|
| 49 | // Add table to the graph
|
---|
| 50 | $graph->Add($table);
|
---|
| 51 |
|
---|
| 52 | // Send it back to the client
|
---|
| 53 | $graph->Stroke();
|
---|
| 54 |
|
---|
| 55 | ?>
|
---|
| 56 |
|
---|