Move getWidth function to a class method
This commit is contained in:
parent
e84f30488f
commit
9e3e1cad9a
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user