ilustrasi |
Kali ini Magic4rt 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
Code:
<html>
<title>Magic4rt 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 Magic4rt',
'width':400,
'height':300};
var chart = new google.visualization.PieChart(document.getElementById('magic4rt_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="magic4rt_chart"></div>
</body>
</html>
<title>Magic4rt 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 Magic4rt',
'width':400,
'height':300};
var chart = new google.visualization.PieChart(document.getElementById('magic4rt_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="magic4rt_chart"></div>
</body>
</html>
BAR CHART
Code:
<html>
<title>Magic4rt 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],
Follow @Magic4rt Blog
Tidak ada komentar:
Posting Komentar
Berkomentarlah Yang Membangun Dan Tanpa Link