Browse Source

style: linting fixes

tags/1.2.4
Shivam Mishra 5 years ago
parent
commit
e03b5726e1
2 changed files with 3 additions and 3 deletions
  1. +2
    -2
      src/js/utils/draw-utils.js
  2. +1
    -1
      src/js/utils/draw.js

+ 2
- 2
src/js/utils/draw-utils.js View File

@@ -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];
} }

+ 1
- 1
src/js/utils/draw.js View File

@@ -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…
Cancel
Save