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

Highcharts Graphs

Discussion and support for 3rd-party (non-Sandaysoft) tools for Cumulus
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Post by nitrx »

Edited the php file my log is here http://www.apeldoorn.tk/weer/realtimelog.txt I've stopped the ftp about more as an hor ago.
User avatar
mcrossley
Posts: 12697
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Post by mcrossley »

Weird, the log file looks fine, the first line looks to be in exactly the same format as the rest, I have no idea why the PHP script cannot interpret that date/time?
line 1, Fails - 25-11-12 17:46:18
line 2, Works - 25-11-12 17:47:08
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Highcharts Graphs

Post by steve »

mcrossley wrote:I have no idea why the PHP script cannot interpret that date/time?
Because the file has a BOM at the start?
Steve
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Post by nitrx »

On my local copy it says it's DOS/Windows UTF 8 ....
User avatar
mcrossley
Posts: 12697
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Post by mcrossley »

Does your software say whether it has a BOM or not? If it is Notepad++ the 'Encoding' menu item should tell you?
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Post by nitrx »

mcrossley wrote:Does your software say whether it has a BOM or not? If it is Notepad++ the 'Encoding' menu item should tell you?
Notepad++ says it's utf8 there is also UTF (without BOM) but thats not marked so i suspect it's UTF8 with BOM... :?
User avatar
mcrossley
Posts: 12697
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Post by mcrossley »

Updated the PHP to remove any BOM from the first field...

http://weather.wilmslowastro.com/realti ... p?view=sce

Apparently PHP will not understand BOM marked files until version 6 :(
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Post by nitrx »

I have uploaded the file manually as utf without bom it seem te graphs are fine now, but my server is in the usa I thought the time was behind over there but its already monday :bash:
User avatar
mcrossley
Posts: 12697
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Post by mcrossley »

Oh lord, I hate time zone issues! If only all software stored and processed everything in a sensible way using UTC then we could just convert to locale time for display :bash:

If the server is in the USA, then I expect you will have to force it to use the Netherlands TZ, by adding in a line

Code: Select all

date_default_timezone_set('Europe/Amsterdam');
in the PHP before any date processing, I'd put it in around line 26.
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Post by nitrx »

Strange after adding the timezone it seems the BOM is back :geek:
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Post by nitrx »

nitrx wrote:Strange after adding the timezone it seems the BOM is back :geek:
The time is now 2 hours behind local time Europe/Amsterdam... interesting graphgs btw :D
User avatar
mcrossley
Posts: 12697
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Post by mcrossley »

And the dates created from the log file are an hour behind.

The script takes the date/time from the logfile, then
1. uses mktime() to create a date object in PHP, using your Europe/Amsterdam TZ
2. converts that to millisecs since 1970
3. send it to your browser
4. Javascript in your browser then converts that back to a date/time in the users TZ

So, I can see that your data will display on my browser an hour behind - the difference in TZ's
What is needed is for the PHP script to also supply the TZ so that Highcharts can calculate the correction for local TZ for the end user.
Not sure how to do this yet... (maybe just make it parameter in the script, but that may not work over DST changes :) )

Not sure about the BOM issue either, I will have to create a file with a BOM to test....

Both issues will have to wait until tomorrow now.
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Post by nitrx »

Oké very simple :) welk iets late over Here now, thanks for your efforts
User avatar
mcrossley
Posts: 12697
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Post by mcrossley »

Hi Ron

I have made a few changes this lunch time. :lol:

1. Dropped the RK 'tail' command for the GNU Windows port (http://unxutils.sourceforge.net/UnxUpdates.zip) as the Windows RK version doesn't seem to be able to count lines consistently! :bash:

2. Changed the RT log file creation batch to reflect new 'tail' and to do the initial copy in binary mode (text mode was appending a weird character at the end of the output file on my copy of XP :bash:)

3. Changed the PHP to not do any date handling at all - it's too hard with potentially the data coming from one TZ, the server in another TZ, and the end user in third TZ! Which leads to...

4. Changed the browser script to do all the date handling.

I also upped my time period to 2 hours so the data trends are better seen.

I suggest you download the new JS and PHP, the revised batch file is below...

Code: Select all

:start
copy /b realtime.log+realtime.txt realtime.tmp
tail --quiet --lines=120 realtime.tmp > realtime.log
sleep 60
goto start
If you try it, let me know how it goes
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Post by nitrx »

Hi Mark,
great job but the tail command doesn't work I made the batchfile started tail.exe and after that the bat I get messages tail command not known and sleep not known.

Also tried to make it compatible with WinXP SP2 but no results unfortunally :cry:
Post Reply