Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Progress bar with multiple levels

I have a simple problem but for the life of me i can't figure out the math involved. I will try my best to explain it and I hope you can help me. So, I need to plot a normalized value on a Progress Bar. This progress bar is divided in 3 "levels", the first one goes from 0% to 33%, the second one from 33% to 66% and the third one goes from 66% to 100%, and each one of these "levels" can have multiple dynamic number of sublevels.

For example: the first level (0 to 33) can have 3 sublevels (0 to 11, 11 to 22 and 22 to 33), the second one (33 to 66) can have 6 sublevels and the third one can have 10. So I must be able to move the progress bar depending on the level and sublevel.

The problem comes when I try to place the value in, for example, the third sublevel of the second level. I can't figure out the math involved in that.

I know that it would be much easier using multiple progress bars, but it's a requirement that must be done

like image 444
Araj Avatar asked Sep 15 '26 20:09

Araj


1 Answers

Suppose the major level L can be 0, 1, or 2, and the sub level S can range from 0 to M[L]. Then the value of the bar would be V = L/3 + S/(3 * M[L]). The maximum value of 1 would be achieved when L = 2 and S = M[2].

like image 113
JWWalker Avatar answered Sep 17 '26 09:09

JWWalker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!