Class: Ecoportal::API::V2::Page::Component::ChartField

Inherits:
Ecoportal::API::V2::Page::Component show all
Defined in:
lib/ecoportal/api/v2/page/component/chart_field.rb,
lib/ecoportal/api/v2/page/component/chart_field/serie.rb,
lib/ecoportal/api/v2/page/component/chart_field/config.rb,
lib/ecoportal/api/v2/page/component/chart_field/sankey.rb,
lib/ecoportal/api/v2/page/component/chart_field/heatmap.rb,
lib/ecoportal/api/v2/page/component/chart_field/benchmark.rb,
lib/ecoportal/api/v2/page/component/chart_field/frequency.rb,
lib/ecoportal/api/v2/page/component/chart_field/indicator.rb,
lib/ecoportal/api/v2/page/component/chart_field/multiseries.rb,
lib/ecoportal/api/v2/page/component/chart_field/series_config.rb

Defined Under Namespace

Classes: Benchmark, Config, Frequency, Heatmap, Indicator, Multiseries, Sankey, Serie, SeriesConfig

Constant Summary collapse

MODES =
%w[
  frequency heatmap sankey
  series faceted_series
  indicator benchmark
].freeze

Constants included from Common::Content::StringDigest

Common::Content::StringDigest::MAX_HASH_LABEL

Constants included from Common::Content::DoubleModel::Diffable

Common::Content::DoubleModel::Diffable::DIFF_CLASS

Constants included from Common::Content::DoubleModel::Base

Common::Content::DoubleModel::Base::NOT_USED

Instance Attribute Summary

Attributes included from Common::Content::DoubleModel::Parented

#_parent, #_parent_key

Instance Method Summary collapse

Methods inherited from Ecoportal::API::V2::Page::Component

#attached?, #bindings, #bindings?, #configure, #delete!, #forces, get_class, #indexable_label, #move, #multi_section?, new_doc, #ooze, #ref, #ref_backend, #replace, #replace_bindings, #section, #unattach!

Methods included from Common::Content::StringDigest

#hash_label, #indexable_label

Methods inherited from Common::Content::DoubleModel

#initialize, new_uuid

Methods included from Common::Content::DoubleModel::Diffable

#as_update, #dirty?

Methods included from Common::Content::Includer

#include_missing

Constructor Details

This class inherits a constructor from Ecoportal::API::Common::Content::DoubleModel

Instance Method Details

#configObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ecoportal/api/v2/page/component/chart_field.rb', line 42

def config
  case mode
  when 'frequency'
    frequency_config
  when 'series'
    series_config
  when 'heatmap'
    heatmap_config
  when 'sankey'
    sankey_config
  when 'indicator'
    indicator_config
  when 'faceted_series'
    faceted_series_config
  when 'benchmark'
    benchmark_config
  end
end

#mode=(value) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/ecoportal/api/v2/page/component/chart_field.rb', line 33

def mode=(value)
  raise "Unsuported mode #{value}. Should be one of #{MODES}" unless MODES.include?(value)
  config_doc(nil)
  doc['mode'] = value
  config_doc(config.class.new_doc)

  mode
end