Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See the Wiki for download

UV Gauge Issue

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

Post Reply
Herbaldew
Posts: 84
Joined: Sun 12 Mar 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

UV Gauge Issue

Post by Herbaldew » Sat 01 Jul 2017 6:45 pm

I thought I had noticed an irregularity with my UV gauge before posting about the solar wedge issue but couldn't remember the details ... it just happened again today so I will report it now.

I realize that I chose to change from the default bargraph to a dial gauge and may be the only one to do that, so if you don't want to fool with trying to come up with a fix I understand.

The problem is with the max reading - in this screenie, which was taken with the interface open when a UV reading over to happened, all is well:

Image

But once the page is closed and re-opened after the UV reading has dropped back below 10, this is what displays (I left the tooltip showing so the actual high is shown):

Image

User avatar
mcrossley
Posts: 5209
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: UV Gauge Issue

Post by mcrossley » Tue 04 Jul 2017 2:12 pm

Herb(?), it will be because you are not including today's maximum reading in the calculation for the gauge scale max. Post a link to your page to remind me and I'll take a look. I'm on a holiday break at the mo so my responses may not be very timely.

Herbaldew
Posts: 84
Joined: Sun 12 Mar 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: UV Gauge Issue

Post by Herbaldew » Tue 18 Jul 2017 3:03 pm

Can't post a link - I don't post a web page and am working with the interface.

I have done a lot of experimenting trying to figure this out using the rain rate and solar gauges as guides. The best I came up with was the UV gauge would work how I wanted until midnight, then the tick marks disappeared, the needle and high triangle pointed straight up and NaN was displayed - then it worked properly again when the first reading over 0 was observed in the morning :oops:

Again, I realize this is probably just me doing this so if you don't want to fool with it I understand. If you can give me more info on adding "today's maximum reading in the calculation for the gauge scale max" I would appreciate it.

Here is what I have done to change from a bargraph to dial gauge:

Code: Select all

Remove:  	params.gaugeType = steelseries.GaugeType.TYPE3; (which defaults it to TYPE4)

Add:  		params.maxMeasuredValueVisible = true;
		        params.thresholdVisible = false;

Change:		ssGauge = new steelseries.RadialBargraph('canvas_uv', params);      		
       To:		ssGauge = new steelseries.Radial('canvas_uv', params);

Add below:          *** function update() {
                                var tip, indx; ***

		        cache.maxMeasured = extractDecimal(data.UVTH);

Add above:	*** if (ddimgtooltip.showTips) { ***

		        ssGauge.setMaxMeasuredValue(cache.maxMeasured);
Herb

User avatar
mcrossley
Posts: 5209
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: UV Gauge Issue

Post by mcrossley » Tue 18 Jul 2017 3:52 pm

Try changing..

Code: Select all

                    if (cache.value > ssGauge.getMaxValue()) {
                        ssGauge.setMaxValue(nextHighest(cache.value, 2));
                    }
to

Code: Select all

                    cache.maxValue = Math.max(cache.value, cache.maxMeasured);
                    if (cache.maxValue > ssGauge.getMaxValue()) {
                        ssGauge.setMaxValue(nextHighest(cache.maxValue, 2));
                    }

Herbaldew
Posts: 84
Joined: Sun 12 Mar 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: UV Gauge Issue

Post by Herbaldew » Thu 20 Jul 2017 4:05 am

That works, thank you very much!

What makes the gauges that have rescaled during the day to revert back to their initial scale?

My solar, rain and rain rate all reset at midnight (I think the wind does this to but it didn't get a high enough gust to rescale yesterday) but my UV scale stays where it upscaled to until I refresh the page.

Herbaldew
Posts: 84
Joined: Sun 12 Mar 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: UV Gauge Issue

Post by Herbaldew » Sat 22 Jul 2017 2:16 pm

Trying to get my UV gauge to rescale to default at midnight like the rest of them do.

Thought I had figured it out ... added "ssGauge.setValue(0);" to the if statement you provided but no joy :cry:

Experimenting with this is hard due to only being able to test it once a day when midnight rolls around.

Any hints?

Thanks

User avatar
mcrossley
Posts: 5209
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: UV Gauge Issue

Post by mcrossley » Tue 25 Jul 2017 1:18 pm

Hmm, should be easy! :lol:

Code: Select all

Change...
                    cache.maxValue = Math.max(cache.value, cache.maxMeasured);
                    if (cache.maxValue > ssGauge.getMaxValue()) {
                        ssGauge.setMaxValue(nextHighest(cache.maxValue, 2));
                    }

to...
                    cache.maxValue = Math.max(cache.value, cache.maxMeasured);
                    cache.MaxValue = nextHighest(cache.maxValue, 2);
                    if (cache.maxValue !== ssGauge.getMaxValue()) {
                        ssGauge.setValue(0);
                        ssGauge.setMaxValue(cache.maxValue);
                    }
The additional .setValue(0) just resets the gauge so that the next value update animates it properly.

Herbaldew
Posts: 84
Joined: Sun 12 Mar 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: UV Gauge Issue

Post by Herbaldew » Tue 25 Jul 2017 2:18 pm

Now my needle is endlessly dropping to zero about every 3 seconds then climbing back up.

I had this happen with several of my attempts.

Herbaldew
Posts: 84
Joined: Sun 12 Mar 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: UV Gauge Issue

Post by Herbaldew » Tue 25 Jul 2017 2:59 pm

Hmm - can't edit that last post.

Could this be needed?

Code: Select all

gaugeGlobals.uvScaleDefMax


I have played with adding this because the solar irradiation gauge has a similar entry at the top of the script and this in its if statement:

Code: Select all

cache.maxValue = Math.max(cache.value, cache.currMaxValue, cache.maxToday, gaugeGlobals.solarGaugeScaleMax);

User avatar
mcrossley
Posts: 5209
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: UV Gauge Issue

Post by mcrossley » Tue 25 Jul 2017 3:05 pm

Yep, that would help!

Can't remember, but is your page visible to me? It's a lot easier to work with the actual code rather than making it up as I go along. :?

Herbaldew
Posts: 84
Joined: Sun 12 Mar 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: UV Gauge Issue

Post by Herbaldew » Tue 25 Jul 2017 3:41 pm

Success! I had played with "gaugeGlobals.uvScaleDefMax" before without luck but must have done something different this time because it worked :D

Thanks again.

Code: Select all

 cache.maxValue = Math.max(cache.value, cache.maxMeasured, gaugeGlobals.uvScaleDefMax);
          cache.maxValue = nextHighest(cache.maxValue, 2);
          if (cache.maxValue !== ssGauge.getMaxValue()) {
          ssGauge.setMaxValue(cache.maxValue);
                    }

Post Reply