Page 1 of 1

Default Gauge Scale

Posted: Tue Jan 24, 2017 10:36 am
by Phil23
Hi all,

I've looked at the code a few times, but not sure where to start.

Would like my gauges to default to a range of 0-40°C instead of -10 as the starting point.

We do see -5 t0 -10 in Winter, so would need to auto rescale then, but can anyone give me a rough idea of which lines will let me set 0°C as the default gauge minimum.

Thanks

Phil.

Re: Default Gauge Scale

Posted: Tue Jan 24, 2017 1:21 pm
by mcrossley
Phil, is this on the MX interface, or the web page?

Re: Default Gauge Scale

Posted: Tue Jan 24, 2017 1:23 pm
by mcrossley
For MX, ..../CumlusMX/interface/lib/steelseries/scripts/gauges.js

Line 106+

Re: Default Gauge Scale

Posted: Tue Jan 24, 2017 8:55 pm
by Phil23
mcrossley wrote:Phil, is this on the MX interface, or the web page?


Thanks Mark,

Primarily the web page, and that's around where I looked.

Code: Select all

            // default gauge ranges - before auto-scaling/ranging
            tempScaleDefMinC       : -20,
            tempScaleDefMaxC       : 40,


Probably got confused a little by the fact that -20 was specified, yet my gauge showed -10.

Interesting though that both web & interface code contains -20 as default,
yet the web page gauge is starting at -10 & the interface at -20.
If I've explained it so it makes sense.

Or maybe I'm confused cause I may have previously edited the file.

Phil

Re: Default Gauge Scale

Posted: Tue Jan 24, 2017 9:13 pm
by mcrossley
I can't check as I'm not at home at the moment, but I suspect it may be a "niceScale" thing that is altering the scale to a range of 50. The gauges on my web page go from -20 to 40 though. :? :roll:

A link to your page?...

Re: Default Gauge Scale

Posted: Wed Jan 25, 2017 9:18 am
by Phil23
Thanks Mark,

I have managed to get it to scale from 0 to 40 by changing "tempScaleDefMaxC" on line 107 of gauges.js

Noticed later though that the gauge had rescaled it's self to 0-50.

Presume that was done by what's down around line 829.

Code: Select all

                    //auto scale the ranges
                    scaleStep = data.tempunit[1] === 'C' ? 5 : 20;
                    while (cache.lowScale < cache.minValue) {
                        cache.minValue -= scaleStep;
                        if (cache.highScale <= cache.maxValue - scaleStep) {
                            cache.maxValue -= scaleStep;
                        }
                    }
                    while (cache.highScale > cache.maxValue) {
                        cache.maxValue += scaleStep;
                        if (cache.minValue >= cache.minValue + scaleStep) {
                            cache.minValue += scaleStep;
                        }
                    }

                    if (cache.minValue !== ssGauge.getMinValue() || cache.maxValue !== ssGauge.getMaxValue()) {
                        ssGauge.setMinValue(cache.minValue);
                        ssGauge.setMaxValue(cache.maxValue);
                        ssGauge.setValue(cache.minValue);
                    }
                    if (cache.selected === 'out') {
                        cache.areas = [steelseries.Section(+cache.low, +cache.high, gaugeGlobals.minMaxArea)];
                    } else {
                        cache.areas = [];
                    }


Not at all a Java programmer, but am assuming that the rescaling is based on the maximum temp & it may have happened once we hit 30 today.
Presume also that it stays scaled that way for the rest of the day.

Changed the value here from 10 to 5, but think it's still observing todays maximum & rescaling the 40 up to 45.

Code: Select all

scaleStep = data.tempunit[1] === 'C' ? 5 : 20;


My site is in my signature.

Cheers

Phil.

Re: Default Gauge Scale

Posted: Wed Jan 25, 2017 12:28 pm
by mcrossley
It should only re-scale when the current value exceeds the current scale limits, so hitting 30 shouldn't have done that.

I'd need to examine what the code on your site is doing - maybe I'll have time this evening. Meantime - are you running the latest version of the gauges script?

Re: Default Gauge Scale

Posted: Thu Jan 26, 2017 1:03 am
by Phil23
Still on Cumulus 3041 & "Scripts by Mark Crossley - version 2.5.5"

Got a little lost on how exactly to upgrade the steel script stuff.

I did download it from Github a while back but was not sure how to proceed from there.

Phil.

Re: Default Gauge Scale

Posted: Thu Jan 26, 2017 3:42 am
by Phil23
mcrossley wrote:It should only re-scale when the current value exceeds the current scale limits, so hitting 30 shouldn't have done that.


Noticed the gauge returned to the 0-40 scale this morning, presuming at the 9:00am rollover.

Have since noticed it's rescaled to 0-45°C.
I did change the scaleStep to 5 yesterday.

Code: Select all

                    //auto scale the ranges
                    scaleStep = data.tempunit[1] === 'C' ? 5 : 20;


Phil.

Edit:-

Now it's scaled back to 0-40°C.
Bit lost on what's triggering it.

Re: Default Gauge Scale

Posted: Thu Jan 26, 2017 4:17 am
by Phil23
Also read this post,

http://sandaysoft.com/forum/viewtopic.php?t=14863

Don't think it's relevant. Not sure, as I'm seeing 0-45.

Re: Default Gauge Scale

Posted: Fri Jan 27, 2017 11:57 am
by mcrossley
OK, the scales of the "temperature" and "dew/apparent/.." gauges are linked, so they show the same range. If the Apparent temp goes over 40 then both gauges will rescale. During thr day your apparent temperature is quite a bit higher than your actual temperature I suspect?