diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-08-18 03:52:24 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-08-18 03:52:24 +0900 |
| commit | bc34ac82cf4effe2baba8471315ea4a78dae416a (patch) | |
| tree | ad5785ad45b344b88078b239eaef3ee725ded4ec /src/client/app/desktop/views/pages/admin/admin.users-chart.chart.vue | |
| parent | Merge pull request #2297 from syuilo/update-readme (diff) | |
| download | misskey-bc34ac82cf4effe2baba8471315ea4a78dae416a.tar.gz misskey-bc34ac82cf4effe2baba8471315ea4a78dae416a.tar.bz2 misskey-bc34ac82cf4effe2baba8471315ea4a78dae416a.zip | |
Show some charts in control panel
Diffstat (limited to 'src/client/app/desktop/views/pages/admin/admin.users-chart.chart.vue')
| -rw-r--r-- | src/client/app/desktop/views/pages/admin/admin.users-chart.chart.vue | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/client/app/desktop/views/pages/admin/admin.users-chart.chart.vue b/src/client/app/desktop/views/pages/admin/admin.users-chart.chart.vue new file mode 100644 index 0000000000..10eab85279 --- /dev/null +++ b/src/client/app/desktop/views/pages/admin/admin.users-chart.chart.vue @@ -0,0 +1,53 @@ +<template> +<svg :viewBox="`0 0 ${ viewBoxX } ${ viewBoxY }`"> + <polyline + :points="points" + fill="none" + stroke-width="1" + stroke="#555"/> +</svg> +</template> + +<script lang="ts"> +import Vue from 'vue'; + +export default Vue.extend({ + props: { + data: { + required: true + }, + type: { + type: String, + required: true + } + }, + data() { + return { + chart: this.data, + viewBoxX: 365, + viewBoxY: 70, + points: null + }; + }, + created() { + this.chart.forEach(d => { + d.count = this.type == 'local' ? d.local : d.remote; + }); + + const peak = Math.max.apply(null, this.chart.map(d => d.count)); + + if (peak != 0) { + const data = this.chart.slice().reverse(); + this.points = data.map((d, i) => `${i},${(1 - (d.count / peak)) * this.viewBoxY}`).join(' '); + } + } +}); +</script> + +<style lang="stylus" scoped> +svg + display block + padding 10px + width 100% + +</style> |