refactored charts
This commit is contained in:
parent
d660f1a0be
commit
2a0c030d16
26
app.rb
26
app.rb
@ -8,23 +8,15 @@ set :database_file, 'config/database.yml'
|
||||
Time.now.utc.localtime("-04:00")
|
||||
|
||||
get '/' do
|
||||
@down_everage = Rate.average(:download)
|
||||
@up_everage = Rate.average(:upload)
|
||||
|
||||
@max_download = Rate.extremes(:maximum, :download)
|
||||
@min_download = Rate.extremes(:minimum, :download)
|
||||
@max_upload = Rate.extremes(:maximum, :upload)
|
||||
@min_upload = Rate.extremes(:minimum, :upload)
|
||||
|
||||
@data = [
|
||||
{
|
||||
'name': 'Download Rate',
|
||||
'data': Rate.transfer('download')
|
||||
},
|
||||
{
|
||||
'name': 'Upload Rate',
|
||||
'data': Rate.transfer('upload')
|
||||
},
|
||||
@transfer_rate = [
|
||||
{'name': 'Download Rate', 'data': Rate.transfer('download')},
|
||||
{'name': 'Upload Rate', 'data': Rate.transfer('upload')}
|
||||
]
|
||||
|
||||
@download_rate = [
|
||||
{'name': 'Max Download Rate', 'data': Rate.extremes(:maximum, :download)},
|
||||
{'name': 'Min Download Rate', 'data': Rate.extremes(:minimum, :download)},
|
||||
{'name': 'Everage Download Rate', 'data': Rate.extremes(:average, :download)}
|
||||
]
|
||||
|
||||
erb :home
|
||||
|
@ -1,17 +1,3 @@
|
||||
<h1>Data Transfer Test</h1>
|
||||
<section>
|
||||
<h1>Everage: </h1>
|
||||
<b>Download:</b> <%= @down_everage %> Mbps
|
||||
<b>Upload:</b> <%= @up_everage %> Mbps
|
||||
</section>
|
||||
<section>
|
||||
<h1>Maximum: </h1>
|
||||
<b>Download:</b> <%= @max_download %> Mbps
|
||||
<b>Upload:</b> <%= @max_upload %> Mbps
|
||||
</section>
|
||||
<section>
|
||||
<h1>Minimum: </h1>
|
||||
<b>Download:</b> <%= @min_download %> Mbps
|
||||
<b>Upload:</b> <%= @min_upload %> Mbps
|
||||
</section>
|
||||
<%= bar_chart @data, xtitle: "Datetime", ytitle: "Rate", id: "users-chart", height: "700px" %>
|
||||
<%= bar_chart @transfer_rate, xtitle: "Rate", ytitle: "Datetime", id: "rate_transfer-chart", height: "700px" %>
|
||||
<%= column_chart @download_rate, xtitle: "Datetime", ytitle: "Rate", id: "download_rate-chart", height: "700px" %>
|
Loading…
Reference in New Issue
Block a user