module Spout::Models::Graphables
Constants
- DEFAULT_CLASS
- GRAPHABLE_CLASSES
Public Class Methods
for(variable, chart_variable, stratification_variable, subjects)
click to toggle source
# File lib/spout/models/graphables.rb, line 22 def self.for(variable, chart_variable, stratification_variable, subjects) graph_type = get_graph_type(variable, chart_variable, stratification_variable) (GRAPHABLE_CLASSES[graph_type] || DEFAULT_CLASS).new(variable, chart_variable, stratification_variable, subjects) end
get_graph_type(variable, chart_variable, stratification_variable)
click to toggle source
# File lib/spout/models/graphables.rb, line 27 def self.get_graph_type(variable, chart_variable, stratification_variable) if stratification_variable.nil? "histogram" else "#{variable_to_graph_type(variable)}_vs_#{variable_to_graph_type(chart_variable)}" end end
variable_to_graph_type(variable)
click to toggle source
# File lib/spout/models/graphables.rb, line 35 def self.variable_to_graph_type(variable) variable_type = (variable ? variable.type : nil) case variable_type when "numeric", "integer" "numeric" else variable_type end end