Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Calculation Problems

Calculation Problems

Scheduled Pinned Locked Moved C#
helpquestiondata-structurestutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gavin Roberts
    wrote on last edited by
    #1

    Hi all, I've been working on a Graph class for our web stats system and i'm having a few problems. After getting some help of a few guys/gals (not sure) from here, I solved many problems and then hit another one. I have currently got a class that generates an image of a graph which has X and Y Axis labels all correctly placed. Now my problem is, how can I display my values in a staticly sized image? My working space is 150hx650w. My X and Y Labels are all placed in the right place, and I need to calculate how tall I need to make my bars to reflect their value. So my values are now : 0,0,4,0,90,172,0 (graph shows stats for the last 7 days) At first I thought 150*value/100 would give me a percentage of the height, which I could simply draw but when I tried it against the 172, my return value was 258. Has anyone got any idea's on how to solve this. Maths was my strong subject at school, but i've forgotten most of it. Thanks everyone. Gav

    M 1 Reply Last reply
    0
    • G Gavin Roberts

      Hi all, I've been working on a Graph class for our web stats system and i'm having a few problems. After getting some help of a few guys/gals (not sure) from here, I solved many problems and then hit another one. I have currently got a class that generates an image of a graph which has X and Y Axis labels all correctly placed. Now my problem is, how can I display my values in a staticly sized image? My working space is 150hx650w. My X and Y Labels are all placed in the right place, and I need to calculate how tall I need to make my bars to reflect their value. So my values are now : 0,0,4,0,90,172,0 (graph shows stats for the last 7 days) At first I thought 150*value/100 would give me a percentage of the height, which I could simply draw but when I tried it against the 172, my return value was 258. Has anyone got any idea's on how to solve this. Maths was my strong subject at school, but i've forgotten most of it. Thanks everyone. Gav

      M Offline
      M Offline
      Marek Grzenkowicz
      wrote on last edited by
      #2

      bar = bar_max * value / value_max For example: bar = 150 * 172 / 172 = 150 bar = 150 * 90 / 172 = 78

      G 1 Reply Last reply
      0
      • M Marek Grzenkowicz

        bar = bar_max * value / value_max For example: bar = 150 * 172 / 172 = 150 bar = 150 * 90 / 172 = 78

        G Offline
        G Offline
        Gavin Roberts
        wrote on last edited by
        #3

        THANK YOU! I knew it would be simple, but I didn't think it was THAT simple.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups