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.


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

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data


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

def data
  @data
end

Instance Method Details

#drilldownObject


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

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

#seriesObject


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

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