Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6985991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:45:07+00:00 2026-05-27T18:45:07+00:00

I have a need to create a graph, where the scale of the Y-axis

  • 0

I have a need to create a graph, where the scale of the Y-axis changes depending on the data input into the system. Conceivably this scale could be anywhere from 0-10, 0-100, or even have bottom limit of thousands and an upper limit of millions.

To properly determinethe scale of this axis, I need to work out the ratio of Points to Pixels (based on graph height/range).
Now a graphs’ axis never start at the lowest value and go to the highest, usual practice is to go to the next nearest 2, 5 or 10 (above for upper limit, and below for lower) depending on the range of values.

So what I’d like to know is how to take the max value from the data set, and round it up to the nearest 10.
for clarification, the input values will always be integers.

what i have now is this

        if ((rangeMax < 10) && (rangeMax > 5))
            rangeMax = 10;
        else if (rangeMax < 5)
            rangeMax = 5;

Which is only useful for values less than 10, and doesn’t allow the flexibility required to be truly dynamic. Ultimately this graph will be auto-generated during a page load event, with no user input.

I’ve read around a bit, and people talk about things like the modulus operator (%), but I can’t find any reliable information about it’s use, and talk of Math.Ceiling and Math.Round, but these go to the next nearest whole number, which isn’t quite there, and don’t seem to help much at all when dealing with integers anyway.
Any suggestions, pointers or help greatly appreciated.

i did find a similar question asked here How can i get the next highest multiple of 5 or 10 but i don’t know java, so i can’t understand any of what was said.

Cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:45:08+00:00Added an answer on May 27, 2026 at 6:45 pm
    if(rangeMax % 10 !=0)
       rangeMax = (rangeMax - rangeMax % 10) + 10;
    

    You could also use Math.Round() with MidpointRounding.AwayFromZero using a decimal number (otherwise integer division will truncate fractions):

    decimal number = 55M;
    decimal nextHighest = Math.Round(number/ 10, MidpointRounding.AwayFromZero) * 10;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a graph that have the following properties: The X Axis
I have two objects I need to create a relationship between in Core Data.
I need to create a graph as shown in the image below. I have
Looking into how to create a notification system like facebook. I have a few
Hi I have a need to create a Ternary Plot graph from 3 different
I have a need to create a HttpSession (via cookie) whenever a client invokes
I have a need to create a small pop up information box when a
I have a need to create a wrapper for a DLL, loading and unloading
I have a need to create a library of Object Oriented PHP code that
I have the need to create Sharepoint blog comments by code: SPSecurity.RunWithElevatedPrivileges(delegate() { sw.AllowUnsafeUpdates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.