Welcome to the Cumulus Support forum.

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

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.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

changing tempScaleDefMaxC causes erratic behaviour

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

Post Reply
UncleBuck
Posts: 43
Joined: Sat 29 Dec 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

changing tempScaleDefMaxC causes erratic behaviour

Post by UncleBuck »

I switched from Weathercat to CumulusMX in the last few days (since I replaced the Oregon with a Davis) and was installing the SS gauges.
When I changed the tempScaleDefMaxC from its default to be 50 the temp gauges pointers starting jumping back to 0 and then climbing up to the current temps.
If I change the setting to 45 then it returns to its expected behaviour of not moving unless the temp changes.

I can put up with the setting being at 45 as we have only had about two days in the last 3 years where it has exceeded the 45 here.
Just thought you would like to know about the unexpected weirdness.

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

Re: changing tempScaleDefMaxC causes erratic behaviour

Post by mcrossley »

Hi, could you post a link to the page and leave it with the odd behaviour for a while so I can take a look?

The gauges will automatically rescale if a reading exceeds the defaults in a given day.
UncleBuck
Posts: 43
Joined: Sat 29 Dec 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

Re: changing tempScaleDefMaxC causes erratic behaviour

Post by UncleBuck »

Hi Mark,
This is the page with the basic gauges on it.
http://www.pcweather.kcsolutions.com.au ... -basic.htm
The erratic behaviour only happens if viewing in Deg C, as I have not modified the defaults for Deg F.

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

Re: changing tempScaleDefMaxC causes erratic behaviour

Post by mcrossley »

OK, I see what the problem is.

The gauges by default are configured to have a 'niceScale', that means it takes your min and max scale values and rounds them numbers that create a more pleasing set of scale numbers. You can see the difference when I disable the niceScale on your temp gauge compared with the dew gauge here...
Untitled-1.png
The temp gauge ends up with a tick mark every 0.5 degree and every 2.5 degrees there is a semi-major tick mark.

You have specified the max as 50 and the min as -5, as these are not both multiples of 10, the niceScale routine rounds your min to -10.

Now the code checks if the required min scale value matches the current gauge min scale value, if they don't match the gauge is redrawn. But due to niceScale, it redraws again with a rounded min value of -10 instead of the requested -5.

With me so far? :?

So two options to fix this...

1. Change your min scale values for the temp and dew gauges to -10
2. Add an additional parameter to the temp and dew gauges to disable 'niceScale' and keep your -5
- Add

Code: Select all

                    params.niceScale = false;
at lines 720 and 957
You do not have the required permissions to view the files attached to this post.
UncleBuck
Posts: 43
Joined: Sat 29 Dec 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

Re: changing tempScaleDefMaxC causes erratic behaviour

Post by UncleBuck »

Yep, got all that....
Have decided to go with option 1 even though I don't think we have ever gone below about -3 here.
It's just easier to change the DefMin as the gauges look better that way.

Now I just need to finish troubleshooting those damn popup graphs :groan:
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: changing tempScaleDefMaxC causes erratic behaviour

Post by Phil23 »

Reviving this after a few years for some current version clarification of this Fix.
mcrossley wrote: Thu 28 Jan 2016 9:32 am OK, I see what the problem is.

The gauges by default are configured to have a 'niceScale',
So two options to fix this...

1. Change your min scale values for the temp and dew gauges to -10
2. Add an additional parameter to the temp and dew gauges to disable 'niceScale' and keep your -5
- Add

Code: Select all

                    params.niceScale = false;
at lines 720 and 957
I'm assuming line numbers may have changed over the years, so if it belongs in this block of code?
Lines 714 to 724 of Version 2.7.3.

Code: Select all

                var params = $.extend(true, {}, commonParams);

                // define temperature gauge start values
                cache.sections = createTempSections(true);
                cache.areas = [];
                cache.minValue = gaugeGlobals.tempScaleDefMinC;
                cache.maxValue = gaugeGlobals.tempScaleDefMaxC;
                cache.title = strings.temp_title_out;
                cache.value = gaugeGlobals.tempScaleDefMinC + 0.0001;
                cache.maxMinVisible = false;
                cache.selected = 'out';
Or is it meant to be in the block below?
Lines 726 to 739.

Code: Select all

                // create temperature radial gauge
                if ($('#canvas_temp').length) {
                    params.size = Math.ceil($('#canvas_temp').width() * config.gaugeScaling);
                    params.section = cache.sections;
                    params.area = cache.areas;
                    params.minValue = cache.minValue;
                    params.maxValue = cache.maxValue;
                    params.thresholdVisible = false;
                    params.minMeasuredValueVisible = cache.maxMinVisible;
                    params.maxMeasuredValueVisible = cache.maxMinVisible;
                    params.titleString = cache.title;
                    params.unitString = data.tempunit;
                    params.trendVisible = gaugeGlobals.tempTrendVisible;
                    // params.customLayer = _imgBackground;      // uncomment to add a background image - See Logo Images above
Thanks

Phil.

Edit:-

The mod at line 957 is a bit harder to work out, as that block has undoubtedly moved during updates to code.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: changing tempScaleDefMaxC causes erratic behaviour

Post by mcrossley »

you need to add the niceScale = false in your second block of code.
Post Reply