I am designing my own EOS dashboard in which I want to show the respective account's resources CPU, NET and RAM
in Percentage as they are in the attached picture (from https://local.bloks.io/):
when I get account information, I am getting values max cpu_limit, used cpu_limit, available cpu_limit, max net_limit, used net_limit, available net_limit, ram_quota and ram_usage
. I tried to calculate percentage same for all using:
var cpuProgress = ((double)cpuUsed / cpuMax) * 100.0;
var cpuPercentage = cpuProgress.ToString("#0.##%", CultureInfo.InvariantCulture);
But I guess I am mistaken. Please help how to calculate these three resources in percentage?