Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Gauge do not update scale range

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

Post Reply
CrasHBoneS
Posts: 96
Joined: Fri 06 Jan 2012 10:49 am
Weather Station: PCE-FWS20
Operating System: Windows XP SP3
Location: Bellaria Igea Marina (RN)
Contact:

Gauge do not update scale range

Post by CrasHBoneS »

This is my web page with SS gauges
http://www.meteobellaria.it/stazione1/gaugesSS.php

"temp":"0.6" and is correctly displayed in the upper left gauge
"wchill":"0.6" and is correctly displayed in the upper middle gauge
also heat index is OK

the gauge displayed has 0 and 30 as lower and higher value

The strange thing happens is
"dew":"-3.7" but if I select dew point in the upper middle gauge, the gauge display 0.0
"apptemp":"-2.0" same thing as above

It seems that the gauge do not update the ranges
User avatar
mcrossley
Posts: 14384
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Gauge do not update scale range

Post by mcrossley »

A bug! :bash:

A cut'n'paste error at line 1450

Code: Select all

            while (_temp.lowScale < _temp.minValue) {
                _temp.minValue -= scaleStep;
                _temp.maxValue -= scaleStep;
            }
            while (_temp.highScale > _temp.maxValue) {
                _temp.maxValue += scaleStep;
                _temp.minValue += scaleStep;
            }
should be

Code: Select all

            while (_dew.lowScale < _dew.minValue) {
                _dew.minValue -= scaleStep;
                _dew.maxValue -= scaleStep;
            }
            while (_dew.highScale > _dew.maxValue) {
                _dew.maxValue += scaleStep;
                _dew.minValue += scaleStep;
            }
CrasHBoneS
Posts: 96
Joined: Fri 06 Jan 2012 10:49 am
Weather Station: PCE-FWS20
Operating System: Windows XP SP3
Location: Bellaria Igea Marina (RN)
Contact:

Re: Gauge do not update scale range

Post by CrasHBoneS »

Thank You very much!
CrasHBoneS
Posts: 96
Joined: Fri 06 Jan 2012 10:49 am
Weather Station: PCE-FWS20
Operating System: Windows XP SP3
Location: Bellaria Igea Marina (RN)
Contact:

Re: Gauge do not update scale range

Post by CrasHBoneS »

Something wrong again:

"temp":"-0.3"

but upper left gauge shows 0.0


"dew":"-7.5"
"apptemp":"-3.2"
"wchill":"-0.3"
"wetbulb":"-2.4"

but upper middle gauge show always 0.0

// default gauge ranges - before autoscaling
tempScaleDefMinC : 0,
tempScaleDefMaxC : 30,



EDIT

I did not change nothing and now everything is working right

Now scale is -10:+20, if in realtimegauges.txt I write "temp":"30" and I reload the web page the scale is the same [-10:+20,] and the gauge display 20.0

some cookie?
User avatar
mcrossley
Posts: 14384
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Gauge do not update scale range

Post by mcrossley »

OK, I tried to retain the same range on the gauge when it re-scales, however your range is set to 30°, your min temp is -7.9 which gets rounded down to -10°, your max temp is 20.1° which gets rounded up to 30, giving a required scale range of 40°

I'll change the code so that it initially tries to retain the scale but sliding the, but if that cannot be achieved, then expand the scale to accommodate the values.
Sample code for the dew gauge below...

Code: Select all

            //auto scale the ranges
            if (data.tempunit.indexOf('C') !== -1) {
                scaleStep = 10;
            } else {
                scaleStep = 20;
            }
            while (_dew.lowScale < _dew.minValue) {
                _dew.minValue -= scaleStep;
                if (_dew.highScale <= _dew.maxValue - scaleStep) {
                    _dew.maxValue -= scaleStep;
                }
            }
            while (_dew.highScale > _dew.maxValue) {
                _dew.maxValue += scaleStep;
                if (_dew.minValue >= _dew.minValue + scaleStep) {
                    _dew.minValue += scaleStep;
                }
            }

            if (_dew.minValue !== _gaugeDew.getMinValue() || _dew.maxValue !== _gaugeDew.getMaxValue()) {
                _gaugeDew.setMinValue(_dew.minValue);
                _gaugeDew.setMaxValue(_dew.maxValue);
                _gaugeDew.setValue(_dew.minValue);
            }
However, as you are not displaying the 'indoor' temperature (which is causing the large range), you may want to remove that from the range check.

Code: Select all

        //
        // getMinTemp() returns the lowest temperature today for gauge scaling
        //
        getMinTemp = function () {
            return Math.min(
                extractDecimal(data.tempTL),
                extractDecimal(data.dewpointTL),
                extractDecimal(data.apptempTL),
                extractDecimal(data.wchillTL),
//                extractDecimal(data.intemp)); Comment out/remove this line
        },

        //
        // getMaxTemp() returns the highest temperature today for gauge scaling
        //
        getMaxTemp = function () {
            return Math.max(
                extractDecimal(data.tempTH),
                extractDecimal(data.apptempTH),
                extractDecimal(data.heatindexTH),
                extractDecimal(data.humidex),
//                extractDecimal(data.intemp)); Comment out/remove this line
        },
User avatar
mcrossley
Posts: 14384
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Gauge do not update scale range

Post by mcrossley »

Actually, I've reworked this for the next release to work how I originally intended (and wrote in the readme), the indoor temperature scale range is handled independently of the other ranges - much more satisfactory. I have also added a config option to remove the 'indoor' temperature/humidity options from the page completely as many people do this anyway for security reasons.
CrasHBoneS
Posts: 96
Joined: Fri 06 Jan 2012 10:49 am
Weather Station: PCE-FWS20
Operating System: Windows XP SP3
Location: Bellaria Igea Marina (RN)
Contact:

Re: Gauge do not update scale range

Post by CrasHBoneS »

THANK YOU

updated the code for the dew gauge and the temp. ext gauge

removed the code You suggested but still not working

If I set 35 in "temp" the gauge scale upper limit is always 20
and so If for apptemp
CrasHBoneS
Posts: 96
Joined: Fri 06 Jan 2012 10:49 am
Weather Station: PCE-FWS20
Operating System: Windows XP SP3
Location: Bellaria Igea Marina (RN)
Contact:

Re: Gauge do not update scale range

Post by CrasHBoneS »

Test I made are not "realistic", because I have noticed that "area" of the gauge is made also with tempTH and in my test I did not modify this value
Post Reply