diff -r a719b2dcea34 -r 53a6985443f8 cms/app-client/app/components/visu-carto.js --- a/cms/app-client/app/components/visu-carto.js Mon Aug 29 20:01:13 2016 +0200 +++ b/cms/app-client/app/components/visu-carto.js Mon Sep 05 18:45:47 2016 +0200 @@ -3,6 +3,10 @@ export default Ember.Component.extend({ + continentsMapVar: AmCharts.maps.continentsLow, + countriesMapVar: AmCharts.maps.worldLow, + franceMapVar: AmCharts.maps.france2016Low, + filter: Ember.inject.service(), locationObserver: Ember.observer('filter.location', function() { if(!this.get('filter').get('location')) { @@ -10,12 +14,55 @@ } }), + geostats: [], + observerGeostats: Ember.observer('geostats', function() { + //console.log(this.get('geostats')); + }), + didInsertElement: function(){ this.$('#mapdiv').height(Ember.$('.corpus-app-container').height()); this.createAmMap(); }, createAmMap: function() { + var self = this; + + var france2016LowAreas = []; + this.get('franceMapVar')['svg']['g']['path'].forEach(function(area) { + france2016LowAreas.push({ + 'id': area.id, + 'passZoomValuesToTarget': false, + 'autoZoom': false, + 'selectable': true + }) + }); + + var continentsLowAreas = []; + this.get('continentsMapVar')['svg']['g']['path'].forEach(function(area) { + var object = { + 'id': area.id, + 'linkToObject': { + 'mapVar': self.get('countriesMapVar'), + 'getAreasFromMap': true + }, + 'passZoomValuesToTarget': true, + 'autoZoom': true + }; + if(area.id === 'europe') { + object['linkToObject']['areas'] = [{ + 'id': 'FR', + 'linkToObject': { + 'mapVar': self.get('franceMapVar'), + 'getAreasFromMap': true, + 'areas': france2016LowAreas + }, + 'autoZoom': true, + 'selectable': true + }]; + } + continentsLowAreas.push(object); + }); + this.set('map', AmCharts.makeChart('mapdiv', { 'type': 'map', 'fontFamily': 'sans-serif', @@ -38,148 +85,8 @@ }, 'dataProvider': { - 'map': 'continentsLow', - 'areas': [{ - 'id':'south_america', - 'linkToObject': { - 'map': 'worldLow', - 'getAreasFromMap': true - }, - 'passZoomValuesToTarget': true, - 'autoZoom': true - }, - { - 'id':'north_america', - 'linkToObject': { - 'map': 'worldLow', - 'getAreasFromMap': true - }, - 'passZoomValuesToTarget': true, - 'autoZoom': true - }, - { - 'id':'asia', - 'linkToObject': { - 'map': 'worldLow', - 'getAreasFromMap': true - }, - 'passZoomValuesToTarget': true, - 'autoZoom': true - }, - { - 'id':'europe', - 'linkToObject': { - 'map': 'worldLow', - 'getAreasFromMap': true, - 'areas': [{ - 'id': 'FR', - 'linkToObject': { - 'map': 'france2016Low', - 'getAreasFromMap': true, - 'areas': [{ - 'id': 'FR-A', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-B', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-C', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-D', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-E', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-F', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-G', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-H', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-I', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-J', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-K', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-L', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }, - { - 'id': 'FR-M', - 'passZoomValuesToTarget': false, - 'autoZoom': false, - 'selectable': true - }] - }, - 'autoZoom': true, - 'selectable': true - }] - }, - 'passZoomValuesToTarget': true, - 'autoZoom': true - }, - { - 'id':'australia', - 'linkToObject': { - 'map': 'worldLow', - 'getAreasFromMap': true - }, - 'passZoomValuesToTarget': true, - 'autoZoom': true - }, - { - 'id':'africa', - 'linkToObject': { - 'map': 'worldLow', - 'getAreasFromMap': true - }, - 'passZoomValuesToTarget': true, - 'autoZoom': true - }] + 'mapVar': this.get('continentsMapVar'), + 'areas': continentsLowAreas }, listeners: [{ @@ -195,6 +102,10 @@ clickMapObject: function(event) { this.get('filter').set('location', event.mapObject.title); + + /*this.get('geostats').forEach( function (geostat) { + console.log('geostat', geostat.get('id'), geostat.get('count')); + });*/ }, homeButtonClicked: function(event) {