Last active
August 29, 2015 13:59
-
-
Save soldair/10589536 to your computer and use it in GitHub Desktop.
chipmunk graph!!
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
<!DOCTYPE html> | |
<html> | |
<head></head> | |
<body> | |
<h1>Chipmunks!</h1> | |
<div id="graph"> | |
</div> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script src="https://api.pinocc.io/pinoccio.js"></script> | |
<script src="https://api.pinocc.io/static/highcharts.js"></script> | |
<script src="https://api.pinocc.io/static/graphs.js"></script> | |
<script> | |
var api = pinoccioAPI(); | |
api.token = "a4805ab68e3955ad89313ec205637a58"; | |
chipmunkStream = api.stats({"troop":9,"scout":2,"report":"announce","start":0}).on("error",function(err){ | |
console.log('stream error. this will have to be remade',err); | |
$("<div>").insertBefore("#graph").css({color:'red'}).text(err.messge||err+''); | |
}); | |
Highcharts.setOptions({ | |
global: { | |
useUTC: false | |
} | |
}); | |
graphStream = graphs.lines("#graph",{ | |
title:{ | |
text:"chipmunks!" | |
} | |
}); | |
chipmunkStream.pipe(graphs.through(function(data){ | |
if(data.value.report[1] != 'chipmunk'){ | |
return; | |
} | |
this.queue({ | |
name:'chipmunk',point:{ | |
id:data.time+'!chipmunk', | |
x:data.time, | |
y:1 | |
} | |
}); | |
})).pipe(graphStream); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment