cms/app-client/app/components/visu-carto.js
changeset 291 478cdcc56a63
parent 290 ca990333f838
child 306 3fccf43160a7
--- a/cms/app-client/app/components/visu-carto.js	Sun Sep 25 14:02:11 2016 +0200
+++ b/cms/app-client/app/components/visu-carto.js	Sun Sep 25 20:05:56 2016 +0200
@@ -13,7 +13,8 @@
     franceMapVar: AmCharts.maps.france2016Low,
     franceAreas: [],
 
-    locationQueryParam: 'world',
+    locationQueryParam: '',
+    dataProvider: {},
 
     color: 'rgba(113,132,141,.2)',
 
@@ -31,26 +32,33 @@
                 if(this.get('map').selectedObject.parentObject.mapVar === this.get('countriesMapVar')) {
                     if(this.get('map').selectedObject.id === 'FR') {
                         this.setFranceAreas();
-                        this.get('map')['dataProvider'] = {
+                        this.set('dataProvider', {
                             'mapVar': this.get('franceMapVar'),
                             'getAreasFromMap': true,
                             'areas': this.get('franceAreas')
-                        };
+                        });
+                        this.get('map')['dataProvider'] = this.get('dataProvider');
                         this.get('map').validateData();
                     }
                 } else if(this.get('map').selectedObject.parentObject.mapVar === this.get('continentsMapVar')) {
                     this.setCountriesAreas();
-                    this.get('map')['dataProvider'] = {
+                    this.set('dataProvider', {
                         'mapVar': this.get('countriesMapVar'),
                         'getAreasFromMap': true,
                         'areas': this.get('countriesAreas'),
                         'zoomLevel': this.get('map').zoomLevel(),
                         'zoomLatitude': this.get('map').zoomLatitude(),
                         'zoomLongitude': this.get('map').zoomLongitude()
-                    };
+                    });
+                    this.get('map')['dataProvider'] = this.get('dataProvider');
                     this.get('map').validateData();
                 }
             } else {
+                this.setContinentsAreas();
+                this.set('dataProvider', {
+                    'mapVar': this.get('continentsMapVar'),
+                    'areas': this.get('continentsAreas')
+                });
                 this.createAmMap();
             }
         }
@@ -142,7 +150,12 @@
 
     createAmMap: function() {
         var self = this;
+        
         this.setContinentsAreas();
+        this.set('dataProvider', {
+            'mapVar': this.get('continentsMapVar'),
+            'areas': this.get('continentsAreas')
+        });
         this.set('map', AmCharts.makeChart('mapdiv', {
             'type': 'map',
             'fontFamily': 'sans-serif',
@@ -162,10 +175,7 @@
             'zoomControl': {
                 'zoomControlEnabled': false,
             },
-            'dataProvider': {
-                'mapVar': this.get('continentsMapVar'),
-                'areas': this.get('continentsAreas')
-            },
+            'dataProvider': this.get('dataProvider'),
             listeners: [{
                 'event':'clickMapObject',
                 'method': Ember.run.bind(this, 'clickMapObject')