Blame view

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