This commit is contained in:
syuilo 2017-06-08 03:25:45 +09:00
parent 1ce662e014
commit 2e139e9d65
2 changed files with 7 additions and 21 deletions

View File

@ -16,7 +16,7 @@
> rect > rect
transform-origin center transform-origin center
transform scale(0.9) transform scale(0.8)
</style> </style>
<script> <script>
@ -33,16 +33,9 @@
let x = 0; let x = 0;
data.reverse().forEach(d => { data.reverse().forEach(d => {
d.x = x; d.x = x;
d.v = d.total / this.peak; let v = d.total / this.peak;
d.color = d.v > 0.75 if (v > 1) v = 1;
? '#196127' d.color = `hsl(180, ${v * 100}%, ${15 + ((1 - v) * 80)}%)`;
: d.v > 0.5
? '#239a3b'
: d.v > 0.25
? '#7bc96f'
: d.v > 0
? '#c6e48b'
: '#eee';
d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay(); d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay();
if (d.date.weekday == 6) x++; if (d.date.weekday == 6) x++;
}); });

View File

@ -59,16 +59,9 @@
let x = 0; let x = 0;
data.reverse().forEach(d => { data.reverse().forEach(d => {
d.x = x; d.x = x;
d.v = d.total / this.peak; let v = d.total / this.peak;
d.color = d.v > 0.75 if (v > 1) v = 1;
? '#195061' d.color = `hsl(180, ${v * 100}%, ${15 + ((1 - v) * 80)}%)`;
: d.v > 0.5
? '#238f9a'
: d.v > 0.25
? '#6fc5c9'
: d.v > 0
? '#8be4dc'
: '#eee';
d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay(); d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay();
if (d.date.weekday == 6) x++; if (d.date.weekday == 6) x++;
}); });