File "highcharts06.php"
Full Path: /home/analogde/www/Bookmarks/CHESS_ON/highcharts06.php
File size: 1.75 KB
MIME-type: text/html
Charset: utf-8
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Highcharts data from JSON Response</title>
<style>
body{
margin-top: 30px;
margin-left:40px;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script type="text/javascript">
$(function () {
var processed_json = new Array();
$.getJSON('charts_datas.php', function(data) {
// Populate series
for (i = 0; i < data.length; i++){
processed_json.push([data[i].key, data[i].value]);
}
// draw chart
$('#container').highcharts({
chart: {
type: "column"
},
title: {
text: "Student data"
},
xAxis: {
type: 'timestamp'
},
yAxis: {
title: {
text: "Scores"
}
},
series: [{
data: processed_json
}]
});
});
});
</script>
</head>
<body>
<div style="width: 800px; margin: 2em auto; padding: 1em; border: 1px solid red; border-radius: 0.5em">
Highcharts data load from a JSON using manual JSON Processing
</div>
<div id="container" style="height: 400px"></div>
</body>
</html>