diff --git a/lib/cartodb/models/dataview/histogram.js b/lib/cartodb/models/dataview/histogram.js index c2df2c5f..3e9868d9 100644 --- a/lib/cartodb/models/dataview/histogram.js +++ b/lib/cartodb/models/dataview/histogram.js @@ -584,7 +584,7 @@ module.exports = class Histogram extends BaseWidget { var buckets = []; var binsCount = this.getBinsCount(override); - var width = getWidth(override); + var width = this.getWidth(override); var binsStart = this.getBinStart(override); var nulls = 0; var infinities = 0; @@ -697,6 +697,17 @@ module.exports = class Histogram extends BaseWidget { getBinsCount (override) { return override.bins || 0; } + + getWidth (override) { + var width = 0; + var binsCount = override.bins; + + if (binsCount && Number.isFinite(override.start) && Number.isFinite(override.end)) { + width = (override.end - override.start) / binsCount; + } + + return width; + } }; var DATE_AGGREGATIONS = { @@ -710,16 +721,6 @@ var DATE_AGGREGATIONS = { 'year': true }; -function getWidth(override) { - var width = 0; - var binsCount = override.bins; - - if (binsCount && Number.isFinite(override.start) && Number.isFinite(override.end)) { - width = (override.end - override.start) / binsCount; - } - - return width; -} function parseOffset(offset, aggregation) { if (!offset) {