From b3279299cf25f05cf22a238195c1b9e58d23ab3f Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Thu, 10 Apr 2014 21:05:14 -0700 Subject: [PATCH] Adjusting payment graph --- app/controllers/payments_controller.rb | 25 +++++++++++-------------- app/views/payments/index.html.erb | 20 +++++++++++++++----- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb index a1a4a2e..8b7633c 100755 --- a/app/controllers/payments_controller.rb +++ b/app/controllers/payments_controller.rb @@ -45,22 +45,19 @@ class PaymentsController < ApplicationController payment_months = @payments.sort_by(&:date).group_by{ |p| p.date.beginning_of_month } @payments_by_month = [] payment_months.each do |month| - # Only grab the last year from today - if month.first > (Date.today - 1.year) && month.first < Date.today - # Calculate sum of amounts for each month and store at end of month array - @payments_by_month << [month.first.to_time.to_i*1000, month.last.sum{|p| - amount = amount_or_level(p) - if chart_type.include?(amount) - if chart_name == "members" - 1 # Output 1 to count members - else - amount # Output dollars to count amount - end + # Calculate sum of amounts for each month and store at end of month array + @payments_by_month << [month.first.to_time.to_i*1000, month.last.sum{|p| + amount = amount_or_level(p) + if chart_type.include?(amount) + if chart_name == "members" + 1 # Output 1 to count members else - 0 + amount # Output dollars to count amount end - }] - end + else + 0 + end + }] end return @payments_by_month diff --git a/app/views/payments/index.html.erb b/app/views/payments/index.html.erb index 8eb73d1..b11f64d 100755 --- a/app/views/payments/index.html.erb +++ b/app/views/payments/index.html.erb @@ -6,8 +6,8 @@ $(function() { $( "#graph" ).dialog({ autoOpen: false, - height: 325, - width: 525, + height: 480, + width: 640, modal: true, }); $( "#graph-button" ).click(function() { @@ -16,12 +16,22 @@ $(function() { $('#graph').highcharts({ chart: { - type: 'area' + type: 'area', + zoomType : 'x', + resetZoomButton : { + position: { + align: 'left' + } + }, }, title: { - style : { fontSize: '10px' }, + style : { fontSize: '12px' }, text: "Numbers for Most Recent Month Greater Than They Appear" }, + subtitle: { + style : { fontSize: '10px' }, + text: "Click and Drag to Zoom." + }, xAxis: { type: 'datetime' }, @@ -96,7 +106,7 @@ $(function() { }); -
+

Listing payments