Jump to content

Progress Bars - Fuzzy Math


in2tech

Recommended Posts

Alright I have multiple progress bars showing pilot and airline data. They all are based on 100%. What I need to know is how do I change the data to get the data to stay within the 100% range. For instance pilot flying online is not a problem because the chances of 100 pilots flying at one time is near impossible ( I wish). But adding schedules becomes a problem once they go over 100, they peg or actually go passed the 100%.

Here is the code I am using on the schedules:

<?php echo StatsData::TotalSchedules(); ?>

If I had 1,000 or 100,000 schedules what type of math do I need to stay within the 100% progress bar?

I hope I explained this well enough?

Thanks for your help!

Link to comment
Share on other sites

What exactly you want the progress bar to show?

In addition, for live pilots, you can divide the online pilots by total pilots and show a percentage of which out of all the pilots, how many are flying right now.

But the number of schedules you have has nothing to be shown in a progress bar, or in that case as a percentage. That's not a variable

Link to comment
Share on other sites

What exactly you want the progress bar to show?

In addition, for live pilots, you can divide the online pilots by total pilots and show a percentage of which out of all the pilots, how many are flying right now.

But the number of schedules you have has nothing to be shown in a progress bar, or in that case as a percentage. That's not a variable

I see what you are saying but I am using it as a percentage. For instance now say 100 schedules was my limit. If I have 50 schedules, I have 50% to my goal say. I know it's weird but this is the way I am using the percentage for schedules at this time. So if my goal was 1,000 schedules than 250 would give me 25% on my progress bar. Just wondering if I can do this? Surely there is a way to do this? Maybe goal is the wrong word.

And I do have progress bar options like the one you described too. Like percentage to next rank, etc....

I'd still like to know if it is possible to do with a 100% progress bar, but with numbers that are over 100?

Link to comment
Share on other sites

Simple math, If your goal is let's say 1000(given that its higher than the number of schedules you have),

"(<?php echo StatsData::TotalSchedules(); ?>/1000)*100%" the formula format depends on the framework you use for charts

That gives me an error NaN%. Something is wrong. But thanks for trying to help me work this out. Of course I don't actually have 1,000 schedules yet either.

This works with 100 schedules only:<?php echo StatsData::TotalSchedules(); ?> , so you should be close. Which is what I have been using from the beginning. So if I only have 5 schedules, I have 5% of 100 which is what I want but for higher numbers as my schedule count grows.

Link to comment
Share on other sites

Example:

10,000 unit goal

3,600 in database

Simple math to get percentage -> ((3600 / 10000) * 100) = 36

PHP

<?php echo ((StatsData::TotalSchedules() / 10000) * 100); ?>

That should give you a percentage between 0 and 100.

Appears to be working perfect. So as I add schedules I change the number (make it higher as they increase a lot) and it gives me exactly what I wanted. Hopefully I can apply this to other percentages I am try to do.

I have say 750 schedules I can change the number to 1,000 2,000 or whatever depending on the percentage I want.

Or when I add 64,237 at some point change the number to say 100,000 or whatever percentage I want.

Thanks so much,

SimPilot & Kishshey

I appreciate both of your help. I have other formulas coming, all based on the 100% scale :)

So I can do the same for pilot count, after they go over 100 pilots on the va? And others. More for the cool factor than anything else :)

<?php echo (StatsData::PilotCount() /500) * 100); ?> Number pilots percentage! 350/500=percentage of 100%

Would the above work if I had 350 pilots based on a 100% progress bar? And change the number 500 to whatever I need?

Yes, this works too after adding a ( bracket I missed in the code, right before StatsData. The one in BOLD below:

<?php echo ((StatsData::PilotCount() /500) * 100); ?>

And now I think I can get most of my progress bars working the way I want. Will report back if I get stuck again!

Like I said it more of a cool factor than anything!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...