Sha256: 016b6ba0af727f13cf2a710a909994214beaec16c207b97a0814b29e382f21da

Contents?: true

Size: 866 Bytes

Versions: 12

Compression:

Stored size: 866 Bytes

Contents

require 'spout/models/graphables/default'

module Spout
  module Models
    module Graphables
      class ChoicesVsChoices < Spout::Models::Graphables::Default

        def categories
          filtered_domain_options(@chart_variable).collect(&:display_name)
        end

        def units
          'percent'
        end

        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

        def stacking
          'percent'
        end

      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spout-0.11.0 lib/spout/models/graphables/choices_vs_choices.rb
spout-0.11.0.rc lib/spout/models/graphables/choices_vs_choices.rb
spout-0.11.0.beta3 lib/spout/models/graphables/choices_vs_choices.rb
spout-0.11.0.beta2 lib/spout/models/graphables/choices_vs_choices.rb
spout-0.11.0.beta1 lib/spout/models/graphables/choices_vs_choices.rb
spout-0.10.2 lib/spout/models/graphables/choices_vs_choices.rb
spout-0.10.1 lib/spout/models/graphables/choices_vs_choices.rb
spout-0.10.0 lib/spout/models/graphables/choices_vs_choices.rb
spout-0.10.0.rc3 lib/spout/models/graphables/choices_vs_choices.rb
spout-0.10.0.rc2 lib/spout/models/graphables/choices_vs_choices.rb
spout-0.10.0.rc lib/spout/models/graphables/choices_vs_choices.rb
spout-0.10.0.beta10 lib/spout/models/graphables/choices_vs_choices.rb