diff --git a/ui/src/app/widget/lib/flot-widget.js b/ui/src/app/widget/lib/flot-widget.js index 981cdd1e5b..718da76e9d 100644 --- a/ui/src/app/widget/lib/flot-widget.js +++ b/ui/src/app/widget/lib/flot-widget.js @@ -238,23 +238,22 @@ export default class TbFlot { if (this.ticksFormatterFunction) { return this.ticksFormatterFunction(value); } - if (angular.isNumber(this.tickDecimals)) { - var factor = this.tickDecimals ? Math.pow(10, this.tickDecimals) : 1, - formatted = "" + Math.round(value * factor) / factor; - if (this.tickDecimals != null) { - var decimal = formatted.indexOf("."), - precision = decimal === -1 ? 0 : formatted.length - decimal - 1; - - if (precision < this.tickDecimals) { - value = (precision ? formatted : formatted + ".") + ("" + factor).substr(1, this.tickDecimals - precision); - } + + var factor = this.tickDecimals ? Math.pow(10, this.tickDecimals) : 1, + formatted = "" + Math.round(value * factor) / factor; + if (this.tickDecimals != null) { + var decimal = formatted.indexOf("."), + precision = decimal === -1 ? 0 : formatted.length - decimal - 1; + + if (precision < this.tickDecimals) { + formatted = (precision ? formatted : formatted + ".") + ("" + factor).substr(1, this.tickDecimals - precision); } } if (this.tickUnits) { - value = value + ' ' + this.tickUnits; + formatted += ' ' + this.tickUnits; } - - return value; + + return formatted; }; this.yaxis.tickFormatter = ctx.yAxisTickFormatter; @@ -1445,4 +1444,4 @@ export default class TbFlot { } } -/* eslint-enable angular/angularelement */ \ No newline at end of file +/* eslint-enable angular/angularelement */