Skip to content

Commit

Permalink
Chart height
Browse files Browse the repository at this point in the history
  • Loading branch information
pikesley committed Feb 16, 2016
1 parent 8d795bf commit d4903cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion app/views/charts/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@
// https://plot.ly/python/overview/
tickcolor: '#f00'
},*/
autosize: false,
height: 500,
width: 380,
margin: {
l: 50, r: 40
l: 50, r: 40, t: 20
},
legend: {
xanchor:"center",
Expand Down
10 changes: 5 additions & 5 deletions app/views/shared/_hours_slider.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<span id='legend'></span>: <div id='slider' data-slider-handle='round' data-slider-id='hours'></div>
<span id='legend'></span> | <div id='slider' data-slider-handle='round' data-slider-id='hours'></div>

<script>
$('#slider').slider({
Expand All @@ -8,7 +8,7 @@
ticks_snap_bounds: 24,
value: parseInt(getParam('hours')),
formatter: function(value) {
return lastDays(value)
return period(value)
},
tooltip_position: 'bottom'
})
Expand All @@ -17,7 +17,7 @@
window.location.href = '?hours=' + $('#slider').data('slider').getValue()
})

$('#legend').text(lastDays(getParam('hours')))
$('#legend').text(period(getParam('hours')))

function getParam(sParam) {
var sPageURL = window.location.search.substring(1);
Expand All @@ -30,9 +30,9 @@
}
}

function lastDays(hours) {
function period(hours) {
var days = Math.round(hours / 24)
var string = (days == 1) ? '24 hours' : days + ' days'
var string = (days == 1) ? '24 hrs' : days + ' days'

return 'last ' + string
}
Expand Down

0 comments on commit d4903cf

Please sign in to comment.