Multistate Bargraph
sonny
Posts: 208
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.
Thanks...Sonny
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.
Thanks...Sonny
0
Comments
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.
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.
Thanks...
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 ...
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.
Fred
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.