last modified added
parent
2680322afb
commit
e00bd8b018
11
js/plot.js
11
js/plot.js
|
@ -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"),
|
||||
|
|
Loading…
Reference in New Issue