Class: Spout::Models::Graphables::NumericVsNumeric

Inherits:
Default
  • Object
show all
Defined in:
lib/spout/models/graphables/numeric_vs_numeric.rb

Instance Attribute Summary

Attributes inherited from Default

#chart_variable, #stratification_variable, #subjects, #variable

Instance Method Summary collapse

Methods inherited from Default

#initialize, #stacking, #subtitle, #title, #to_hash, #valid?, #x_axis_title

Constructor Details

This class inherits a constructor from Spout::Models::Graphables::Default

Instance Method Details

#categoriesObject



11
12
13
# File 'lib/spout/models/graphables/numeric_vs_numeric.rb', line 11

def categories
  ["Quartile One", "Quartile Two", "Quartile Three", "Quartile Four"]
end

#seriesObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/spout/models/graphables/numeric_vs_numeric.rb', line 19

def series
  @stratification_variable.domain.options.collect do |option|
    filtered_subjects = filter_and_sort_subjects_by_stratification_option(option)
    next if filtered_subjects.size == 0

    data = [:quartile_one, :quartile_two, :quartile_three, :quartile_four].collect do |quartile|
      array = filtered_subjects.send(quartile).collect(&@variable.id.to_sym)
      array_statistics(array)
    end

    { name: option.display_name, data: data }
  end.compact
end

#unitsObject



15
16
17
# File 'lib/spout/models/graphables/numeric_vs_numeric.rb', line 15

def units
  @variable.units
end