Class: Spout::Models::Graphables::ChoicesVsChoices
- Inherits:
-
Default
- Object
- Default
- Spout::Models::Graphables::ChoicesVsChoices
show all
- Defined in:
- lib/spout/models/graphables/choices_vs_choices.rb
Instance Attribute Summary
Attributes inherited from Default
#chart_variable, #stratification_variable, #subjects, #variable
Instance Method Summary
collapse
Methods inherited from Default
#initialize, #subtitle, #title, #to_hash, #valid?, #x_axis_title
Instance Method Details
#categories ⇒ Object
9
10
11
|
# File 'lib/spout/models/graphables/choices_vs_choices.rb', line 9
def categories
filtered_domain_options(@chart_variable).collect(&:display_name)
end
|
#series ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/spout/models/graphables/choices_vs_choices.rb', line 17
def series
filtered_domain_options(@variable).collect do |option|
filtered_subjects = @subjects.select{ |s| s.send(@variable.id) == option.value }
data = filtered_domain_options(@chart_variable).collect do |chart_option|
filtered_subjects.select{ |s| s.send(@chart_variable.id) == chart_option.value }.count
end
{ name: option.display_name, data: data }
end
end
|
#stacking ⇒ Object
27
28
29
|
# File 'lib/spout/models/graphables/choices_vs_choices.rb', line 27
def stacking
"percent"
end
|
#units ⇒ Object
13
14
15
|
# File 'lib/spout/models/graphables/choices_vs_choices.rb', line 13
def units
"percent"
end
|