[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_line.php');
|
---|
| 4 |
|
---|
| 5 | // Some (random) data
|
---|
| 6 | $ydata = array(17,3,'',10,7,'',3,19,9,7);
|
---|
| 7 |
|
---|
| 8 | // Size of the overall graph
|
---|
| 9 | $width=350;
|
---|
| 10 | $height=250;
|
---|
| 11 |
|
---|
| 12 | // Create the graph and set a scale.
|
---|
| 13 | // These two calls are always required
|
---|
| 14 | $graph = new Graph($width,$height);
|
---|
| 15 | $graph->SetScale('intlin');
|
---|
| 16 | $graph->SetShadow();
|
---|
| 17 |
|
---|
| 18 | // Setup margin and titles
|
---|
| 19 | $graph->SetMargin(40,20,20,40);
|
---|
| 20 | $graph->title->Set('NULL values');
|
---|
| 21 | $graph->xaxis->title->Set('x-title');
|
---|
| 22 | $graph->yaxis->title->Set('y-title');
|
---|
| 23 |
|
---|
| 24 | $graph->yaxis->title->SetFont( FF_ARIAL , FS_BOLD, 9 );
|
---|
| 25 | $graph->xaxis->title->SetFont( FF_ARIAL , FS_BOLD, 9 );
|
---|
| 26 |
|
---|
| 27 | $graph->yaxis->SetColor('blue');
|
---|
| 28 |
|
---|
| 29 | // Create the linear plot
|
---|
| 30 | $lineplot=new LinePlot($ydata);
|
---|
| 31 | $lineplot->SetColor( 'blue' );
|
---|
| 32 | $lineplot->SetWeight( 2 ); // Two pixel wide
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | // Add the plot to the graph
|
---|
| 36 | $graph->Add($lineplot);
|
---|
| 37 |
|
---|
| 38 | // Display the graph
|
---|
| 39 | $graph->Stroke();
|
---|
| 40 | ?>
|
---|