Home AMX User Forum AMX Control Products

Multistate Bargraph

Sorry for this basic question...but what exactly is a multistate bargraph. Logically, I would think I could set ranges for each state, for example if the bargraph had a range of 0-100 then 0-10 could be State 1, 11-25 State 2, 25-100 State 3. Can't find any programming commands to change button state, set state levels, etc.

I have searched the world over for a basic description and can't find one. Since my example above doesn't appear possible I concluded that the state ranges for each range is range divided by number of states. So to get the granularity above I would create 20 states and set the colors accordingly. So now I try to find the background color (i.e. off portion of a standard bargraph) and can't find that. So basically I have a multi colored button given there is no "empty" portion of the bargraph from current level up to max level.

I'm sure like most things, this is simple, but (now to hijack my own thread) the AMX documentation is pretty pathetic. There are no functional descriptions/examples of anything, just "how to configure" instructions.



  • Options

    A multistate bargraph is a set of states (anywhere from 2-256) that can use a level to control it. If you look at the example image I attached I wil explain how this would work. The multistate Bargraph will need a level to be tied to, but not only that it will need a range defined for this bargraph. Since the UI doesn't dictate the size of the level it must declare what portion of the range it will display, this is what the rangeLow and rangeHigh values are for. Lets say you want to tie this simple MSB (multistate bargraph) to a volume box level to display the current volume. The vol box level is a value from 0 to 256, so you would set the rangeLow of the bargraph to 0 and the rangeHigh to 256. The touchpanel will then select the correct state to display based on the current value of the level. For example if the volume is currently at 190 then state 8 will be displayed ( (190/256)*11 = 8.16 ). Multistate bargraphs are mostly used with image sequences, but can be used for other things like custom error messages/dialogs where you would only set a level to a set value and the MSB will track it. I hope this helps, if you need more assistance I can email you a TPD4 file with examples and talk you through it.
  • Options
    DHawthorneDHawthorne Posts: 4,584
    It's not exactly intuitive, but one of the best uses for multi-state bargraphs is buttons showing a condition - kind of like expaninding the on/off channel paradigm. For example, I have a thermostat module that has a single button showing the relay condition of the HVAC zone. It's a 3-state bargraph (the button): one state is blank and totally transparent, another has a snowflake, and the third a little flame. When the zone is idle, I send a level of 1 to turn the button off; when ithe AC is running, I send a level of two, and when the heat is running, 3. In the button properties I have said it's a three-state bargraph with a minimum value of 1 and maximum value of 3.

    You can do this with many, many different states. I have a weather station module that uses this to show wind direction on a pointer, as anohter example, and I send the wind direction as a level. You could have one button reflecting what source a system is using, or you could have various light bulb icons reflecting a dimmer. Don't think of it as just a standard bargraph.
  • Options
    sonnysonny Posts: 208
    Thanks for the help....so basically calling this thing a bargraph is a misnomer. It's really a multi-state general button with a built in level function so that the program doesn't have to set the state from the netlinx program, just send level commands. What I want to do is have a bargraph change colors based on current value, but I want it to be a basic bargraph, not an image switcher.

  • Options
    jeffacojeffaco Posts: 121
    What I want to do is have a bargraph change colors based on current value, but I want it to be a basic bargraph, not an image switcher.
    If I understand TPDesign4 correctly, and I understand this feature correctly, won't you get what you want with this feature?

    A multistate button allows you to set color information independently, for each state. So I'd assume that a multistate bargraph gives you the same capability. The fact that it switches images is just because each state defines a bitmap; you need not do that.

    So couldn't you just have no bitmap image, but instead define the colors you want in each state, and end up with your desired result?

    -- Jeff

    P.S. By the way, you could get what you want anyway by assigning a vartext address to the bargraph, then having the master do a SEND_COMMAND to the panel to change the colors of the bargraph. But we're talking about an AUTOMATIC way to do this, without the extra SEND_COMMAND ...
  • Options
    frthomasfrthomas Posts: 176

    I see your idea but that gives you a button which is red/green/blue/yellow for levels 1/2/3/4, for example.

    What Sonny wants is a bargraph which has a scale of 4 and which, when value is 2, is half empty (or half full). This is easy to do as well.

    But having the same bargraph be green AND half full (of green) at level 2 and completely yellow and full (of yellow) at 4 is not possible it seems (automatically). You can have the color OR the bargraph, but not both.

    Now I never used TPD4 so don't quote me, I'm just trying to explain my understanding of what Sonny wants to achieve. In any case Jeff is right and through the vartext from the master you can do what you want with the colors.

  • Options
    You are very correct you can't have both with a single bargraph, however if we combine the forces of the traditional bargraph and the multistate bargraph we can achieve the desired effect. If you load my bargraphExamplet.tp4 you can see the results.

    The bargraph is on top of the multistate bargraph, they are exactly the same size and have the same level port, level code, range low and range high. The bargraph has its off state fill color set to fully transparent, and the on state fill color to 50% transparent. The multistate bargraph has 4 states, states 1 and 2 are green, state 3 is yellow and state 4 is red. This results in the bargraph displaying green when the level value is between 0-128, yellow from 129-192, and red from 192-255. This is one of the greay advantages of having G4 being a 32 bit application you can do very clever/complex things by just layering the buttons. I added the slider and the percentage display just for appearances but they are not necessary.

    I hope this solves the issue, if not please let me know exactly what it is you are trying to do and perhaps we come up with another solution.
Sign In or Register to comment.