change xtics to be further apart and labels to be at bottom in plot.rb
This commit is contained in:
parent
85217081ba
commit
ab9005aec4
4
plot.rb
4
plot.rb
|
@ -8,7 +8,7 @@ end
|
||||||
log_dir = "./log/"
|
log_dir = "./log/"
|
||||||
plotstring = %Q[set terminal 'svg' size 800,400 fname 'Verdana, Helvetica, Arial, sans-serif' \
|
plotstring = %Q[set terminal 'svg' size 800,400 fname 'Verdana, Helvetica, Arial, sans-serif' \
|
||||||
fsize '14' rounded dashed
|
fsize '14' rounded dashed
|
||||||
set key top left outside
|
set key bottom center outside horizontal
|
||||||
|
|
||||||
set style line 1 lt 1 lw 2 pt 7 ps 0.4
|
set style line 1 lt 1 lw 2 pt 7 ps 0.4
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ set xlabel "Time"
|
||||||
set xdata time
|
set xdata time
|
||||||
set timefmt "%s"
|
set timefmt "%s"
|
||||||
set format x "%m/%d"
|
set format x "%m/%d"
|
||||||
set xtics 60*60*24
|
set xtics 60*60*24*7*2
|
||||||
set xrange [1485275000:]
|
set xrange [1485275000:]
|
||||||
set mxtics 2
|
set mxtics 2
|
||||||
set grid ytics mytics xtics mxtics
|
set grid ytics mytics xtics mxtics
|
||||||
|
|
67
stats.erb
67
stats.erb
|
@ -1,67 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Statistics for dcav.pw</title>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Screenshot statistics for dcav.pw</h1>
|
|
||||||
<h2>Leaderboards</h2>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Count</th>
|
|
||||||
<th>Size</th>
|
|
||||||
</tr>
|
|
||||||
<%
|
|
||||||
require 'filesize'
|
|
||||||
class User
|
|
||||||
attr_accessor :name, :count, :size
|
|
||||||
def <=> (other)
|
|
||||||
other.count <=> count
|
|
||||||
end
|
|
||||||
end
|
|
||||||
usernames = ["christoffermadsen","jmaa","jacob","alexander"]
|
|
||||||
users = []
|
|
||||||
shot_dir = "/var/shots/"
|
|
||||||
usernames.each do |username|
|
|
||||||
user = User.new
|
|
||||||
user.name = username
|
|
||||||
size = `du -B1 #{shot_dir}#{username}/ | awk {'print $1'} | head -n 1`
|
|
||||||
count = `ls -1 #{shot_dir}#{username}/ | wc -l | head -n 1`
|
|
||||||
|
|
||||||
[size,count].each do |x|
|
|
||||||
x.delete! "\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
user.size = size.to_i
|
|
||||||
user.count = count.to_i
|
|
||||||
users << user
|
|
||||||
end
|
|
||||||
count = 0
|
|
||||||
users.sort.each do |user|
|
|
||||||
count += 1
|
|
||||||
%>
|
|
||||||
<%= %Q{
|
|
||||||
<tr>
|
|
||||||
<td>#{count}</td>
|
|
||||||
<td>#{user.name}</td>
|
|
||||||
<td class=\"right-align\">#{user.count}</td>
|
|
||||||
<td class=\"right-align\">#{Filesize.from(user.size.to_s + "B").pretty}</td>
|
|
||||||
</tr>}
|
|
||||||
%>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
<h2>Charts</h2>
|
|
||||||
<img src="img/screenshot_count.svg" />
|
|
||||||
<br />
|
|
||||||
<img src="img/screenshot_size.svg" />
|
|
||||||
<br />
|
|
||||||
<img src="img/dcavpie.svg" />
|
|
||||||
<br />
|
|
||||||
<i>Page generated at <%= Time.now %></i>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user