Module: Hyrax::ChartsHelper

Included in:
HyraxHelperBehavior
Defined in:
app/helpers/hyrax/charts_helper.rb

Instance Method Summary collapse

Instance Method Details

#hash_to_chart(data) ⇒ Object

Examples:

A chart with a drilldown

{
  "First" => {
    "Second" => 3,
    "Third" => 3
  }
}

A chart without a drilldown

{
  "First" => 3,
  "Second" => 4
}


16
17
18
19
20
21
22
# File 'app/helpers/hyrax/charts_helper.rb', line 16

def hash_to_chart(data)
  data = ChartData.new(data)
  {
    drilldown: { series: data.drilldown },
    series: data.series
  }
end