[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,250);
|
---|
| 10 | $graph->SetMarginColor('white');
|
---|
| 11 | $graph->SetScale("textlin");
|
---|
| 12 | $graph->SetFrame(false);
|
---|
| 13 | $graph->SetMargin(30,5,25,50);
|
---|
| 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 | $graph->footer->left->Set('L. footer');
|
---|
| 27 | $graph->footer->left->SetFont(FF_ARIAL,FS_NORMAL,12);
|
---|
| 28 | $graph->footer->left->SetColor('darkred');
|
---|
| 29 | $graph->footer->center->Set('C. footer');
|
---|
| 30 | $graph->footer->center->SetFont(FF_ARIAL,FS_BOLD,12);
|
---|
| 31 | $graph->footer->center->SetColor('darkred');
|
---|
| 32 | $graph->footer->right->Set('R. footer');
|
---|
| 33 | $graph->footer->right->SetFont(FF_ARIAL,FS_NORMAL,12);
|
---|
| 34 | $graph->footer->right->SetColor('darkred');
|
---|
| 35 |
|
---|
| 36 | // Create the plot
|
---|
| 37 | $p1 = new LinePlot($datay1);
|
---|
| 38 | $p1->SetColor("navy");
|
---|
| 39 |
|
---|
| 40 | // Use an image of favourite car as marker
|
---|
| 41 | $p1->mark->SetType(MARK_IMG,'saab_95.jpg',0.5);
|
---|
| 42 |
|
---|
| 43 | // Displayes value on top of marker image
|
---|
| 44 | $p1->value->SetFormat('%d mil');
|
---|
| 45 | $p1->value->Show();
|
---|
| 46 | $p1->value->SetColor('darkred');
|
---|
| 47 | $p1->value->SetFont(FF_ARIAL,FS_BOLD,10);
|
---|
| 48 | // Increase the margin so that the value is printed avove tje
|
---|
| 49 | // img marker
|
---|
| 50 | $p1->value->SetMargin(14);
|
---|
| 51 |
|
---|
| 52 | // Incent the X-scale so the first and last point doesn't
|
---|
| 53 | // fall on the edges
|
---|
| 54 | $p1->SetCenter();
|
---|
| 55 |
|
---|
| 56 | $graph->Add($p1);
|
---|
| 57 |
|
---|
| 58 | $graph->Stroke();
|
---|
| 59 |
|
---|
| 60 | ?>
|
---|
| 61 |
|
---|
| 62 |
|
---|