This commit is contained in:
syuilo 2017-08-11 02:10:39 +09:00
parent 04bc84358d
commit 009ffef942
2 changed files with 14 additions and 4 deletions

View file

@ -40,10 +40,15 @@
let x = 0; let x = 0;
data.reverse().forEach(d => { data.reverse().forEach(d => {
d.x = x; d.x = x;
d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay();
d.v = d.total / this.peak; d.v = d.total / this.peak;
if (d.v > 1) d.v = 1; if (d.v > 1) d.v = 1;
d.color = `hsl(170, ${d.v * 100}%, ${15 + ((1 - d.v) * 80)}%)`; const ch = d.date.weekday == 0 || d.date.weekday == 6 ? 30 : 170;
d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay(); const cs = d.v * 100;
const cl = 15 + ((1 - d.v) * 80);
d.color = `hsl(${ch}, ${cs}%, ${cl}%)`;
if (d.date.weekday == 6) x++; if (d.date.weekday == 6) x++;
}); });
this.update({ data }); this.update({ data });

View file

@ -123,10 +123,15 @@
let x = 0; let x = 0;
this.data.reverse().forEach(d => { this.data.reverse().forEach(d => {
d.x = x; d.x = x;
d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay();
d.v = d.total / (peak / 2); d.v = d.total / (peak / 2);
if (d.v > 1) d.v = 1; if (d.v > 1) d.v = 1;
d.color = `hsl(170, ${d.v * 100}%, ${15 + ((1 - d.v) * 80)}%)`; const ch = d.date.weekday == 0 || d.date.weekday == 6 ? 30 : 170;
d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay(); const cs = d.v * 100;
const cl = 15 + ((1 - d.v) * 80);
d.color = `hsl(${ch}, ${cs}%, ${cl}%)`;
if (d.date.weekday == 6) x++; if (d.date.weekday == 6) x++;
}); });
</script> </script>