Module: CurationConcerns::ChartsHelper

Included in:
MainAppHelpers
Defined in:
app/helpers/curation_concerns/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
}


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

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