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 | $p1->SetCSIMTargets(array('#1','#2','#3','#4','#5'));
|
---|
31 |
|
---|
32 | // Use an image of favourite car as
|
---|
33 | $p1->mark->SetType(MARK_IMG,'saab_95.jpg',0.5);
|
---|
34 | //$p1->mark->SetType(MARK_SQUARE);
|
---|
35 |
|
---|
36 | // Displayes value on top of marker image
|
---|
37 | $p1->value->SetFormat('%d mil');
|
---|
38 | $p1->value->Show();
|
---|
39 | $p1->value->SetColor('darkred');
|
---|
40 | $p1->value->SetFont(FF_ARIAL,FS_BOLD,10);
|
---|
41 | // Increase the margin so that the value is printed avove tje
|
---|
42 | // img marker
|
---|
43 | $p1->value->SetMargin(14);
|
---|
44 |
|
---|
45 | // Incent the X-scale so the first and last point doesn't
|
---|
46 | // fall on the edges
|
---|
47 | $p1->SetCenter();
|
---|
48 |
|
---|
49 | $graph->Add($p1);
|
---|
50 |
|
---|
51 | $graph->StrokeCSIM();
|
---|
52 |
|
---|
53 | ?>
|
---|
54 |
|
---|
55 |
|
---|