allow charts to have auto width and height

This commit is contained in:
Lee Lawlor
2014-04-21 22:03:42 -04:00
parent 34ff4d7dc4
commit 07f0e6a3a5
2 changed files with 9 additions and 7 deletions

View File

@ -40,9 +40,11 @@ class ChartsController < ApplicationController
# allow these parameters when creating feed querystring
feed_params = ['key','days','start','end','round','timescale','average','median','sum','results','location','status']
# default chart size
@width = Chart.default_width
@height = Chart.default_height
# set chart size
width = params[:width].present? ? params[:width] : Chart.default_width
@width_style = (width == 'auto') ? '' : "width: #{width.to_i - 25}px;"
height = params[:height].present? ? params[:height] : Chart.default_height
@height_style = (height == 'auto') ? '' : "height: #{height.to_i - 25}px;"
# add extra parameters to querystring
@qs = ''