| [42] | 1 | <?php // content="text/plain; charset=utf-8"
|
|---|
| 2 |
|
|---|
| 3 | require_once ('jpgraph/jpgraph.php');
|
|---|
| 4 | require_once ('jpgraph/jpgraph_contourf.php');
|
|---|
| 5 |
|
|---|
| 6 | // Setup some data to use for the contour
|
|---|
| 7 | $data = array(
|
|---|
| 8 | array (12,12,10,10),
|
|---|
| 9 | array (10,10,8,14),
|
|---|
| 10 | array (7,7,13,17),
|
|---|
| 11 | array (4,5,8,12),
|
|---|
| 12 | array (10,8,7,8));
|
|---|
| 13 |
|
|---|
| 14 | // create a basic graph as a container
|
|---|
| 15 | $graph = new Graph(300,300);
|
|---|
| 16 | $graph->SetMargin(30, 30, 40, 30);
|
|---|
| 17 | $graph->SetScale('intint');
|
|---|
| 18 | $graph->SetMarginColor('white');
|
|---|
| 19 |
|
|---|
| 20 | // Setup title of graph
|
|---|
| 21 | $graph->title->Set('Filled contour plot');
|
|---|
| 22 | $graph->title->SetFont(FF_VERDANA,FS_BOLD,12);
|
|---|
| 23 |
|
|---|
| 24 | $graph->subtitle->Set('(horizontal labels)');
|
|---|
| 25 | $graph->subtitle->SetFont(FF_VERDANA,FS_ITALIC,10);
|
|---|
| 26 |
|
|---|
| 27 | // Create a new contour plot
|
|---|
| 28 | $cp = new FilledContourPlot($data,8);
|
|---|
| 29 |
|
|---|
| 30 | // Use only black/and white schema
|
|---|
| 31 | $cp->UseHighContrastColor(true,true);
|
|---|
| 32 |
|
|---|
| 33 | // Flip visually
|
|---|
| 34 | $cp->SetInvert();
|
|---|
| 35 |
|
|---|
| 36 | // Fill the contours
|
|---|
| 37 | $cp->SetFilled(true);
|
|---|
| 38 | // Show lines in red
|
|---|
| 39 | $cp->ShowLines(true,'red');
|
|---|
| 40 |
|
|---|
| 41 | // Display the labels
|
|---|
| 42 | $cp->ShowLabels(true,false);
|
|---|
| 43 | $cp->SetFont(FF_ARIAL,FS_BOLD,9);
|
|---|
| 44 | $cp->SetFontColor('white');
|
|---|
| 45 |
|
|---|
| 46 | // And add the plot to the graph
|
|---|
| 47 | $graph->Add($cp);
|
|---|
| 48 |
|
|---|
| 49 | // Send it back to the client
|
|---|
| 50 | $graph->stroke();
|
|---|
| 51 |
|
|---|
| 52 | ?>
|
|---|