Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

122 lines (102 sloc) 2.725 kb
<!DOCTYPE html>
<html>
<head>
<title>Chillmon</title>
<style type="text/css">
body {
background-color: #111111;
color: #eeeeee;
font-family: tahoma, arial, sans-serif;
padding-left: 100px;
}
h4 {
margin-bottom: 1px;
}
</style>
<script type="text/javascript" src="smoothie.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript">
function Boxed(type) {
this.type = type;
this.val = 0;
}
Boxed.prototype.get = function() {
return this.val;
}
Boxed.prototype.set = function(v) {
this.val = v;
}
function init() {
$.ajax({
url: '/trace',
dataType: 'json',
success: function(data) {
trace_set = data.data;
for (var tracetype in trace_set) {
var tl = new SmoothieChart({
millisPerPixel: 5000,
grid: {
strokeStyle: '#555555',
lineWidth: 1,
millisPerLine: 300000,
verticalSections: 4
},
fps: 0.2,
interpolation: 'line',
scaleSmoothing: 1.0
});
traces = trace_set[tracetype];
for (var id in traces) {
setup_traces(tl, tracetype, traces[id], id);
}
}
}
});
}
function setup_traces(tl, tracetype, tracename, id) {
var dataset = new TimeSeries();
var ts = new Boxed();
var rgb = [
'rgba(255, 0, 0, 1)',
'rgba(0, 255, 0, 1)',
'rgba(0, 0, 255, 1)',
'rgba(220, 0, 220, 1)',
'rgba(2, 183, 98, 1)',
'rgba(98, 27, 120, 1)'
]
// Every second, get the total trace
setInterval(function() {
update_dataset(dataset, ts, tracetype, tracename);
}, 5000);
tl.addTimeSeries(dataset, {strokeStyle: rgb[id], fillStyle: 'rgba(10, 10, 10, 0.1)', lineWidth: 2});
tl.streamTo(document.getElementById(tracetype), 5000);
}
function update_dataset(dataset, ts, tt, tn) {
$.ajax({
url: '/trace/' + tt + '/' + tn + '/' + ts.get(),
dataType: 'json',
success: function(data) {
for (var i in data['data']) {
v = data['data'][i];
dataset.append(v[0], v[1]);
ts.set(v[0]);
}
}
});
}
</script>
</head>
<body onload="init()">
<h1>Chillmon</h1>
<h4>Temps</h4>
<canvas id="temps" width="720" height="200"></canvas>
<h4>PID States</h4>
<canvas id="pidstate" width="720" height="200"></canvas>
<h4>Constants</h4>
<canvas id="constants" width="720" height="200"></canvas>
<h4>Errors</h4>
<canvas id="errors" width="720" height="200"></canvas>
<h4>Physical</h4>
<canvas id="physical" width="720" height="200"></canvas>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.