Class: RCharts::GraphHelper::Graph::Composition

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/rcharts/graph_helper/graph/composition.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graphable = {}, axis_options = {}) ⇒ Composition

Returns a new instance of Composition.



12
13
14
15
# File 'app/helpers/rcharts/graph_helper/graph/composition.rb', line 12

def initialize(graphable = {}, axis_options = {})
  @data = graphable
  @axes = Axes.new(graphable, axis_options)
end

Instance Attribute Details

#axesObject (readonly)

Returns the value of attribute axes.



7
8
9
# File 'app/helpers/rcharts/graph_helper/graph/composition.rb', line 7

def axes
  @axes
end

Instance Method Details

#valuesObject



17
18
19
20
21
22
23
# File 'app/helpers/rcharts/graph_helper/graph/composition.rb', line 17

def values
  @values ||= case data.values.first
              in Hash then data
              in Array then data.transform_values { it.index_with.with_index { |_, index| index } }
              else data.transform_values { { nil => it } }
              end
end