--- a/cms/app-client/app/components/visu-carto.js Tue Dec 20 18:12:12 2016 +0100
+++ b/cms/app-client/app/components/visu-carto.js Tue Dec 20 23:42:18 2016 +0100
@@ -8,6 +8,7 @@
constants: Ember.inject.service(),
colors: Ember.inject.service(),
+ filter: Ember.inject.service(),
map: null,
@@ -20,6 +21,14 @@
dataProvider: {},
+ colorScale: Ember.computed('maxCount', 'minCount', function () {
+ let maxCount = this.get('maxCount');
+ let minCount = this.get('minCount');
+ return this.get('colors').getScaleLinear(minCount, maxCount);
+ }),
+ counts: Ember.computed.mapBy('geostats', 'count'),
+ maxCount: Ember.computed.max('counts'),
+ minCount: Ember.computed.min('counts'),
area: null,
originalZoomLevel: null,
@@ -28,7 +37,6 @@
color: 'rgba(113,132,141,.2)',
- filter: Ember.inject.service(),
locationObserver: Ember.observer('filter.location', function () {
if (this.get('filter').get('location') === null) {
this.sendAction('setLocation', this.get('constants').GEONAMES['world']);
@@ -239,7 +247,11 @@
},
clickMapObject: function (event) {
- this.get('filter').setFilter('location', commonConstants.GEONAMES_BASE_URL + event.mapObject.id);
+ const changed = this.get('filter').setFilter('location', commonConstants.GEONAMES_BASE_URL + event.mapObject.id);
+ if(!changed) {
+ //force filter change
+ this.notifyPropertyChange('filter.location');
+ }
},
homeButtonClicked: function () {