Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Highcharts Graphs

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

Re: Highcharts Graphs

Postby nitrx » Sun Nov 25, 2012 6:56 pm

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: 5192
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Postby mcrossley » Sun Nov 25, 2012 7:09 pm

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: 26654
Joined: Mon Jun 02, 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Highcharts Graphs

Postby steve » Sun Nov 25, 2012 7:12 pm

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
-----
Hosting available for Cumulus web sites. See http://sandaysoft.com/forum/viewtopic.php?f=2&t=11876

Please read the posts in the Announcements section about the current status of Cumulus development since I have retired from my day job

User avatar
nitrx
Posts: 1289
Joined: Sun Dec 13, 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Postby nitrx » Sun Nov 25, 2012 7:24 pm

On my local copy it says it's DOS/Windows UTF 8 ....

User avatar
mcrossley
Posts: 5192
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Postby mcrossley » Sun Nov 25, 2012 7:28 pm

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: 1289
Joined: Sun Dec 13, 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Postby nitrx » Sun Nov 25, 2012 7:35 pm

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: 5192
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Postby mcrossley » Sun Nov 25, 2012 7:36 pm

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: 1289
Joined: Sun Dec 13, 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Postby nitrx » Sun Nov 25, 2012 7:40 pm

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: 5192
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Postby mcrossley » Sun Nov 25, 2012 7:50 pm

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: 1289
Joined: Sun Dec 13, 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Postby nitrx » Sun Nov 25, 2012 8:20 pm

Strange after adding the timezone it seems the BOM is back :geek:

User avatar
nitrx
Posts: 1289
Joined: Sun Dec 13, 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Postby nitrx » Sun Nov 25, 2012 8:31 pm

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: 5192
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Postby mcrossley » Sun Nov 25, 2012 9:08 pm

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: 1289
Joined: Sun Dec 13, 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Postby nitrx » Sun Nov 25, 2012 9:14 pm

Oké very simple :) welk iets late over Here now, thanks for your efforts

User avatar
mcrossley
Posts: 5192
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Postby mcrossley » Mon Nov 26, 2012 12:30 pm

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: 1289
Joined: Sun Dec 13, 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Highcharts Graphs

Postby nitrx » Mon Nov 26, 2012 2:03 pm

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:


Return to “3rd Party Tools”

Who is online

Users browsing this forum: No registered users and 2 guests