How to do multicolor bar gauge

This forum contains common answers to questions and tutorials produced for the community.
jpurdum
Enovation Controls Development
Enovation Controls Development
Posts: 153
Joined: Mon Jun 21, 2010 11:19 am

How to do multicolor bar gauge

Post by jpurdum » Thu Dec 09, 2010 8:35 am

From a customer:
I want to have a bar graph to monitor battery level but have the colour change when the battery goes below 50%.

We have tried doing it using different page views showing the different colour gauges and also the hide function in the screen app without joy.
Any ideas?
boyce
Enovation Controls Development
Enovation Controls Development
Posts: 322
Joined: Wed Sep 08, 2010 5:09 pm

Re: How to do multicolor bar gauge

Post by boyce » Thu Dec 09, 2010 9:29 am

Here is a sample configuration that changes views based on the value of the Battery Potential Voltage. There is one state machine that checks if the voltage is below 10 V and switches views.
Attachments
Multicolor Bar Gauge.zip
Multicolor Bar Gauge
(2.58 MiB) Downloaded 76 times
mbowdich
Posts: 209
Joined: Tue Oct 05, 2010 10:54 am

Re: How to do multicolor bar gauge

Post by mbowdich » Sat Dec 11, 2010 8:46 pm

John,

Since I cannot attach files (I get a not allowed message), I have emailed you a .db3 file with one solution (using hide and show). We are using this same type of routine to keep text gauges centered below rotary gauges as the transition through 10, 100, 1000, etc., until a patch is released allowing center justification of text gauges.

Basically, a state machine checks for the value of battery voltage on a recurring timer (could also be fired from a change in battery voltage variable). This causes a 3 state state machine to change states, hiding one gauge and showing the other. It then returns to its initial state and waits to do it all over again.

It could also be easily revised to stay in the >50 or <50 states to prevent contious process in of the hide / show events.
jpurdum
Enovation Controls Development
Enovation Controls Development
Posts: 153
Joined: Mon Jun 21, 2010 11:19 am

Re: How to do multicolor bar gauge

Post by jpurdum » Tue Dec 14, 2010 11:38 am

Ok - I think I have the upload problem fixed - for .db3 file extension. We evidently have to add each type we want uploadable.

In fact, I'm uploading your file using your permission set, so if the file is there, it should be fixed and anyone in the "Users on Account" group (where most people are) will be able to upload .db3 files now.
Attachments
Bar Graph Color Change.db3
(5.52 MiB) Downloaded 33 times
cash
Posts: 6
Joined: Mon Oct 11, 2010 10:22 am

Re: How to do multicolor bar gauge

Post by cash » Thu Feb 17, 2011 10:27 am

I just wanted to comment on a simpler, less complicated method of having two colors on a bar gauge. The bar guage does not entirely change out colors, but you can have the warning area when the voltage goes below 50%.
To do this you can place a second bar guage over the top of your first bar gauge. Copy you initial bar guage and paste it back into your page design. Set your positions the same as your initial bar guage and then adjust the width (horizontal gauge) or height (vertical gauge) for the 2nd, overlying bar gauge so that its maximum point is at 50% of your first guage. Then set your maximum guage reading parameter to 50% for the voltage reading. Next, change your background color of the 2nd, overlaying bar guage to the color you want. Set the alpha of your your background color to less than 255 to make the background transparent so that you can see the 1st, underlying bar guage under it or set it to 0 to hide it. You can set the bar color for the 2nd, overlying bar guage to a different color for warnings, etc.
This method will allow the two gauges to work in tandem together and show when the reading passes above or below your warning level.
Onr thing to remember is just make sure that your 2nd gauge is in front of your original for it to show up.