Module: VisualizationsHelper

Defined in:
app/helpers/visualizations_helper.rb

Instance Method Summary collapse

Instance Method Details

#visualization(options = {}, html_options = {}) {|config| ... } ⇒ Object

Example of how to use in HAML view:

= visualization do |v|
  - v.serie :data, <data>
  - v.background "openstreetmap.hot"
  - v.background "openweather.precipitations"
  - v.background "openweather.heat"
  - v.choropleth :<property>, :data
  - v.control :fullscreen
  - v.control :layer_selector
  - v.control :background_selector
  - v.control :search

Yields:

  • (config)

205
206
207
208
209
# File 'app/helpers/visualizations_helper.rb', line 205

def visualization(options = {}, html_options = {})
  config = Visualization::Configuration.new({ categories_colors: theme_colors }.merge(options))
  yield config
  (:div, nil, html_options.deep_merge(data: { visualization: config.to_json }))
end