Share Informasi Teknologi | Tips Trik | Dunia IT | Artikel | Unik | SEO | Berita

Membuat Grafik Sederhana dengan Javascript

by Kano zD , at 02.04 , have 0 komentar
Membuat Grafik Sederhana dengan Javascript
ilustrasi
Kali ini Cyber4rt akan menyediakan cara yang cukup sederhana untuk memvisualisasikan data di website Anda. Dari grafik garis sederhana sampai yang kompleks. Anda dapat mengisi data Anda dengan mudah yang memanfaatkan jsapi dari Google.

PIE CHART

Demo:
http://blog.cyber4rt.com/p/pie-chart.html

Code:
<html>
<title>Cyber4rt Pie Charts</title>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Visits');
data.addRows([
['Jakarta', 84000],
['Surabaya', 63600],
['Bandung', 52900],
['Yogyakarta', 48300],
['Semarang', 38200],
['Medan', 24700],
['Makassar', 14500],
['Depok', 2900],
['Kuala Lumpur', 2800]
]);
var options = {'title':'Demographics City visitors for Cyber4rt',
'width':400,
'height':300};
var chart = new google.visualization.PieChart(document.getElementById('cyber4rt_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="cyber4rt_chart"></div>
</body>
</html>

BAR CHART

Demo:
http://blog.cyber4rt.com/p/bar-chart.html

Code:
<html>
<title>Cyber4rt Bar Charts</title>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Visits');
data.addRows([
['Jakarta', 84000],
['Surabaya', 63600],
['Bandung', 52900],
['Yogyakarta', 48300],
['Semarang', 38200],
['Medan', 24700],
['Makassar', 14500],
['Depok', 2900],
['Kuala Lumpur', 2800]
]);
var options = {'title':'Demographics City visitors for Cyber4rt',
'width':400,
'height':300};
var chart = new google.visualization.BarChart(document.getElementById('cyber4rt_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="cyber4rt_chart"></div>
</body>
</html>
Kano zD
Membuat Grafik Sederhana dengan Javascript - written by Kano zD , published at 02.04, categorized as Download , source code . And have 0 komentar
No comment Add a comment

Terima kasih telah berkunjung.
Jangan lupa tulis komentarnya ya.

Cancel Reply
GetID

Copyright ©2013 Kucing4rt Blog's
Theme designed by Damzaky - Published by Proyek-Template
Powered by Blogger
-->