Home AMX User Forum AMX Design Tools

Bargraph w/ Label

Does anyone know if there is a way to have a bargraph (level) with some text that moves with the on state? I draw a picture of what I want it to kind of look like.

Has this been discussed before?

Thanks,
Bar.jpg 24.9K

Comments

  • viningvining Posts: 4,368
    Sure, create 2 levels using the same level number for each level display. In the one you want the % to appear type $P% in the text field in both states and in the bargraph level just do it normally.
  • bcirrisibcirrisi Posts: 148
    That seems to give me the proper percentage, but doesn't move up/ or down with the level. It's staying at the middle of the level (50%) and just changing the %.
  • jjamesjjames Posts: 2,908
    vining wrote: »
    Sure, create 2 levels using the same level number for each level display. In the one you want the % to appear type $P% in the text field in both states and in the bargraph level just do it normally.

    I think he wants the percentages to move WITH the bargraph (always in the same position - either on top of the bar or inside it but on top.)

    I don't have a panel to try it so I could very well be wrong.
  • mpullinmpullin Posts: 949
    I don't think that's what he's asking, he wants the justification of the text to change based on what the bargraph value is, so that the location of the number appears to move up and down with the bar. I don't know if there is a way to do it short of moving the buttons via code whenever the levels are changed. If there were a way to do it in TPDesign4 I'm not sure what it is, and you probably would have found it already.

    edit: what jjames just posted is a lot simpler, use that instead.
  • jjamesjjames Posts: 2,908
    bcirrisi wrote: »
    That seems to give me the proper percentage, but doesn't move up/ or down with the level. It's staying at the middle of the level (50%) and just changing the %.

    You could always use the absolute text justification command in code.
    AMX PI wrote:
    "'^JSB-<variable text address range>,<button states range>,<new text alignment>'"
    Set bitmap/picture alignment using a numeric keypad layout for those buttons with a
    defined address range (1 = left - top, 5 = center - middle, 9 = right - bottom).
    The alignment of 0 is followed by ',<left>,<top>'.
    The left and top coordinates are relative to the upper left corner of the button.

    Syntax:

    SEND_COMMAND <DEV>,"'^JSB-<vt addr range>,<button states range>,<new text alignment>'"

    That command could be triggered by a LEVEL_EVENT.
  • bcirrisibcirrisi Posts: 148
    Great Idea, I'll give it a try now...
  • jjamesjjames Posts: 2,908
    bcirrisi wrote: »
    Great Idea, I'll give it a try now...

    Just thought of a small problem.

    Since percentages are typically at most 3 digits, you'll need to compensate the left alignment when switching to 1 or 2 or 3 digits.

    BTW - if it works, gimme your address and I'll send you a bill for my consultation fees. :D (j/k)
  • ColzieColzie Posts: 470
    mpullin wrote: »
    ...moving the buttons via code...

    Is this even possible? I remember a while back trying to move things around via code - without luck.

    If I remember correctly there is no way to re-position a button or even a popup page on the fly. If this is incorrect I'd love to know how it is done. I run across a lot of situations where this would be handy.
  • bcirrisibcirrisi Posts: 148
    Using the Absolute Justification, then changing the position through code worked.

    The real tricky part is that the level starts from 0 (at the bottom) and goes to 255 (at the top). The size of the level box was 180pixels and starts at 0 (at the top) and goes to 180 (at the bottom). So the code needed to scale the position from 255 to 180, then move it relatively from the top not the bottom.

    As far as your fee jjames, you mis-lead me, I needed the ^JST command not the ^JSB command. I already filed a complaint with the custom service for my money back. ;)

    Thanks for the help!
  • jjamesjjames Posts: 2,908
    bcirrisi wrote: »
    Using the Absolute Justification, then changing the position through code worked.

    The real tricky part is that the level starts from 0 (at the bottom) and goes to 255 (at the top). The size of the level box was 180pixels and starts at 0 (at the top) and goes to 180 (at the bottom). So the code needed to scale the position from 255 to 180, then move it relatively from the top not the bottom.

    As far as your fee jjames, you mis-lead me, I needed the ^JST command not the ^JSB command. I already filed a complaint with the custom service for my money back. ;)

    Thanks for the help!

    LMAO! Fair enough. :D

    Glad you got it working.
  • kbeattyAMXkbeattyAMX Posts: 358
    Why not just add a multistate bargraph with 100 states and the text position Tweened? Overlay this on a regular bargraph?
  • jjamesjjames Posts: 2,908
    kbeattyAMX wrote: »
    Why not just add a multistate bargraph with 100 states and the text position Tweened? Overlay this on a regular bargraph?

    That's a good idea too. I just prefer to manage things in code - much easier to change in my opinion, but that's just me.
  • TurnipTruckTurnipTruck Posts: 1,485
    If this bargraph changes regularly, do you really want all of those send commands going out? I would let the panel do the work.
  • jjamesjjames Posts: 2,908
    If this bargraph changes regularly, do you really want all of those send commands going out? I would let the panel do the work.

    Good point . . . I guess he's in line for a FULL refund. :D
  • yuriyuri Posts: 861
    did you get it to work? I would like to see it in action :)
  • bcirrisibcirrisi Posts: 148
    Here is a test file I put together. It has 24 levels that are randomly generated, then it takes the average of all the bar graphs and moves a precision bar graph to the average location. The Average text is positioned next to the Precision indicator and moves up and down with the level. It works great when the average is towards the middle, but when it goes towards the top and bottom it looks off a little.

    Even if your not interested in how it works, it's fun to keep hitting the test button!
  • DanielDaniel Posts: 9
    bcirrisi wrote: »
    Using the Absolute Justification, then changing the position through code worked.

    The real tricky part is that the level starts from 0 (at the bottom) and goes to 255 (at the top). The size of the level box was 180pixels and starts at 0 (at the top) and goes to 180 (at the bottom). So the code needed to scale the position from 255 to 180, then move it relatively from the top not the bottom.

    As far as your fee jjames, you mis-lead me, I needed the ^JST command not the ^JSB command. I already filed a complaint with the custom service for my money back. ;)

    Thanks for the help!

    You can change the min and max values of the bargraph in the panel file (programming tab range high and low), or use the ^GLH and ^GLL commands to set them in code (give your bargraph a variable text address)
Sign In or Register to comment.