[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_line.php');
|
---|
| 4 | require_once ('jpgraph/jpgraph_scatter.php');
|
---|
| 5 |
|
---|
| 6 | $datay1 = array(4,26,15,44);
|
---|
| 7 |
|
---|
| 8 | // Setup the graph
|
---|
| 9 | $graph = new Graph(300,200);
|
---|
| 10 | $graph->SetMarginColor('white');
|
---|
| 11 | $graph->SetScale("textlin");
|
---|
| 12 | $graph->SetFrame(false);
|
---|
| 13 | $graph->SetMargin(30,5,25,20);
|
---|
| 14 |
|
---|
| 15 | // Setup the tab
|
---|
| 16 | $graph->tabtitle->Set(' Year 2003 ' );
|
---|
| 17 | $graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,13);
|
---|
| 18 | $graph->tabtitle->SetColor('darkred','#E1E1FF');
|
---|
| 19 |
|
---|
| 20 | // Enable X-grid as well
|
---|
| 21 | $graph->xgrid->Show();
|
---|
| 22 |
|
---|
| 23 | // Use months as X-labels
|
---|
| 24 | $graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
|
---|
| 25 |
|
---|
| 26 | // Create the plot
|
---|
| 27 | $p1 = new LinePlot($datay1);
|
---|
| 28 | $p1->SetColor("navy");
|
---|
| 29 |
|
---|
| 30 | // Use an image of favourite car as marker
|
---|
| 31 | $p1->mark->SetType(MARK_IMG,'saab_95.jpg',0.5);
|
---|
| 32 |
|
---|
| 33 | // Displayes value on top of marker image
|
---|
| 34 | $p1->value->SetFormat('%d mil');
|
---|
| 35 | $p1->value->Show();
|
---|
| 36 | $p1->value->SetColor('darkred');
|
---|
| 37 | $p1->value->SetFont(FF_ARIAL,FS_BOLD,10);
|
---|
| 38 | // Increase the margin so that the value is printed avove tje
|
---|
| 39 | // img marker
|
---|
| 40 | $p1->value->SetMargin(14);
|
---|
| 41 |
|
---|
| 42 | // Incent the X-scale so the first and last point doesn't
|
---|
| 43 | // fall on the edges
|
---|
| 44 | $p1->SetCenter();
|
---|
| 45 |
|
---|
| 46 | $graph->Add($p1);
|
---|
| 47 |
|
---|
| 48 | $graph->Stroke();
|
---|
| 49 |
|
---|
| 50 | ?>
|
---|
| 51 |
|
---|
| 52 |
|
---|