Page 1 of 1

UV Gauge Issue

Posted: Sat Jul 01, 2017 6:45 pm
by Herbaldew
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

Re: UV Gauge Issue

Posted: Tue Jul 04, 2017 2:12 pm
by mcrossley
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.

Re: UV Gauge Issue

Posted: Tue Jul 18, 2017 3:03 pm
by Herbaldew
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

Re: UV Gauge Issue

Posted: Tue Jul 18, 2017 3:52 pm
by mcrossley
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));
                    }

Re: UV Gauge Issue

Posted: Thu Jul 20, 2017 4:05 am
by Herbaldew
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.

Re: UV Gauge Issue

Posted: Sat Jul 22, 2017 2:16 pm
by Herbaldew
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

Re: UV Gauge Issue

Posted: Tue Jul 25, 2017 1:18 pm
by mcrossley
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.

Re: UV Gauge Issue

Posted: Tue Jul 25, 2017 2:18 pm
by Herbaldew
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.

Re: UV Gauge Issue

Posted: Tue Jul 25, 2017 2:59 pm
by Herbaldew
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);

Re: UV Gauge Issue

Posted: Tue Jul 25, 2017 3:05 pm
by mcrossley
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. :?

Re: UV Gauge Issue

Posted: Tue Jul 25, 2017 3:41 pm
by Herbaldew
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);
                    }