Results 1 to 11 of 11

Thread: Need help with a little bit of functionality.

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Question Need help with a little bit of functionality.

    For the last week I have been messying around with some simple graphing code, the link is in my sig.
    The graph can plot many datasets. A dataset is just a collection of values. This means that you can plot numerous graphs on the same graph. Does that make sense.

    This isn't just a simple graphing tool. it can be used to 100% replicated the graphic equalizer music thingy from media player and the moving graphs that you see in task manager.

    Anyways. If you download the zip and run Test.vpg and click the Music button you will see the media player demo.

    Notice how the little blue "caps", I call them caps as I don't know what they are really called, are still visible when their value is 0.
    This looks silly. I can change this by setting the value < 0 so it appears off the graph, and therefore doesn't get drawn. Another method would to have these points as the 1st dataset, and the green bars would then paint over these "caps".
    I don't like either method. Anyone got any suggestions?

    How about setting an upper and lower limit, bit like in stats, and any values outside these limits don't get drawn?
    Or having a visible property on a Point object?

    The next thing is slightly releated. If I am displaying 2 datasets that both show bars then how should I draw these? The largest bar at the back and smallest at the front? On top of each other? How? This I really don't have a clue about at this moment in time, although it's not 100% important, unlike my 1st problem.

    Any other suggestions would be greatful.

    Woof

    PS U need to have VB6 to run this directly. If you don't then you have to manually edit the class files for it to run in VB5.
    Attached Files Attached Files

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    caps = peaks

    maybe different colors for bar datasets? offset by half the distance of the bar itself?

    cool coding.
    Last edited by dglienna; Aug 20th, 2004 at 05:33 PM.

  3. #3

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Peaks! Nice one

    Will change my app from caps to peaks.

    Each dataset can already have its own line, peak, point and bar color.
    Or do you mean each point can have it's own individual colors?

    Offset by what? You lost me there. Sorry.

    Cheers for the reply.

    Woof

  4. #4
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    Woka:

    Don't mean to speak for dglienna, but what I believe he means
    is that if you have:

    bar -- 5 pixels -- bar -- 5 pixels -- bar ---> etc.

    That is you need to offset the next dataset being plotted
    so that:

    bar(dataset1) - 2 pixels - bar(dataset2) - 2 pixels - bar(dataset1) - 2 pixels ---> etc.

    Hope this helps.

    David

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    for bar charts, I was thinking more like
    bar(dataset1) - 2 pixels - bar(dataset2) - 7 pixels - bar(dataset1) - 2 pixels - bar(dataset2) - 7 pixels --> etc.

    with the bar(dataset2) being a different color than ds1

  6. #6
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Hey, Woka.. I am trying to use your control...

    I have an array of doubles that looks like this:

    XUnMedio(10) = 0.0009765625
    XUnMedio(11) = 0.001953125
    XUnMedio(12) = 0.00390625
    XUnMedio(13) = 0.0078125
    XUnMedio(14) = 0.015625
    XUnMedio(15) = 0.03125
    XUnMedio(16) = 0.0625
    XUnMedio(17) = 0.125
    XUnMedio(18) = 0.25
    XUnMedio(19) = 0.5
    XUnMedio(20) = 0.75

    So, I want a graph that shows those values in the position of the array. I would like to know if it is possible to add numbers to your axis and if so, how? And how would I get all the data?

    I can see you use a dataset you created but I would like to see an example with the labels... Could you please help me?

    Thanks in advance.
    Last edited by Tec-Nico; Nov 2nd, 2004 at 09:23 PM.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  7. #7
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    I thought the intended effect was for the peaks to bounce on the bars. They fall when the bar falls, and are pushed upwards when the bar rises.

    If lngValue >= lngCap Then lngCap = lngValue

    instead of

    If lngValue >= lngCap Then lngCap = 0

    or your plan of

    If lngValue >= lngCap Then lngCap = -1

    By definition, it is a peak, so it should be at the top of the bar or above it.
    Last edited by leinad31; Nov 2nd, 2004 at 10:27 PM.

  8. #8
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Thanks for replying leinad31... This is what I want...
    (I mean, not to this degree... But I am after something similar)

    Attached Images Attached Images  
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  9. #9
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    Tec, I think you should wait for woka's reply regarding the axis labels.

  10. #10
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Thanks, leinad31.

    I have been trying with MSChart but this is the best I got...


    Attached Images Attached Images  
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  11. #11
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Need help with a little bit of functionality.

    Originally posted by Wokawidget
    The next thing is slightly releated. If I am displaying 2 datasets that both show bars then how should I draw these? The largest bar at the back and smallest at the front? On top of each other? How? This I really don't have a clue about at this moment in time, although it's not 100% important, unlike my 1st problem.

    Any other suggestions would be greatful.

    Woof
    You need to have the same baseline if your comparing both bars so stacking them is not a good idea in that case. Stacking is applicable if your graphing say the number of students in a class, bar 1 for boys bar 2 for girls, so you'll see the gender composition of each class bar aside from seeing which sections have few students.

    For the case with the same baseline, a 2D graph is not advisable. You won't be able to distinguish between case of one bar being zero and another case wherein both bars are equal. You need a 3D graph for that.
    Last edited by leinad31; Nov 3rd, 2004 at 02:23 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width