Skip to content

Commit

Permalink
fix(grid-cell): resolve floating point precision issue (#1839)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeshaa-m authored May 17, 2023
1 parent 77c7fea commit 68c69f6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ export const GraphCell: Cell = {
const { style = 'progress', min = 0, max = 100 } = field;

// Convert content to 0>100 range for progress bar
const progress = ((content - min) / (max - min)) * 100;
const progress = parseFloat(
(((content - min) / (max - min)) * 100).toPrecision(
String(content).replace('.', '').length
)
);

switch (style) {
case 'bar':
Expand Down

0 comments on commit 68c69f6

Please sign in to comment.