Page 1 of 1

Gauge Tick Marks

Posted: Mon 17 Oct 2016 9:36 pm
by mike_b
Hi,

I have just upgraded to Cumulus MX. The web pages look great! I am confused by the tick marks on some of the gauges. On the wind speed gauge there are 10 tick marks between each 5 MPH reading. For example, there are 10 tick marks between 0 and 5 MPH. Why are there 10 tick marks rather than 5?

Thank you,
Mike

Re: Gauge Tick Marks

Posted: Tue 18 Oct 2016 1:28 am
by f4phlyer
Mike,
A picture is worth a thousand words, do you have a site?

Re: Gauge Tick Marks

Posted: Tue 18 Oct 2016 2:27 am
by jlmr731
My guess is that it is a standard gauge layout package, if you look at the other gauges they also have the same amount of tick's like temp humidity ...

yes wind is only whole numbers so just have to look past the extra lines in the gauge.

Re: Gauge Tick Marks

Posted: Tue 18 Oct 2016 9:22 am
by mcrossley
Tick marks are a nightmare to get right. The SteelSeries gauges try and use "sensible" values for the minor/major tick spacing's, but they sometimes appear a bit odd to us humans. The code is untouched from the original supplied by Gerrit - which in turn is based on a pretty standard routine you will find in other packages too. I have tried tweaking it a couple of times in the past, but whilst I could improve it in some situations it would be worse in others.

If anyone can come up with a better scheme I'd be happy to look at it. Currently the code looks like this...

Code: Select all

    function calcNiceNumber(range, round) {
        var exponent = Math.floor(Math.log10(range)),   // exponent of range
            fraction = range / Math.pow(10, exponent),  // fractional part of range
            niceFraction;                               // nice, rounded fraction

        if (round) {
            if (1.5 > fraction) {
                niceFraction = 1;
            } else if (3 > fraction) {
                niceFraction = 2;
            } else if (7 > fraction) {
                niceFraction = 5;
            } else {
                niceFraction = 10;
            }
        } else {
            if (1 >= fraction) {
                niceFraction = 1;
            } else if (2 >= fraction) {
                niceFraction = 2;
            } else if (5 >= fraction) {
                niceFraction = 5;
            } else {
                niceFraction = 10;
            }
        }
        return niceFraction * Math.pow(10, exponent);
    }


Re: Gauge Tick Marks

Posted: Tue 18 Oct 2016 3:03 pm
by mike_b
Thanks for the information everyone. I now understand that there are always 10 tick marks between major number values in the gauges. My visual perception says something isn't right, but as jlmr731 said, I will look past it.

Re: Gauge Tick Marks

Posted: Tue 18 Oct 2016 8:31 pm
by jlmr731
Nice Fraction lol
I guess for the wind gauge would it be possible to use only nice numbers, no ticks between? As i see it it would be the only gauge that needs tweaked if at all.