Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mzm-dev
authored and
mzm-dev
committed
Sep 6, 2014
1 parent
3032bcd
commit ef5e6e0
Showing
9 changed files
with
305 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
/** | ||
* | ||
* | ||
* @link https://github.com/mzm-dev | ||
* @created September 2014 | ||
* @fb https://www.facebook.com/zakimedia | ||
* @email mohdzaki04@gmail.com | ||
*/ | ||
$cakeDescription = "Highcharts Pie Chart"; | ||
?> | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<title><?php echo $cakeDescription ?></title> | ||
<link href="../webroot/css/cake.generic.css" type="text/css" rel="stylesheet"> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | ||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
//default | ||
getAjaxData('2013'); | ||
|
||
$('#dynamic_data').change(function() { | ||
var id = $('#dynamic_data').val(); | ||
getAjaxData(id); | ||
}); | ||
|
||
var options = { | ||
chart: { | ||
renderTo: 'container', | ||
type: 'column' | ||
}, | ||
title: { | ||
text: 'Highcharts Chart PHP with MySQL Example', | ||
x: -20 //center | ||
}, | ||
subtitle: { | ||
text: 'Sumber : Jabatan XYZ', | ||
x: -20 | ||
}, | ||
xAxis: { | ||
categories: [] | ||
}, | ||
yAxis: { | ||
title: { | ||
text: 'Jumlah Pelawat' | ||
}, | ||
plotLines: [{ | ||
value: 0, | ||
width: 1, | ||
color: '#808080' | ||
}] | ||
}, | ||
tooltip: { | ||
headerFormat: '<span style="font-size:11px">{series.name}</span><br>', | ||
pointFormat: '<span style="color:{point.color}">{point.name}</span>:<b>{point.y}</b> of total<br/>' | ||
}, | ||
plotOptions: { | ||
series: { | ||
borderWidth: 0, | ||
dataLabels: { | ||
enabled: true, | ||
format: '{point.y}' | ||
} | ||
} | ||
}, | ||
legend: { | ||
layout: 'vertical', | ||
align: 'right', | ||
verticalAlign: 'top', | ||
x: -40, | ||
y: 100, | ||
floating: true, | ||
borderWidth: 1, | ||
shadow: true | ||
}, | ||
series: [] | ||
}; | ||
function getAjaxData(id) { | ||
$.getJSON("data/data-basic-colm-ajax.php", {id: id}, function(json) { | ||
options.xAxis.categories = json[0]['data']; //xAxis: {categories: []} | ||
options.series[0] = json[1]; | ||
chart = new Highcharts.Chart(options); | ||
}); | ||
} | ||
|
||
}); | ||
</script> | ||
<script src="http://code.highcharts.com/highcharts.js"></script> | ||
<script src="http://code.highcharts.com/modules/exporting.js"></script> | ||
|
||
</head> | ||
<body> | ||
<a class="link_header" href="/highcharts/"><< Back to index</a> | ||
<div class="menu_top" > | ||
<select id="dynamic_data"> | ||
<option value="">Pilih</option> | ||
<option value="2013">2013</option> | ||
<option value="2012">2012</option> | ||
<option value="2011">2011</option> | ||
</select> | ||
</div> | ||
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto;"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
/** | ||
* | ||
* | ||
* @link https://github.com/mzm-dev | ||
* @created September 2014 | ||
* @fb https://www.facebook.com/zakimedia | ||
* @email mohdzaki04@gmail.com | ||
*/ | ||
$cakeDescription = "Highcharts Pie Chart"; | ||
?> | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<title><?php echo $cakeDescription ?></title> | ||
<link href="../webroot/css/cake.generic.css" type="text/css" rel="stylesheet"> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | ||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
var options = { | ||
chart: { | ||
renderTo: 'container', | ||
type: 'line' | ||
}, | ||
title: { | ||
text: 'Highcharts Chart PHP with MySQL Example', | ||
x: -20 //center | ||
}, | ||
subtitle: { | ||
text: 'Source: WorldClimate.com', | ||
x: -20 | ||
}, | ||
xAxis: { | ||
categories: [], | ||
title: { | ||
text: 'Bulan' | ||
} | ||
}, | ||
yAxis: { | ||
title: { | ||
text: 'Bilangan Pelawat' | ||
}, | ||
plotLines: [{ | ||
value: 0, | ||
width: 1, | ||
color: '#808080' | ||
}] | ||
}, | ||
tooltip: { | ||
valueSuffix: '°C' | ||
}, | ||
legend: { | ||
layout: 'vertical', | ||
align: 'right', | ||
verticalAlign: 'middle', | ||
borderWidth: 0 | ||
}, | ||
series: [] | ||
}; | ||
$.getJSON("data/data-basic-colm.php", function(json) { | ||
options.xAxis.categories = json[0]['data']; //xAxis: {categories: []} | ||
options.series[0] = json[1]; | ||
chart = new Highcharts.Chart(options); | ||
}); | ||
}); | ||
</script> | ||
<script src="http://code.highcharts.com/highcharts.js"></script> | ||
<script src="http://code.highcharts.com/modules/exporting.js"></script> | ||
</head> | ||
<body> | ||
<a class="link_header" href="/highcharts/"><< Back to index</a> | ||
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
#Basic Line | ||
require '../../conn/connection.php'; | ||
|
||
$id = $_GET['id']; | ||
|
||
$result = mysql_query("SELECT id, year AS TAHUN, month AS BULAN, COUNT( * ) AS JUMLAH FROM activities WHERE year=" . $id . " GROUP BY MONTH ORDER BY id"); | ||
|
||
$bln = array(); | ||
$bln['name'] = 'Bulan'; | ||
$rows['name'] = 'Jumlah Pelawat'; | ||
while ($r = mysql_fetch_array($result)) { | ||
$bln['data'][] = $r['BULAN']; | ||
$rows['data'][] = $r['JUMLAH']; | ||
} | ||
$rslt = array(); | ||
array_push($rslt, $bln); | ||
array_push($rslt, $rows); | ||
print json_encode($rslt, JSON_NUMERIC_CHECK); | ||
|
||
mysql_close($con); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
#Pie Chart | ||
require '../../conn/connection.php'; | ||
|
||
$result = mysql_query("SELECT id, year AS TAHUN, COUNT( * ) AS JUMLAH FROM activities GROUP BY TAHUN"); | ||
#$result = mysql_query("SELECT name, val FROM web_marketing"); | ||
|
||
//$rows = array(); | ||
$rows['type'] = 'pie'; | ||
$rows['name'] = 'Pelawat'; | ||
//$rows['innerSize'] = '50%'; | ||
while ($r = mysql_fetch_array($result)) { | ||
$rows['data'][] = array('Tahun '.$r['TAHUN'].'"', $r['JUMLAH']); | ||
} | ||
$rslt = array(); | ||
array_push($rslt,$rows); | ||
print json_encode($rslt, JSON_NUMERIC_CHECK); | ||
|
||
mysql_close($con); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
/** | ||
* | ||
* | ||
* @link https://github.com/mzm-dev | ||
* @created September 2014 | ||
* @fb https://www.facebook.com/zakimedia | ||
* @email mohdzaki04@gmail.com | ||
*/ | ||
$cakeDescription = "Highcharts Pie Chart"; | ||
?> | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<title><?php echo $cakeDescription ?></title> | ||
<link href="../webroot/css/cake.generic.css" type="text/css" rel="stylesheet"> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | ||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
|
||
var options = { | ||
chart: { | ||
renderTo: 'container', | ||
type: 'pie', | ||
options3d: { | ||
enabled: true, | ||
alpha: 45, | ||
beta: 0 | ||
} | ||
|
||
}, | ||
title: { | ||
text: 'Browser market shares at a specific website, 2014' | ||
}, | ||
tooltip: { | ||
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>({point.y} pengunjung)' | ||
}, | ||
plotOptions: { | ||
pie: { | ||
allowPointSelect: true, | ||
cursor: 'pointer', | ||
depth: 35, | ||
dataLabels: { | ||
enabled: true, | ||
format: '{point.name}' | ||
} | ||
} | ||
}, | ||
series: [] | ||
}; | ||
|
||
$.getJSON("data/data-pie-chart2.php", function(json) { | ||
options.series = json; | ||
chart = new Highcharts.Chart(options); | ||
}); | ||
}); | ||
</script> | ||
<script src="http://code.highcharts.com/highcharts.js"></script> | ||
<script src="http://code.highcharts.com/highcharts-3d.js"></script> | ||
<script src="http://code.highcharts.com/modules/exporting.js"></script> | ||
</head> | ||
<body> | ||
<a class="link_header" href="/highcharts/"><< Back to index</a> | ||
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters