Thread: Drawing Simple Bar Charts (Stats Question)

  1. #1
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812

    Drawing Simple Bar Charts (Stats Question)

    Hi there,

    I'm writing a small program to draw bar and pie charts. I have a question regarding weights (or frequencies) of values.

    If I have the following data:

    Code:
    VAL   FREQ
    5       1
    2       1
    3       2*
    4       1
    Typically, what do I plot for the bar of the third value?

    Do I plot a single bar of height 6, or two bars of height 3?

    If I were two plot two separate bars, what would I plot if the frequency was a fractional number?

    Thanks
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > Do I plot a single bar of height 6, or two bars of height 3?

    I'd do 2 of height 3. Having one of height 6 doesn't make much sense

    > If I were two plot two separate bars, what would I plot if the frequency was a fractional number?

    I don't follow.

  3. #3
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    >I don't follow

    If the third value had a non-integer weight of 2.5, then I can't plot 2 and a half bars.

    Or does my question simply not make sense because no one would ever enter a non-integer weight? In which case, should I simply round to the nearest integer and stop worrying?
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

  4. #4
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    That's kinda what I meant. Seems it'd be difficult to have a non-integer weight. Even if you did, you could change the proportions so it does.

    IE

    Code:
    VAL   FREQ
    5       1
    2       1
    3       2.5
    4       1
    Code:
    VAL   FREQ
    5       2
    2       2
    3       5
    4       2
    I hate stats, though, so I don't know if this would cause more problems than it solved. You could also put some sort of a note on that, but that's really up to you.

  5. #5
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    >I hate stats

    They certainly make you think.

    I think I'll split non-unity weights into multiple bars, while rounding to the integer. Unless, of course, someone can suggest why plotting weighted values on the y-axis would be useful. At the moment, I agree that it doesn't seem to make any sense.

    Thenks for replyling Govtcheez. That helped!
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-20-2005, 11:41 PM
  2. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  3. simple question.
    By InvariantLoop in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2005, 12:15 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. A Simple Question
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 10-26-2001, 05:23 PM