Class: Hyrax::ChartData

Inherits:
Object
  • Object
show all
Defined in:
app/values/hyrax/chart_data.rb

Defined Under Namespace

Classes: Value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ChartData

Returns a new instance of ChartData.



4
5
6
# File 'app/values/hyrax/chart_data.rb', line 4

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'app/values/hyrax/chart_data.rb', line 3

def data
  @data
end

Instance Method Details

#drilldownObject



8
9
10
11
12
# File 'app/values/hyrax/chart_data.rb', line 8

def drilldown
  data.each_with_object([]) do |(k, v), arr|
    arr << Value.new(k, v).drilldown_value
  end.compact
end

#seriesObject



14
15
16
17
18
# File 'app/values/hyrax/chart_data.rb', line 14

def series
  data.each_with_object([]) do |(k, v), arr|
    arr << Value.new(k, v).series_value
  end
end