From 1cf0a3f80a94dd5c4fc24ee516725455d0623cb8 Mon Sep 17 00:00:00 2001 From: Teofilo Sibileau Date: Mon, 26 May 2014 19:32:39 -0300 Subject: [PATCH] whitehouse/choropleth:#2: Add an option to set the desired behaviour whan a search returns multiple rows --- static/recline.view.ChoroplethMap.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/static/recline.view.ChoroplethMap.js b/static/recline.view.ChoroplethMap.js index bef7dd4..5aec55e 100644 --- a/static/recline.view.ChoroplethMap.js +++ b/static/recline.view.ChoroplethMap.js @@ -36,6 +36,9 @@ this.recline.View = this.recline.View || {}; // Property to hold Geographic bounds (if given). this.bounds = options.bounds ? options.bounds : null; + // Property to set how to handle multiple row instances. + this.avg = options.avg ? options.avg : true; + // Breakpoints and color scale. this.breakpoints = options.breakpoints ? options.breakpoints : []; this.breakpoints = this.breakpoints.length > 0 ? this._validateBreakpoints(this.breakpoints) : []; @@ -397,7 +400,9 @@ this.recline.View = this.recline.View || {}; n++; } }); + if (n) { + n = self.avg ? n : 1; d = sum/n; }