01.
<?php
02.
include
(
"../jpgraph.php"
);
03.
include
(
"../jpgraph_bar.php"
);
04.
include
(
"../jpgraph_line.php"
);
05.
06.
07.
$objConnect
= mysql_connect(
"localhost"
,
"root"
,
"root"
)
or
die
(
"Error Connect to Database"
);
08.
$objDB
= mysql_select_db(
"mydatabase"
);
09.
$strSQL
=
"SELECT * FROM customer"
;
10.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
11.
12.
13.
$datay
=
array
();
14.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
15.
{
16.
$datay
[] =
$objResult
[
"Budget"
];
17.
}
18.
19.
20.
$graph
=
new
Graph(350,300);
21.
22.
$graph
->SetScale(
"textlin"
);
23.
24.
$graph
->SetMarginColor(
'navy:1.9'
);
25.
$graph
->SetBox();
26.
27.
$graph
->title->Set(
'Bar Pattern'
);
28.
$graph
->title->SetFont(FF_ARIAL,FS_BOLD,20);
29.
30.
$graph
->SetTitleBackground(
'lightblue:1.3'
,TITLEBKG_STYLE2,TITLEBKG_FRAME_BEVEL);
31.
$graph
->SetTitleBackgroundFillStyle(TITLEBKG_FILLSTYLE_HSTRIPED,
'lightblue'
,
'blue'
);
32.
33.
34.
$bplot
=
new
BarPlot(
$datay
);
35.
$bplot
->SetFillColor(
'darkorange'
);
36.
$bplot
->SetWidth(0.6);
37.
38.
$bplot
->SetPattern(PATTERN_CROSS1,
'navy'
);
39.
$graph
->Add(
$bplot
);
40.
$graph
->Stroke();
41.
?>