[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 | $cols = 4;
|
---|
| 7 | $rows = 3;
|
---|
| 8 | $data = array( array('2007'),
|
---|
| 9 | array('','Q1','','','Q2'),
|
---|
| 10 | array('','Jan','Feb','Mar','Apr','May','Jun'),
|
---|
| 11 | array('Min','15.2', '12.5', '9.9', '70.0', '22.4','21.5'),
|
---|
| 12 | array('Max','23.9', '14.2', '18.6', '71.3','66.8','42.6'));
|
---|
| 13 |
|
---|
| 14 | $q=1;
|
---|
| 15 |
|
---|
| 16 | $graph = new CanvasGraph(350,200);
|
---|
| 17 |
|
---|
| 18 | $table = new GTextTable($cols,$rows);
|
---|
| 19 | $table->Init();
|
---|
| 20 | $table->Set($data);
|
---|
| 21 | $table->SetBorder(2,'black');
|
---|
| 22 |
|
---|
| 23 | // Setup top row with the year title
|
---|
| 24 | $table->MergeCells(0,0,0,6);
|
---|
| 25 | $table->SetRowFont(0,FF_ARIAL,FS_BOLD,16);
|
---|
| 26 | $table->SetRowColor(0,'navy');
|
---|
| 27 | $table->SetRowAlign(0,'center');
|
---|
| 28 |
|
---|
| 29 | // Setup quarter header
|
---|
| 30 | $table->MergeCells(1,1,1,3);
|
---|
| 31 | $table->MergeCells(1,4,1,6);
|
---|
| 32 | $table->SetRowAlign(1,'center');
|
---|
| 33 | $table->SetRowFont(1,FF_ARIAL,FS_BOLD,10);
|
---|
| 34 | $table->SetRowColor(1,'navy');
|
---|
| 35 | $table->SetRowFillColor(1,'lightgray');
|
---|
| 36 | $table->SetRowGrid(2,'',0); // Turn off the gridline just under the top row
|
---|
| 37 |
|
---|
| 38 | // Setup row and column headers
|
---|
| 39 | $table->SetRowFont(2,FF_ARIAL,FS_NORMAL,11);
|
---|
| 40 | $table->SetRowColor(2,'navy');
|
---|
| 41 | $table->SetRowFillColor(2,'lightgray');
|
---|
| 42 |
|
---|
| 43 | $table->SetColFont(0,FF_ARIAL,FS_NORMAL,11);
|
---|
| 44 | $table->SetColColor(0,'navy');
|
---|
| 45 | $table->SetColFillColor(0,'lightgray');
|
---|
| 46 |
|
---|
| 47 | $table->SetCellFillColor(0,0,'lightgreen');
|
---|
| 48 | $table->SetCellFillColor(1,0,'lightgreen');
|
---|
| 49 | $table->SetCellFillColor(2,0,'lightgreen');
|
---|
| 50 |
|
---|
| 51 | // Highlight cell 2,3
|
---|
| 52 | $table->SetCellFillColor(4,3,'yellow');
|
---|
| 53 |
|
---|
| 54 | $graph->Add($table);
|
---|
| 55 | $graph->Stroke();
|
---|
| 56 |
|
---|
| 57 | ?>
|
---|
| 58 |
|
---|