0
0

Merge pull request #188 from syuilo/remove-charts

[Client] Remove graphs temporary
This commit is contained in:
syuilo⭐️ 2017-02-20 14:41:55 +09:00 committed by GitHub
commit 9be8a187a7
7 changed files with 0 additions and 261 deletions

View File

@ -74,7 +74,6 @@
"chai": "3.5.0",
"chai-http": "3.0.0",
"chalk": "1.1.3",
"chart.js": "2.5.0",
"compression": "1.6.2",
"cors": "2.8.1",
"cropperjs": "1.0.0-beta",

View File

@ -5,7 +5,6 @@
// Style
import './style.styl';
require('chart.js');
require('./tags');
const riot = require('riot');
const boot = require('../boot');

View File

@ -81,10 +81,6 @@ require('./sub-post-content.tag');
require('./images-viewer.tag');
require('./image-dialog.tag');
require('./donation.tag');
require('./user-posts-graph.tag');
require('./user-friends-graph.tag');
require('./user-likes-graph.tag');
require('./post-status-graph.tag');
require('./users-list.tag');
require('./user-following.tag');
require('./user-followers.tag');

View File

@ -1,75 +0,0 @@
<mk-post-status-graph>
<canvas ref="canv" width={ opts.width } height={ opts.height }></canvas>
<style>
:scope
display block
> canvas
margin 0 auto
</style>
<script>
@mixin \api
@mixin \is-promise
@post = null
@post-promise = if @is-promise @opts.post then @opts.post else Promise.resolve @opts.post
@on \mount ~>
post <~ @post-promise.then
@post = post
@update!
@api \aggregation/posts/like do
post_id: @post.id
limit: 30days
.then (likes) ~>
likes = likes.reverse!
@api \aggregation/posts/repost do
post_id: @post.id
limit: 30days
.then (repost) ~>
repost = repost.reverse!
@api \aggregation/posts/reply do
post_id: @post.id
limit: 30days
.then (replies) ~>
replies = replies.reverse!
new Chart @refs.canv, do
type: \bar
data:
labels: likes.map (x, i) ~> if i % 3 == 2 then x.date.day + '日' else ''
datasets: [
{
label: \いいね
type: \line
data: likes.map (x) ~> x.count
line-tension: 0
border-width: 2
fill: true
background-color: 'rgba(247, 121, 108, 0.2)'
point-background-color: \#fff
point-radius: 4
point-border-width: 2
border-color: \#F7796C
},
{
label: \返信
type: \bar
data: replies.map (x) ~> x.count
background-color: \#555
},
{
label: \Repost
type: \bar
data: repost.map (x) ~> x.count
background-color: \#a2d61e
}
]
options:
responsive: false
</script>
</mk-post-status-graph>

View File

@ -1,67 +0,0 @@
<mk-user-friends-graph>
<canvas ref="canv" width="750" height="250"></canvas>
<style>
:scope
display block
width 750px
height 250px
</style>
<script>
@mixin \api
@mixin \is-promise
@user = null
@user-promise = if @is-promise @opts.user then @opts.user else Promise.resolve @opts.user
@on \mount ~>
user <~ @user-promise.then
@user = user
@update!
@api \aggregation/users/followers do
user_id: @user.id
limit: 30days
.then (followers) ~>
followers = followers.reverse!
@api \aggregation/users/following do
user_id: @user.id
limit: 30days
.then (following) ~>
following = following.reverse!
new Chart @refs.canv, do
type: \line
data:
labels: following.map (x, i) ~> if i % 3 == 2 then x.date.day + '日' else ''
datasets: [
{
label: \フォロー
data: following.map (x) ~> x.count
line-tension: 0
border-width: 2
fill: true
background-color: 'rgba(127, 221, 64, 0.2)'
point-background-color: \#fff
point-radius: 4
point-border-width: 2
border-color: \#7fdd40
},
{
label: \フォロワー
data: followers.map (x) ~> x.count
line-tension: 0
border-width: 2
fill: true
background-color: 'rgba(255, 99, 132, 0.2)'
point-background-color: \#fff
point-radius: 4
point-border-width: 2
border-color: \#FF6384
}
]
options:
responsive: false
</script>
</mk-user-friends-graph>

View File

@ -1,42 +0,0 @@
<mk-user-likes-graph>
<canvas ref="canv" width="750" height="250"></canvas>
<style>
:scope
display block
width 750px
height 250px
</style>
<script>
@mixin \api
@mixin \is-promise
@user = null
@user-promise = if @is-promise @opts.user then @opts.user else Promise.resolve @opts.user
@on \mount ~>
user <~ @user-promise.then
@user = user
@update!
@api \aggregation/users/like do
user_id: @user.id
limit: 30days
.then (likes) ~>
likes = likes.reverse!
new Chart @refs.canv, do
type: \bar
data:
labels: likes.map (x, i) ~> if i % 3 == 2 then x.date.day + '日' else ''
datasets: [
{
label: \いいねした数
data: likes.map (x) ~> x.count
background-color: \#F7796C
}
]
options:
responsive: false
</script>
</mk-user-likes-graph>

View File

@ -1,71 +0,0 @@
<mk-user-posts-graph>
<canvas ref="canv" width="750" height="250"></canvas>
<style>
:scope
display block
width 750px
height 250px
</style>
<script>
@mixin \api
@mixin \is-promise
@user = null
@user-promise = if @is-promise @opts.user then @opts.user else Promise.resolve @opts.user
@on \mount ~>
user <~ @user-promise.then
@user = user
@update!
@api \aggregation/users/post do
user_id: @user.id
limit: 30days
.then (data) ~>
data = data.reverse!
new Chart @refs.canv, do
type: \line
data:
labels: data.map (x, i) ~> if i % 3 == 2 then x.date.day + '日' else ''
datasets: [
{
label: \投稿
data: data.map (x) ~> x.posts
line-tension: 0
point-radius: 0
background-color: \#555
border-color: \transparent
},
{
label: \Repost
data: data.map (x) ~> x.reposts
line-tension: 0
point-radius: 0
background-color: \#a2d61e
border-color: \transparent
},
{
label: \返信
data: data.map (x) ~> x.replies
line-tension: 0
point-radius: 0
background-color: \#F7796C
border-color: \transparent
}
]
options:
responsive: false
scales:
x-axes: [
{
stacked: true
}
]
y-axes: [
{
stacked: true
}
]
</script>
</mk-user-posts-graph>