Skip to content

Commit

Permalink
fix: change round method
Browse files Browse the repository at this point in the history
  • Loading branch information
MAudelGisaia committed Apr 12, 2024
1 parent 2412ac3 commit 945e1df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/donuts/utils/DonutUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ export class DonutUtils {
color: DonutUtils.getNodeColor(n, donutNodeColorizer, keysToColors, colorsSaturationWeight)
};
if (n.parent) {
tooltipContent.percentage = Math.round(n.data.size / n.parent.data.size * 100).toFixed(2);
const num = (n.data.size / n.parent.data.size * 100);
tooltipContent.percentage = (Math.round(num * 100) / 100).toString();
}
tooltipArray.push(tooltipContent);
if (n.parent && n.parent.parent) {
Expand All @@ -164,7 +165,8 @@ export class DonutUtils {
color: DonutUtils.getNodeColor(n, donutNodeColorizer, keysToColors, colorsSaturationWeight)
};
if (n.parent) {
tc.percentage = Math.round(n.data.size / n.parent.data.size * 100).toFixed(2);
const num = (n.data.size / n.parent.data.size * 100);
tc.percentage = (Math.round(num * 100) / 100).toString();
}
tooltipArray.push(tc);
}
Expand Down

0 comments on commit 945e1df

Please sign in to comment.