Page 24 of 28

Re: Highcharts Graphs

Posted: Tue 08 May 2018 9:48 am
by uncle_bob
Good morning all (trying to sound like Julian Ilett :) )

Yes, vers 2.8 seemed to have worked fine:

08/05/18 - 11:45:20
Importing to table: Dayfile ...
Processing dayfile: C:\Cumulus\data\dayfile.txt
Table does not exist, creating it...
Inserting data...
Inserted 2446 rows
done.
End of script 08/05/18 - 11:45:23 - execution time: 2.864s

Re: Highcharts Graphs

Posted: Tue 08 May 2018 9:54 am
by mcrossley
OK, good to know, I think the binding error is to do with you having "null" values in the data file - In mine I have set all those to zero values at some point. I didn't get a chance to look at this yesterday, but at some point I'll see if that is the problem and what I can do about it...

Re: Highcharts Graphs

Posted: Tue 08 May 2018 10:58 am
by uncle_bob
Hi Mark, and thanks for the help with this.
There will definitely be issues since I had to try and Un-Fine Offset the corrupted data when I've noticed it.
If you want to have a play around with my complete dayfile, let me know.
Thanks again UB :)

Re: Highcharts Graphs

Posted: Tue 08 May 2018 1:42 pm
by sfws
mcrossley wrote:having "null" values in the data file - In mine I have set all those to zero values
Maybe, it is just personal preference, as I'm not a computer specialist, but "garbage in, garbage out" is a saying that I have heard. I don't want to apply validation in each retrieval script, I prefer to apply it once when loading the database (and therefore I use nulls extensively). The use of zero values does not make sense to me, zero is definitely a valid number in many measurements.

Back in 2014 when I made my first exploratory venture into PHP and database, I rejected using your script (earlier version) and wrote my own because I wanted to use official nulls for any values where either the measurement was missing or it was suspect. Ironically it was some rogue temperature measurements that influenced my thinking, so using zero would definitely not suit me. Incidentally, in my script I also set time-stamps to null when the associated value does not "make sense" (unlike Cumulus that would leave those time-stamps at rollover time). So if there is no rain in a day, the time of the highest hourly rain (or time of peak rain rate) is to my way of thinking null rather than rollover time just as much as it would be if the rain gauge was not working. Of course, my database tables are not exact mirrors of any Cumulus log files, so I don't think your binding approach would work with my tables, and because I access real-time log directly on the rare times I need it, speed of loading database tables does not matter to me.

Re: Highcharts Graphs

Posted: Tue 08 May 2018 2:11 pm
by mcrossley
It's been debated before, if I were starting from scratch I'd possibly use a different DB schema, however the script and DB was in existence for a year or so before I started using it. David Jamieson originally constructed it and decided to make the DB a more or less straight copy of the Cumulus log files, which was as valid decision as any at the time.

I'm sure if Steve were starting from scratch he'd probably alter the Cumulus log file format too, but we have what we have.

Re: Highcharts Graphs

Posted: Thu 27 Jun 2019 10:06 pm
by Phil23
Not sure if there's another more relevant thread, but have browsed right thru this one & see a few mentions of what I want, but no resolution.

I decided I'd like my graphs to span 7 days instead of my previous 48 hours, so changed Graph hours to 168 hours.
Then decided I wanted more Zoom buttons, so addressed that in cumuluscharts.js.
EDIT (I am using MX, but couldn't see a Highcharts Subforum).

THEN, decided I preferred the 48 hour time span as a default.

Setting a range is mentioned in this post, but the answer is outside the thread.
viewtopic.php?f=18&t=8672&start=315#p126119

How do I get the chart to default to 48 hours & not lose the zoom buttons.
TempGraph.JPG

Code: Select all

        rangeSelector: {
            buttons: [{
                    count: 6,
                    type: 'hour',
                    text: '6h'
                }, {
                    count: 12,
                    type: 'hour',
                    text: '12h'
                }, {
                    count: 24,
                    type: 'hour',
                    text: '24h'
                }, {
                    count: 48,
                    type: 'hour',
                    text: '48h'
                }, {
                    count: 72,
                    type: 'hour',
                    text: '3d'
                }, {
                    count: 96,
                    type: 'hour',
                    text: '4d'
                }, {
                    count: 120,
                    type: 'hour',
                    text: '5d'
                }, {
                    type: 'all',
                    text: 'All'
                }],
            inputEnabled: false
        }

Re: Highcharts Graphs

Posted: Thu 27 Jun 2019 10:40 pm
by Phil23
Found other references, and can now get it to default to 48 hours, but as mentioned the buttons are not visible until the zoom slider is moved.

Viewers may not realise this & be unaware that zoom is available.

Code: Select all

        rangeSelector: {
            selected: 3,
            buttons: [{
                    count: 6,
                    type: 'hour',
                    text: '6h'
                }, {
                    count: 12,
                    type: 'hour',
                    text: '12h'
                }, {
                    count: 24,
                    type: 'hour',
                    text: '24h'
                }, {
                    count: 48,
                    type: 'hour',
                    text: '48h'
                }, {
Edit,
Logic is telling me that rather than selecting a range, I need a line to activate a button once they are drawn,
but I have very little java knowledge.

Re: Highcharts Graphs

Posted: Thu 27 Jun 2019 11:10 pm
by beteljuice
Instead of:

Code: Select all

inputEnabled: false
Try

Code: Select all

enabled: true
https://jsfiddle.net/gh/get/library/pur ... r/enabled/

or

Code: Select all

allButtonsEnabled: true
https://jsfiddle.net/gh/get/library/pur ... bled-true/

Re: Highcharts Graphs

Posted: Fri 28 Jun 2019 10:03 am
by Phil23
Just tried that, and the display I get is this.
TempGraph2.JPG
What I'm trying to achieve when I visit the page is this, just the last 48 hours by default.
TempGraph.JPG

Code: Select all

        rangeSelector: {
          selected: 3,
            buttons: [{
                    count: 6,
                    type: 'hour',
                    text: '6h'
                }, {
                    count: 12,
                    type: 'hour',
                    text: '12h'
                }, {
                    count: 24,
                    type: 'hour',
                    text: '24h'
                }, {
                    count: 48,
                    type: 'hour',
                    text: '48h'
                }, {
                    count: 72,
                    type: 'hour',
                    text: '3d'
                }, {
                    count: 96,
                    type: 'hour',
                    text: '4d'
                }, {
                    count: 120,
                    type: 'hour',
                    text: '5d'
                }, {
                    type: 'all',
                    text: 'All'
                }],
            enabled: true
        }
[/[code]

Re: Highcharts Graphs

Posted: Fri 28 Jun 2019 11:36 pm
by beteljuice
Did you try the second option ?

allButtonsEnabled: true

The js fiddle looks very similar to what you want to do (show buttons and preselect option)

Re: Highcharts Graphs

Posted: Sat 29 Jun 2019 9:21 pm
by Phil23
Yes,

Tried the above in 3 places, before & after the selected=3 & at the end of the section.
2nd two positions stopped the graph displaying.
1st resulted in a full 7 day graph not the 48 hours.

Re: Highcharts Graphs

Posted: Sat 29 Jun 2019 11:21 pm
by beteljuice
That sounds like a syntax error - missing comma / semi-colon / colon - whatever

Re: Highcharts Graphs

Posted: Sun 30 Jun 2019 8:16 pm
by Phil23
I see an example working exactly like I want here, https://weather.wilmslowastro.com/graphs_recent.php on @mcrossley s site.

Re: Highcharts Graphs

Posted: Sun 30 Jun 2019 10:00 pm
by beteljuice
Apologies to Mark ....

Marks is part of a common graphs 'theme'

The part of the code you say you want is:

Code: Select all

    rangeSelector: {
        buttons: [{
            count: 6,
            type : 'hour',
            text : '6h'
        }, {
            count: 12,
            type : 'hour',
            text : '12h'
        }, {
            count: 1,
            type : 'day',
            text : '1d'
        }, {
            count: 2,
            type : 'day',
            text : '2d'
        }],
        buttonTheme : {'stroke-width': 1},
        inputEnabled: false,
        selected    : 1
    }
So back to original inputEnabled: false - the only obvious thing I can see is the location of the selected option ?

Re: Highcharts Graphs

Posted: Mon 01 Jul 2019 10:45 am
by Phil23
Crashed & burnt with this today.....

Wasn't the right time for changes.

Was the above a cut from Mark's code?

Got the impression that the commented out "Try It" lines I had messed with things, but that shouldn't really be the case??