Rabu, 05 Februari 2014
Membuat Grafik Menggunakan Google Chart
hai pengen buat grafik
ini nih skripnya
<!--skrip pertama-->
<?php
$q=mysql_query("SELECT * FROM kurikulum1");
$r = mysql_fetch_array($q);
$kur1= $r['Count(kuesioner.kues_1)'];
?>
<?php
$q=mysql_query("SELECT Count(kuesioner.kues_1),kuesioner.kues_2, kuesioner.kues_3 FROM `kuesioner` WHERE kuesioner.id LIKE '%fa%' AND NOT
kuesioner.kues_1 = 2 OR
kuesioner.kues_2 = 2 OR
kuesioner.kues_3 = 2");
$r = mysql_fetch_array($q);
$kur2= $r['Count(kuesioner.kues_1)'];
?>
<?php
$q=mysql_query("SELECT Count(kuesioner.kues_1),kuesioner.kues_2, kuesioner.kues_3 FROM `kuesioner` WHERE kuesioner.id LIKE '%fa%' AND NOT
kuesioner.kues_1 = 3 OR
kuesioner.kues_2 = 3 OR
kuesioner.kues_3 = 3");
$r = mysql_fetch_array($q);
$kur3= $r['Count(kuesioner.kues_1)'];
?>
<?php
$q=mysql_query("SELECT Count(kuesioner.kues_1),kuesioner.kues_2, kuesioner.kues_3 FROM `kuesioner` WHERE kuesioner.id LIKE '%fa%' AND NOT
kuesioner.kues_1 = 4 OR
kuesioner.kues_2 = 4 OR
kuesioner.kues_3 = 4");
$r = mysql_fetch_array($q);
$kur4= $r['Count(kuesioner.kues_1)'];
?>
<?php
$q=mysql_query("SELECT Count(kuesioner.kues_1),kuesioner.kues_2, kuesioner.kues_3 FROM `kuesioner` WHERE kuesioner.id LIKE '%fa%' AND NOT
kuesioner.kues_1 = 5 OR
kuesioner.kues_2 = 5 OR
kuesioner.kues_3 = 5");
$r = mysql_fetch_array($q);
$kur5= $r['Count(kuesioner.kues_1)'];
?>
<!--skrip grafik fasilitas-->
<!--skrip grafik fasilitas-->
<html>
<head>
<script src="https://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart1);
function drawChart1() {
var data = google.visualization.arrayToDataTable([
['Nilai', 'Sangat Tdk Puas', 'Tidak Puas','Cukup Puas','puas','sangat puas'] ,
['Hasil', <?php echo $kur1;?>, <?php echo $kur2;?>, <?php echo $kur3;?>, <?php echo $kur4;?>, <?php echo $kur5;?>]
]);
var options = {
title: 'Jumlah',
hAxis: {title: 'Grafik Kurikulum Fak Agama', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div1'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div1" style="height: 600px; width:800px;">
</div>
</body>
<!--skrip ke dua-->
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sangat Tidak Puas', 'Tidak Puas','Cukup Puas','Puas','Sangat Puas'],
['2004', <?php echo $kur1;?>, 40,12,30,43]
]);
var options = {
title: 'Grafik Fasiltas F. Agama Islam',
hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div2'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div2" style="width: 900px; height: 500px;"></div>
</body>
<!--skrip ketiga-->
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sangat Tidak Puas', 'Tidak Puas','Cukup Puas','Puas','Sangat Puas'],
['2004', 10, 40,12,30,43]
]);
var options = {
title: 'Grafik Layanan F. Agama Islam',
hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div3'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div3" style="width: 900px; height: 500px;"></div>
</body>
</html>
Share This!
Labels:
Googlechart
Langganan:
Posting Komentar
(
Atom
)
Tidak ada komentar :
Posting Komentar