Adjusting payment graph
This commit is contained in:
parent
d4286e4ddf
commit
b3279299cf
|
@ -45,8 +45,6 @@ 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)
|
||||
|
@ -61,7 +59,6 @@ class PaymentsController < ApplicationController
|
|||
end
|
||||
}]
|
||||
end
|
||||
end
|
||||
|
||||
return @payments_by_month
|
||||
end
|
||||
|
|
|
@ -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() {
|
|||
});
|
||||
</script>
|
||||
|
||||
<div id="graph" title="Payments by Month" style="height: 250px; width: 500px; float: right;"></div>
|
||||
<div id="graph" title="Payments by Month" style="height: 400px; width: 600px; float: right;"></div>
|
||||
|
||||
|
||||
<h1>Listing payments <button id="graph-button" class="btn">View Graph</button></h1>
|
||||
|
|
Loading…
Reference in New Issue
Block a user