01.
<html>
02.
<head>
04.
05.
</head>
06.
<body>
07.
08.
<div id=
"curve_chart002"
style=
"width: auto; height: 500px; border: 1px solid black;"
></div>
09.
</body>
10.
</html>
11.
12.
<?
13.
14.
$arrayName
=
array
(
15.
"Computer"
,
16.
"Network"
,
17.
"Printer"
,
18.
"RDMS"
,
19.
);
20.
21.
$arrayValue001
=
array
(
22.
"100"
,
23.
"600"
,
24.
"300"
,
25.
"800"
,
26.
);
27.
28.
$arrayValue002
=
array
(
29.
"50"
,
30.
"20"
,
31.
"70"
,
32.
"40"
,
33.
);
34.
35.
36.
echo
<<<TAG_drawChart
37.
<script type=
'text/javascript'
>
38.
google.charts.load(
'current'
, {
'packages'
:[
'corechart'
]});
39.
google.charts.setOnLoadCallback(drawChart002);
40.
41.
function
drawChart002() {
42.
var
data = google.visualization.arrayToDataTable([
43.
[
'Name'
,
'ใช้งาน'
,
'กำลังเปลี่ยน'
],
44.
TAG_drawChart;
45.
46.
for
(
$i
= 0;
$i
<
count
(
$arrayName
);
$i
++) {
47.
echo
"['$arrayName[$i]', $arrayValue001[$i], $arrayValue002[$i]],"
;
48.
}
49.
50.
echo
<<<TAG_drawChart
51.
]);
52.
53.
var
options = {
54.
title:
'Company Performance'
,
55.
curveType:
'none'
,
56.
legend: { position:
'bottom'
},
57.
focusTarget:
'category'
58.
};
59.
60.
var
chart =
new
google.visualization.LineChart(document.getElementById(
'curve_chart002'
));
61.
62.
chart.draw(data, options);
63.
}
64.
</script>
65.
TAG_drawChart;
66.
67.
?>