I\'m working on a Rails 3.1.1 app with a dashboard of various line graphs using Highcharts. I implemented the sample code in Railcast 223 (highcharts) -- and everything wor
If you want nothing to be graphed but the date to still show up, then change any zeroes to a javascript null
. If you want to not graph those days, then you should reject them from the array before output.
So:
(3.weeks.ago.to_date..Date.today).map{|date| total=Order.total_on(date).to_f; total.zero? ? "null" : total }.inspect
Or:
(3.weeks.ago.to_date..Date.today).map{|date| Order.total_on(date).to_f}.reject(&:zero?).inspect