diff --git a/lib/cartodb/models/dataview/histogram.js b/lib/cartodb/models/dataview/histogram.js index dbe8f014..0e6279b8 100644 --- a/lib/cartodb/models/dataview/histogram.js +++ b/lib/cartodb/models/dataview/histogram.js @@ -607,7 +607,7 @@ module.exports = class Histogram extends BaseWidget { if (Number.isFinite(timestampStart)) { aggregation = this.getAggregation(override); - offset = getOffset(override, this.offset); + offset = this.getOffset(override); } buckets = result.rows.map(function(row) { @@ -654,6 +654,17 @@ module.exports = class Histogram extends BaseWidget { getAggregation (override) { return override && override.aggregation ? override.aggregation : this.aggregation; } + + getOffset (override) { + if (override && override.offset) { + return override.offset; + } + if (this.offset) { + return this.offset; + } + + return 0; + } }; var DATE_AGGREGATIONS = { @@ -667,18 +678,6 @@ var DATE_AGGREGATIONS = { 'year': true }; - -function getOffset(override, offset) { - if (override && override.offset) { - return override.offset; - } - if (offset) { - return offset; - } - - return 0; -} - function getBinStart(override) { if (override.hasOwnProperty('start') && override.hasOwnProperty('end')) { return Math.min(override.start, override.end);