en:specs:visualizations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:specs:visualizations [2016/08/26 21:17] (current)
Line 1: Line 1:
 +====== Visualizations ======
 +{{tag>​spec visualization}}
  
 +**Visualization** is a DSL of Ekylibre which permits to display maps with wanted options and content:
 +  * Map backgrounds (OpenStreetMap,​ ESRI...)
 +  * Stackable overlay layers (OpenWeather)
 +  * Data layers with legends (simple, choropleth, categories, bubble, path..) with tooltip
 +  * Controls (zoom, scale, fullscreen, search...)
 +
 +===== How to use it =====
 +
 +Visualization is a view helper so you can call it in your views only. Example:
 +<code haml>
 += visualization do |v|
 +  - v.serie :main, main_serie
 +  - v.background "​Esri.WorldImagery"​
 +  - v.background "​OpenStreetMap.HOT"​
 +  - v.background "​Thunderforest.Landscape"​
 +  - v.bubbles :​available_water_capacity_per_area,​ :main, label: "RU m³/​ha"​
 +  - v.choropleth :​organic_matter_concentration,​ :main, hidden: true, label: "​Matière organique"​
 +  - v.categories :​soil_nature,​ :main
 +  - v.control :zoom
 +  - v.control :scale
 +  - v.control :fullscreen
 +  - v.control :​layer_selector
 +</​code>​
 +
 +===== Technical aspect =====
 +
 +The implementation is made over [[http://​leafletjs.com/​|Leaflet]] which is an open-source JS library to build light-weight maps and compatible with mobile terminals.
 +
 +Leaflet is incorporated in Ekylibre within ''​vendor/​assets/​javascripts/''​. The Leaflet plugins are stored in ''​vendor/​assets/​javascripts/​leaflet/''​.
 +
 +**Note:** Leaflet has been [[https://​github.com/​ekylibre/​erp/​blob/​master/​vendor/​assets/​javascripts/​leaflet.js.erb#​L3442|hacked]] to permit use of Rails Asset Pipeline for markers. It explain that JS is an ''​.js.erb''​ file.
 +
 +Leaflet files are called from ''​app/​assets/​javascripts/​application.js'': ​
 +<code javascript>​
 +//= require leaflet
 +//= require leaflet/<​plugin>​
 +</​code>​
 +
 +Classical used plugins are:
 +  * ''​draw''​ to draw shapes (circles, markers, polygons, lines) on map
 +  * ''​fullscreen''​ to use map in full screen mode (HTML5)
 +  * ''​providers''​ to get map backgrounds
  • en/specs/visualizations.txt
  • Last modified: 2016/08/26 21:17
  • (external edit)