Jump to content

Donut Chart Mod - removing decimal places


Rachela Veczko

Recommended Posts

  • 1 year later...
  • 2 months later...
  • 1 year later...

Hello, I have added this as a Github issue as well.

 @Tyler Kendle in the source code you will want to look for a file called donutState.js and specifically this line of code (114):

let absPercentage = Math.abs(percentage).toFixed(1);

To change this so that it rounds to a whole percentage you need to set the parameter in toFixed() to 0 like this:

let absPercentage = Math.abs(percentage).toFixed(0);

Ideally this should probably be a configuration option for a strategic solution. You will then have to rebuild and re-sign the mod, of course. 

(In case somebody is looking for for more than 1 decimal, this is going to need some other code changes because the percentage calculation is also being rounded for some reason. That will need fixing as well beyond making toFixed() parameter greater than 1). 

Thanks,
Glenn

Link to comment
Share on other sites

9 hours ago, Glenn Hoskins said:

Hello, I have added this as a Github issue as well.

 @Tyler Kendle in the source code you will want to look for a file called donutState.js and specifically this line of code (114):

let absPercentage = Math.abs(percentage).toFixed(1);

To change this so that it rounds to a whole percentage you need to set the parameter in toFixed() to 0 like this:

let absPercentage = Math.abs(percentage).toFixed(0);

Ideally this should probably be a configuration option for a strategic solution. You will then have to rebuild and re-sign the mod, of course. 

(In case somebody is looking for for more than 1 decimal, this is going to need some other code changes because the percentage calculation is also being rounded for some reason. That will need fixing as well beyond making toFixed() parameter greater than 1). 

Thanks,
Glenn

Thank you so much @Glenn Hoskins.  I appreciate your help with this.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...