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 a basic table
|
---|
19 | $table = new GTextTable();
|
---|
20 | $table->Set($data);
|
---|
21 |
|
---|
22 | // Setup fonts
|
---|
23 | $table->SetFont(FF_TIMES,FS_NORMAL,11);
|
---|
24 | $table->SetColFont(0,FF_ARIAL,FS_NORMAL,11);
|
---|
25 | $table->SetRowFont(0,FF_ARIAL,FS_NORMAL,11);
|
---|
26 | $table->SetRowFont(4,FF_TIMES,FS_BOLD,14);
|
---|
27 |
|
---|
28 | // Turn off the grid
|
---|
29 | $table->SetGrid(0);
|
---|
30 |
|
---|
31 | // Setup color
|
---|
32 | $table->SetRowFillColor(0,'lightgray@0.5');
|
---|
33 | $table->SetRowFillColor(4,'lightgray@0.5');
|
---|
34 | $table->SetColFillColor(0,'lightgray@0.5');
|
---|
35 | $table->SetFillColor(0,0,4,0,'lightgray@0.5');
|
---|
36 |
|
---|
37 | // Set default minimum column width
|
---|
38 | $table->SetMinColWidth(45);
|
---|
39 |
|
---|
40 | // Set default table alignment
|
---|
41 | $table->SetAlign('right');
|
---|
42 |
|
---|
43 | // Add table to the graph
|
---|
44 | $graph->Add($table);
|
---|
45 |
|
---|
46 | // and send it back to the client
|
---|
47 | $graph->Stroke();
|
---|
48 |
|
---|
49 | ?>
|
---|
50 |
|
---|