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")
|
Time.now.utc.localtime("-04:00")
|
||||||
|
|
||||||
get '/' do
|
get '/' do
|
||||||
@down_everage = Rate.average(:download)
|
@transfer_rate = [
|
||||||
@up_everage = Rate.average(:upload)
|
{'name': 'Download Rate', 'data': Rate.transfer('download')},
|
||||||
|
{'name': 'Upload Rate', 'data': Rate.transfer('upload')}
|
||||||
@max_download = Rate.extremes(:maximum, :download)
|
]
|
||||||
@min_download = Rate.extremes(:minimum, :download)
|
|
||||||
@max_upload = Rate.extremes(:maximum, :upload)
|
@download_rate = [
|
||||||
@min_upload = Rate.extremes(:minimum, :upload)
|
{'name': 'Max Download Rate', 'data': Rate.extremes(:maximum, :download)},
|
||||||
|
{'name': 'Min Download Rate', 'data': Rate.extremes(:minimum, :download)},
|
||||||
@data = [
|
{'name': 'Everage Download Rate', 'data': Rate.extremes(:average, :download)}
|
||||||
{
|
|
||||||
'name': 'Download Rate',
|
|
||||||
'data': Rate.transfer('download')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'Upload Rate',
|
|
||||||
'data': Rate.transfer('upload')
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
erb :home
|
erb :home
|
||||||
|
@ -1,17 +1,3 @@
|
|||||||
<h1>Data Transfer Test</h1>
|
<h1>Data Transfer Test</h1>
|
||||||
<section>
|
<%= bar_chart @transfer_rate, xtitle: "Rate", ytitle: "Datetime", id: "rate_transfer-chart", height: "700px" %>
|
||||||
<h1>Everage: </h1>
|
<%= column_chart @download_rate, xtitle: "Datetime", ytitle: "Rate", id: "download_rate-chart", height: "700px" %>
|
||||||
<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" %>
|
|
Loading…
Reference in New Issue
Block a user