[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('(With lines and labels)');
|
---|
| 25 | $graph->subtitle->SetFont(FF_VERDANA,FS_ITALIC,10);
|
---|
| 26 |
|
---|
| 27 | // Create a new contour plot
|
---|
| 28 | $cp = new FilledContourPlot($data,7);
|
---|
| 29 |
|
---|
| 30 | // Use only blue/red color schema
|
---|
| 31 | $cp->UseHighContrastColor(true);
|
---|
| 32 |
|
---|
| 33 | // Flip visually
|
---|
| 34 | $cp->SetInvert();
|
---|
| 35 |
|
---|
| 36 | // Fill the contours
|
---|
| 37 | $cp->SetFilled(true);
|
---|
| 38 |
|
---|
| 39 | // Specify method to use
|
---|
| 40 | $cp->SetMethod('rect');
|
---|
| 41 |
|
---|
| 42 | // Display the labels
|
---|
| 43 | $cp->ShowLabels(true,true);
|
---|
| 44 | $cp->SetFont(FF_ARIAL,FS_BOLD,9);
|
---|
| 45 | $cp->SetFontColor('white');
|
---|
| 46 |
|
---|
| 47 | // And add the plot to the graph
|
---|
| 48 | $graph->Add($cp);
|
---|
| 49 |
|
---|
| 50 | // Send it back to the client
|
---|
| 51 | $graph->stroke();
|
---|
| 52 |
|
---|
| 53 | ?>
|
---|