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
| <?php
require_once ("jpgraph/jpgraph.php");
require_once ("jpgraph/jpgraph_scatter.php");
DEFINE('WORLDMAP','worldmap1.jpg');
function markCallback($y,$x) {
if( $x == 54 )
return array(false,false,false,'red',0.8);
else
return array(false,false,false,'green',0.8);
}
$datax = array(10,20,30,40,54,60,70,80);
$datay = array(12,23,65,18,84,28,86,44);
$graph = new Graph(400,270);
$graph->img->SetMargin(1,1,1,1);
$graph->SetScale('linlin',0,100,0,100);
$graph->xaxis->Hide();
$graph->yaxis->Hide();
$graph->SetBackgroundImage(WORLDMAP,BGIMG_FILLPLOT);
$graph->title->Set("Pushpin graph");
$graph->title->SetFont(FF_ARIAL,FS_BOLD,16);
$graph->title->SetColor('white');
$graph->SetTitleBackground('darkgreen',TITLEBKG_STYLE1,TITLEBKG_FRAME_BEVEL);
$graph->SetTitleBackgroundFillStyle(TITLEBKG_FILLSTYLE_HSTRIPED,'blue','darkgreen');
$sp = new ScatterPlot($datay,$datax);
$sp->mark->SetType(MARK_IMG_PUSHPIN,'blue',0.6);
$sp->mark->SetCallbackYX('markCallback');
$graph->Add($sp);
$graph->Stroke();
?> |