01.
<?php
02.
require_once
(
'../jpgraph/src/jpgraph.php'
);
03.
require_once
(
'../jpgraph/src/jpgraph_bar.php'
);
04.
include
"../connect.php"
;
05.
06.
$sql
=
"SELECT * FROM evaluation WHERE project_id='8' "
;
07.
$query
=mysql_query(
$sql
);
08.
09.
$datay
=
array
();
10.
11.
while
(
$row
= mysql_fetch_array(
$query
)){
12.
$datay
[] =
$row
[score];
13.
}
14.
15.
16.
17.
18.
19.
$graph
=
new
Graph(300,200);
20.
$graph
->SetScale(
'textlin'
);
21.
22.
23.
$graph
->SetShadow();
24.
25.
26.
$graph
->img->SetMargin(40,30,40,40);
27.
28.
29.
$bplot
=
new
BarPlot(
$datay
);
30.
$graph
->Add(
$bplot
);
31.
32.
33.
$txt
=
new
Text(
'ทดสอบ'
);
34.
$txt
->SetPos(10,20);
35.
$txt
->SetColor(
'darkred'
);
36.
$txt
->SetFont(FF_ANGSA,FS_BOLD,15);
37.
$txt
->SetBox(
'yellow'
,
'navy'
,
'gray@0.5'
);
38.
$graph
->AddText(
$txt
);
39.
40.
41.
$graph
->title->Set(
'ทดสอบ'
);
42.
$graph
->xaxis->title->Set(
'แกน-X'
);
43.
$graph
->yaxis->title->Set(
'แกน-Y'
);
44.
45.
$graph
->title->SetFont(FF_ANGSA,FS_BOLD,18);
46.
$graph
->yaxis->title->SetFont(FF_ANGSA,FS_BOLD,18);
47.
$graph
->xaxis->title->SetFont(FF_ANGSA,FS_BOLD,18);
48.
49.
50.
$graph
->Stroke();
51.
52.
53.
?>