Blame view

site/jpgraph/src/Examples/csim_in_html_graph_ex1.php 1.22 KB
d72ac078   Guillaume   Ajout graphe V1.1
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
  <?php // content="text/plain; charset=utf-8"
  require_once ('../jpgraph.php');
  require_once ('../jpgraph_bar.php');
  
  $datay=array(12,26,9,17,31);
  
  // Create the graph.
  $graph = new Graph(400,250);
  $graph->SetScale('textlin');
  $graph->SetMargin(50,80,20,40);
  
  // Create a bar pot
  $bplot = new BarPlot($datay);
  
  $n = count($datay) ; // Number of bars
  
  global $_wrapperfilename;
  
  // Create targets for the image maps. One for each column
  $targ = array(); $alt = array(); $wtarg = array();
  for( $i=0; $i < $n; ++$i ) {
      $urlarg = 'clickedon='.($i+1);
      $targ[] = $_wrapperfilename.'?'.$urlarg;
      $alt[] = 'val=%d';
      $wtarg[] = '';
  }
  $bplot->SetCSIMTargets($targ,$alt,$wtarg);
  
  $graph->Add($bplot);
  
  $graph->title->Set('Multiple Image maps');
  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  $graph->title->SetCSIMTarget('#45','Title for Bar','_blank');
  
  $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
  $graph->yaxis->title->SetCSIMTarget('#55','Y-axis title');
  $graph->yaxis->title->Set("Y-title");
  
  $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
  $graph->xaxis->title->SetCSIMTarget('#55','X-axis title');
  $graph->xaxis->title->Set("X-title");
  
  // Send back the image when we are called from within the <img> tag
  $graph->StrokeCSIMImage();
  
  ?>