Skip to content

Commit 589c91f

Browse files
committed
Corrected percentcalc for when logscale is true and minimum is 0
1 parent 2a06153 commit 589c91f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ui/widgets/Tank/tank.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ export const TankComponent = (
5757
}
5858
const numValue = value?.getDoubleValue() ?? 0;
5959
const percentCalc = logScale
60-
? ((Math.log10(numValue) - Math.log10(minimum)) * 100) /
61-
(Math.log10(maximum) - Math.log10(minimum))
60+
? minimum === 0
61+
? (Math.log10(numValue) * 100) / Math.log10(maximum)
62+
: ((Math.log10(numValue) - Math.log10(minimum)) * 100) /
63+
(Math.log10(maximum) - Math.log10(minimum))
6264
: ((numValue - minimum) * 100) / (maximum - minimum);
6365

6466
const percent =

0 commit comments

Comments
 (0)