last modified added

master
Tomek Dubrownik 2013-09-23 16:47:58 +02:00
parent 2680322afb
commit e00bd8b018
2 changed files with 9 additions and 4 deletions

View File

@ -3,13 +3,16 @@ window.onload = function() {
var today = new Date(),
year = 1900 + today.getYear(),
month = today.getMonth() + 1,
urlBase = 'https://kasownik.hackerspace.pl/api/';
urlBase = 'https://kasownik.hackerspace.pl/api/',
modified;
for(i = 0; i < 12; ++i) {
var xhr = new XMLHttpRequest();
xhr.open("GET", urlBase + 'month/'+ year + '/' + month + '.json', false);
xhr.send();
var res = JSON.parse(xhr.response).content,
date = new Date(year, month, 1);
var data = JSON.parse(xhr.response),
res = data.content,
date = new Date(year, month, 1);
modified = modified || data.modified;
required.unshift({ x: date.getTime() / 1000, y: res.required });
paid.unshift({ x: date.getTime() / 1000, y: res.paid });
@ -25,6 +28,8 @@ window.onload = function() {
}
}
console.log(required, paid);
var lastmod = document.getElementById("lastmod");
lastmod.innerHTML = modified;
var palette = new Rickshaw.Color.Palette( { scheme: 'munin' } );
var graph = new Rickshaw.Graph({
element: document.getElementById("plot"),

View File

@ -11,7 +11,7 @@
<body>
<div id="legend"></div>
<div id="plot"></div>
Last modified: <span id="lastmod">-</span>
<style>
#legend {
display: inline-block;