1 | <?php // content="text/plain; charset=utf-8"
|
---|
2 | require_once ('jpgraph/jpgraph.php');
|
---|
3 | require_once ('jpgraph/jpgraph_scatter.php');
|
---|
4 |
|
---|
5 | // Some data for the points
|
---|
6 | $datax = array(3.5,13.7,3,4,6.2,6,3.5,8,14,8,11.1,13.7);
|
---|
7 | $datay = array(10,22,12,13,17,20,16,19,30,31,40,43);
|
---|
8 |
|
---|
9 | // A new scatter graph
|
---|
10 | $graph = new Graph(300,200,'auto');
|
---|
11 | $graph->SetShadow();
|
---|
12 | $graph->SetScale("linlin");
|
---|
13 |
|
---|
14 | //$graph->img->SetMargin(40,40,40,40);
|
---|
15 |
|
---|
16 | $graph->title->Set("Scatter plot with Image Map");
|
---|
17 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
18 |
|
---|
19 | // Client side image map targets
|
---|
20 | $targ=array("pie_csimex1.php#1","pie_csimex1.php#2","pie_csimex1.php#3",
|
---|
21 | "pie_csimex1.php#4","pie_csimex1.php#5","pie_csimex1.php#6",
|
---|
22 | "pie_csimex1.php#7","pie_csimex1.php#8","pie_csimex1.php#9" );
|
---|
23 |
|
---|
24 | // Strings to put as "alts" (and "title" value)
|
---|
25 | $alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
|
---|
26 |
|
---|
27 | // Create a new scatter plot
|
---|
28 | $sp1 = new ScatterPlot($datay,$datax);
|
---|
29 |
|
---|
30 | // Use diamonds as markerss
|
---|
31 | $sp1->mark->SetType(MARK_DIAMOND);
|
---|
32 | $sp1->mark->SetWidth(10);
|
---|
33 |
|
---|
34 | // Set the scatter plot image map targets
|
---|
35 | $sp1->SetCSIMTargets($targ,$alts);
|
---|
36 |
|
---|
37 | // Add the plot
|
---|
38 | $graph->Add($sp1);
|
---|
39 |
|
---|
40 | // Send back the HTML page which will call this script again
|
---|
41 | // to retrieve the image.
|
---|
42 | $graph->StrokeCSIM();
|
---|
43 |
|
---|
44 | ?>
|
---|