Skip to content
Snippets Groups Projects
Commit 8454bddf authored by syuilo's avatar syuilo
Browse files

[Client] ✌️

parent 2d73789a
No related branches found
No related tags found
No related merge requests found
<mk-activity-table>
<svg if={ data } ref="canvas" viewBox="0 0 53 6.85">
<svg if={ data } ref="canvas" viewBox="0 0 53 7" preserveAspectRatio="none">
<rect each={ d, i in data } width="0.8" height="0.8"
x={ 52 - (i / 7) } y={ d.date.weekday }
riot-x={ d.x } riot-y={ d.date.weekday }
fill={ d.color }></rect>
</svg>
<style>
......@@ -26,7 +26,9 @@
}).then(data => {
data.forEach(d => d.total = d.posts + d.replies + d.reposts);
this.peak = Math.max.apply(null, data.map(d => d.total));
data.forEach(d => {
let x = 0;
data.reverse().forEach(d => {
d.x = x;
d.v = d.total / this.peak;
d.color = d.v > 0.75
? '#196127'
......@@ -38,6 +40,7 @@
? '#c6e48b'
: '#eee';
d.date.weekday = (new Date(d.date.year + '-' + d.date.month + '-' + d.date.day)).getDay();
if (d.date.weekday == 6) x++;
});
this.update({ data });
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment