Skip to content

Instantly share code, notes, and snippets.

@tkiefhaber
Last active December 19, 2015 02:18
Show Gist options
  • Save tkiefhaber/5881837 to your computer and use it in GitHub Desktop.
Save tkiefhaber/5881837 to your computer and use it in GitHub Desktop.
joey
<?php
$limit = stripslashes(str_replace("'","''",$_REQUEST["limit"]));
if (!$limit) $limit = 360;
include "init.php";
connect();
$query = MYSQL_QUERY("SELECT * from settings");
$row = mysql_fetch_array($query);
$beerstring = $row['beerstring'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="120">
<title>KEGERATOR</title>
<link rel="stylesheet" type="text/css" href="style/smallstyle.css" media="screen" />
<!-- Load jQuery -->
<script language="javascript" type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js">
</script>
<!-- Load Google JSAPI -->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(drawChart);
function drawChart() {
var jsonData = $.ajax({
url: "chart.php?limit=<?php echo $limit;?>",
dataType: "json",
async: false
}).responseText;
var obj = jQuery.parseJSON(jsonData);
var data = google.visualization.arrayToDataTable(obj);
var options = {
theme: 'maximized',
backgroundColor: { fill: '#002b36', stroke: '#d4cfbe', strokeWidth: 5 },
hAxis: { baseline : 0, baselineColor: '#d4cfbe', gridlines: {color: '#8d897e'}, textStyle: {color: '#d4cfbe'} },
vAxis: { logScale: false, maxValue: 85, baseline : 0, baselineColor: '#d4cfbe', gridlines: {color: '#8d897e'}, textStyle: {color: '#d4cfbe'} },
legend: { textStyle : { color: '#8d897e' } },
colors: ['#2aa198','#6c71c4','#268bd2','#d43f86'],
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
function refreshChart() {
setInterval(function() {drawChart()}, 6000);
};
$(document).ready(function() {
refreshChart();
});
</script>
<script>
$(document).ready(function() {
$("#temp").load("currenttempsmall.php");
var refreshId = setInterval(function() {
$("#temp").load('currenttempsmall.php');
}, 1000);
$.ajaxSetup({ cache: false });
});
</script>
</head>
<body>
<center><br>
<div id="temp">
</div>
<div id="temp"></div>
<div id="chart_div" style="width: 620px; height: 280px;"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment