Update src/client/app/admin/views/charts.vue

This commit is contained in:
syuilo 2018-11-03 13:08:49 +09:00
parent e7c865f8e3
commit 4853bc9414
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69

View file

@ -41,7 +41,7 @@
import Vue from 'vue'; import Vue from 'vue';
import * as ApexCharts from 'apexcharts'; import * as ApexCharts from 'apexcharts';
const limit = 60; const limit = 80;
const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b)); const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b));
const negate = arr => arr.map(x => -x); const negate = arr => arr.map(x => -x);
@ -208,24 +208,28 @@ export default Vue.extend({
return { return {
series: [{ series: [{
name: 'All', name: 'All',
type: 'line',
data: this.format(type == 'combined' data: this.format(type == 'combined'
? sum(this.stats.notes.local.inc, negate(this.stats.notes.local.dec), this.stats.notes.remote.inc, negate(this.stats.notes.remote.dec)) ? sum(this.stats.notes.local.inc, negate(this.stats.notes.local.dec), this.stats.notes.remote.inc, negate(this.stats.notes.remote.dec))
: sum(this.stats.notes[type].inc, negate(this.stats.notes[type].dec)) : sum(this.stats.notes[type].inc, negate(this.stats.notes[type].dec))
) )
}, { }, {
name: 'Renotes', name: 'Renotes',
type: 'area',
data: this.format(type == 'combined' data: this.format(type == 'combined'
? sum(this.stats.notes.local.diffs.renote, this.stats.notes.remote.diffs.renote) ? sum(this.stats.notes.local.diffs.renote, this.stats.notes.remote.diffs.renote)
: this.stats.notes[type].diffs.renote : this.stats.notes[type].diffs.renote
) )
}, { }, {
name: 'Replies', name: 'Replies',
type: 'area',
data: this.format(type == 'combined' data: this.format(type == 'combined'
? sum(this.stats.notes.local.diffs.reply, this.stats.notes.remote.diffs.reply) ? sum(this.stats.notes.local.diffs.reply, this.stats.notes.remote.diffs.reply)
: this.stats.notes[type].diffs.reply : this.stats.notes[type].diffs.reply
) )
}, { }, {
name: 'Normal', name: 'Normal',
type: 'area',
data: this.format(type == 'combined' data: this.format(type == 'combined'
? sum(this.stats.notes.local.diffs.normal, this.stats.notes.remote.diffs.normal) ? sum(this.stats.notes.local.diffs.normal, this.stats.notes.remote.diffs.normal)
: this.stats.notes[type].diffs.normal : this.stats.notes[type].diffs.normal