diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-21 07:10:35 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-21 07:10:35 +0900 |
| commit | ba0e57396d5ab609e18dcaf4ba8235376cf429ee (patch) | |
| tree | f73fed603024739483d3edd51fc2191a9d818ebb /src/client | |
| parent | Fix: Remove duplicated key (diff) | |
| download | misskey-ba0e57396d5ab609e18dcaf4ba8235376cf429ee.tar.gz misskey-ba0e57396d5ab609e18dcaf4ba8235376cf429ee.tar.bz2 misskey-ba0e57396d5ab609e18dcaf4ba8235376cf429ee.zip | |
Refactoring
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/app/desktop/views/components/charts.vue | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/client/app/desktop/views/components/charts.vue b/src/client/app/desktop/views/components/charts.vue index 6d6f3a3596..ada024da2d 100644 --- a/src/client/app/desktop/views/components/charts.vue +++ b/src/client/app/desktop/views/components/charts.vue @@ -90,11 +90,25 @@ export default Vue.extend({ }, stats(): any[] { - return ( + const now = new Date(); + const y = now.getFullYear(); + const m = now.getMonth(); + const d = now.getDate(); + const h = now.getHours(); + + const stats = this.span == 'day' ? this.chart.perDay : this.span == 'hour' ? this.chart.perHour : - null - ); + null; + + stats.forEach((s, i) => { + s.date = + this.span == 'day' ? new Date(y, m, d - i) : + this.span == 'hour' ? new Date(y, m, d, h - i) : + null; + }); + + return stats; } }, @@ -560,19 +574,19 @@ export default Vue.extend({ networkRequestsChart(): any { const data = this.stats.slice().reverse().map(x => ({ date: new Date(x.date), - requests: x.network.requests + incoming: x.network.incomingRequests })); return [{ datasets: [{ - label: 'Requests', + label: 'Incoming', fill: true, backgroundColor: rgba(colors.localPlus), borderColor: colors.localPlus, borderWidth: 2, pointBackgroundColor: '#fff', lineTension: 0, - data: data.map(x => ({ t: x.date, y: x.requests })) + data: data.map(x => ({ t: x.date, y: x.incomingRequests })) }] }]; }, |