Module: Effective::EffectiveDatatable::Charts

Included in:
Datatable
Defined in:
app/models/effective/effective_datatable/charts.rb

Instance Method Summary collapse

Instance Method Details

#charts_dataObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/effective/effective_datatable/charts.rb', line 5

def charts_data
  HashWithIndifferentAccess.new().tap do |retval|
    (charts || {}).each do |name, chart|
      retval[name] = {
        name: chart[:name],
        type: chart[:type],
        options: chart[:options],
        data: (instance_exec(&chart[:block]) if chart[:block])
      }
    end
  end
end