[Client] Fix some charts

This commit is contained in:
syuilo
2018-11-03 16:44:05 +09:00
parent c26ed1421b
commit e88f7ca7b2
3 changed files with 101 additions and 36 deletions

View File

@@ -32,9 +32,21 @@ export default Vue.extend({
this.data.forEach(d => d.total = d.notes + d.replies + d.renotes);
const peak = Math.max.apply(null, this.data.map(d => d.total));
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth();
const day = now.getDate();
let x = 0;
this.data.slice().reverse().forEach(d => {
this.data.slice().reverse().forEach((d, i) => {
d.x = x;
const date = new Date(year, month, day - i);
d.date = {
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate()
};
d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay();
d.v = peak == 0 ? 0 : d.total / (peak / 2);