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