style: linting fixes
This commit is contained in:
parent
6203422d3b
commit
e03b5726e1
@ -48,8 +48,8 @@ export function shortenLargeNumber(label) {
|
|||||||
let p = Math.floor(Math.log10(Math.abs(number)));
|
let p = Math.floor(Math.log10(Math.abs(number)));
|
||||||
if (p <= 2) return number; // Return as is for a 3 digit number of less
|
if (p <= 2) return number; // Return as is for a 3 digit number of less
|
||||||
let l = Math.floor(p / 3);
|
let l = Math.floor(p / 3);
|
||||||
let shortened = (Math.pow(10, p - l * 3) * +(number / Math.pow(10, p)).toFixed(1))
|
let shortened = (Math.pow(10, p - l * 3) * +(number / Math.pow(10, p)).toFixed(1));
|
||||||
|
|
||||||
// Correct for floating point error upto 2 decimal places
|
// Correct for floating point error upto 2 decimal places
|
||||||
return Math.round(shortened*100)/100 + ' ' + ['', 'K', 'M', 'B', 'T'][l];;
|
return Math.round(shortened*100)/100 + ' ' + ['', 'K', 'M', 'B', 'T'][l];
|
||||||
}
|
}
|
||||||
@ -319,7 +319,7 @@ function makeVertLine(x, label, y1, y2, options={}) {
|
|||||||
function makeHoriLine(y, label, x1, x2, options={}) {
|
function makeHoriLine(y, label, x1, x2, options={}) {
|
||||||
if(!options.stroke) options.stroke = BASE_LINE_COLOR;
|
if(!options.stroke) options.stroke = BASE_LINE_COLOR;
|
||||||
if(!options.lineType) options.lineType = '';
|
if(!options.lineType) options.lineType = '';
|
||||||
if (options.shortenNumbers) label = shortenLargeNumber(label)
|
if (options.shortenNumbers) label = shortenLargeNumber(label);
|
||||||
|
|
||||||
let className = 'line-horizontal ' + options.className +
|
let className = 'line-horizontal ' + options.className +
|
||||||
(options.lineType === "dashed" ? "dashed": "");
|
(options.lineType === "dashed" ? "dashed": "");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user