Blame view

site/jpgraph/src/Examples/scatterlinkex2.php 841 Bytes
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
  <?php // content="text/plain; charset=utf-8"
  require_once ('jpgraph/jpgraph.php');
  require_once ('jpgraph/jpgraph_scatter.php');
  
  
  // Make a circle with a scatterplot
  $steps=16;
  for($i=0; $i<$steps; ++$i) {
  	$a=2*M_PI/$steps*$i;
  	$datax[$i]=cos($a);
  	$datay[$i]=sin($a);
  }
  
  
  $graph = new Graph(300,200);
  $graph->clearTheme();
  $graph->SetScale("linlin");
  
  $graph->img->SetMargin(40,40,40,40);
  
  $graph->SetShadow();
  $graph->title->Set("Linked scatter plot");
  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  
  // 10% top and bottom grace
  $graph->yscale->SetGrace(5,5);
  $graph->xscale->SetGrace(1,1);
  
  $sp1 = new ScatterPlot($datay,$datax);
  $sp1->mark->SetType(MARK_FILLEDCIRCLE);
  $sp1->mark->SetFillColor("red");
  $sp1->SetColor("blue");
  
  //$sp1->SetWeight(3);
  $sp1->mark->SetWidth(4);
  $sp1->SetLinkPoints();
  
  $graph->Add($sp1);
  
  $graph->Stroke();
  
  ?>