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 }
|
payment_months = @payments.sort_by(&:date).group_by{ |p| p.date.beginning_of_month }
|
||||||
@payments_by_month = []
|
@payments_by_month = []
|
||||||
payment_months.each do |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
|
# 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|
|
@payments_by_month << [month.first.to_time.to_i*1000, month.last.sum{|p|
|
||||||
amount = amount_or_level(p)
|
amount = amount_or_level(p)
|
||||||
|
@ -61,7 +59,6 @@ class PaymentsController < ApplicationController
|
||||||
end
|
end
|
||||||
}]
|
}]
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
return @payments_by_month
|
return @payments_by_month
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,8 +6,8 @@ $(function() {
|
||||||
|
|
||||||
$( "#graph" ).dialog({
|
$( "#graph" ).dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
height: 325,
|
height: 480,
|
||||||
width: 525,
|
width: 640,
|
||||||
modal: true,
|
modal: true,
|
||||||
});
|
});
|
||||||
$( "#graph-button" ).click(function() {
|
$( "#graph-button" ).click(function() {
|
||||||
|
@ -16,12 +16,22 @@ $(function() {
|
||||||
|
|
||||||
$('#graph').highcharts({
|
$('#graph').highcharts({
|
||||||
chart: {
|
chart: {
|
||||||
type: 'area'
|
type: 'area',
|
||||||
|
zoomType : 'x',
|
||||||
|
resetZoomButton : {
|
||||||
|
position: {
|
||||||
|
align: 'left'
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
style : { fontSize: '10px' },
|
style : { fontSize: '12px' },
|
||||||
text: "Numbers for Most Recent Month Greater Than They Appear"
|
text: "Numbers for Most Recent Month Greater Than They Appear"
|
||||||
},
|
},
|
||||||
|
subtitle: {
|
||||||
|
style : { fontSize: '10px' },
|
||||||
|
text: "Click and Drag to Zoom."
|
||||||
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'datetime'
|
type: 'datetime'
|
||||||
},
|
},
|
||||||
|
@ -96,7 +106,7 @@ $(function() {
|
||||||
});
|
});
|
||||||
</script>
|
</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>
|
<h1>Listing payments <button id="graph-button" class="btn">View Graph</button></h1>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user