11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/how_are_we_doing/controllers/reports_helpers.rb', line 11
def index
respond_to do |format|
format.html
format.json do
render :json => {
:metrics => {
:totals => params[:exclude_totals] ? {} : {
:data => Total.send("json_data_for_#{params[:graph_type]}",params),
:label => "Totals",
:color => 0,
:ticks => Total.send("json_labels_for_#{params[:graph_type]}",params)
},
:prints => params[:exclude_prints] ? {} : {
:data => Print.send("json_data_for_#{params[:graph_type]}",params),
:label => "Prints",
:color => 1,
:ticks => Print.send("json_labels_for_#{params[:graph_type]}",params)
},
:views => params[:exclude_views] ? {} : {
:data => View.send("json_data_for_#{params[:graph_type]}",params),
:label => "Views",
:color => 2,
:ticks => View.send("json_labels_for_#{params[:graph_type]}",params)
},
:shares => params[:exclude_shares] ? {} : {
:data => Share.send("json_data_for_#{params[:graph_type]}",params),
:label => "Shares",
:color => 3,
:ticks => Share.send("json_labels_for_#{params[:graph_type]}",params)
}
},
:format_options => format_options
}
end
end
end
|