Page 1 of 1

HighCharts displaying wrong date

Posted: Wed 01 May 2013 3:58 pm
by N0BGS
Obviously doing something all wrong here, but I can't find it in the code. I'm using Mark's Highcharts - Realtime package and
TNET's Cumulus RealTimeLog Script on a Linux server.

This is what I get when I go to the chart on my site:

Image

Of course, today is May 1st, not June 4th.

If I wait approximately 2 minutes the chart flips back to this multi-year view:

Image

Anyone know what I'm doing wrong? Probably something easy that I am just overlooking.

You can see it for yourself at: http://cheesewhiz.dyndns.org/realtimeCumulus.htm

Thanks,

--Kurt

Re: HighCharts displaying wrong date

Posted: Wed 01 May 2013 4:23 pm
by nitrx
Your realtime.log http://cheesewhiz.dyndns.org/realtime.log has other date seprators I'm not sure if this causes the probles, I think Mark has a better answer..

Re: HighCharts displaying wrong date

Posted: Wed 01 May 2013 4:27 pm
by nitrx
Your realtime.log http://cheesewhiz.dyndns.org/realtime.log has other date seprators I'm not sure if this causes the probles, I think Mark has a better answer.. and there is someting wrong with realtimeLogParser.php view http://cheesewhiz.dyndns.org/realtimeLo ... p?sce=view

Re: HighCharts displaying wrong date

Posted: Wed 01 May 2013 4:42 pm
by N0BGS
Oh, you're right, Ron. Nice catch.

Getting a "No valid data types supplied" from realtimeLogParser.php.

I'll investigate that.

Thanks,

--Kurt

Re: HighCharts displaying wrong date

Posted: Wed 01 May 2013 4:53 pm
by nitrx
I think you have to change the following lines in the .php file

Code: Select all

$field_delimiter = ' ';
$date_delimiter = '-';
$time_delimiter = ':';
according to your realtime.log good luck

Re: HighCharts displaying wrong date

Posted: Wed 01 May 2013 5:28 pm
by N0BGS
When I change:

Code: Select all

$date_delimiter = '-';
The date displayed is Friday, Nov 3! :bash:

Re: HighCharts displaying wrong date

Posted: Wed 01 May 2013 7:44 pm
by nitrx
your datenotation is 2013-04-30 ergo yyyy-mm-dd

mine is dd-mm-yyyy http://apeldoorn.hollandweather.net/rt/ I think there should be changed somerthing in the script ( js script) unfortunally I've no idea what , wating for Mark Mc :?:

edit: the realtimeparser gives the same error anyway http://cheesewhiz.dyndns.org/realtimeLo ... p?sce=view

Re: HighCharts displaying wrong date

Posted: Fri 03 May 2013 2:14 pm
by N0BGS
I believe it is normal for realtimeparser.php to return that error without any input. According to the comments in Mark's PHP script:
Call this script as e.g. ...realtimeLogParser.php?count=N&temp&dew
Where count=N returns the last N rows worth of data from the log file
if the count parameter is omitted all available records are returned.
So, I don't think that is the cause. I've double and triple checked all the Linux permissions and the time and date delimiters. No go.

These are the http calls to my server:

216.x.x.x [03/May/2013:10:03:23 -0400] "GET /realtimeLogParser.php?count=180&rfall&press&wspeed&temp HTTP/1.1" 200 14384 "http://cheesewhiz.dyndns.org/realtimeCumulus.htm" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0"
216.x.x.x - - [03/May/2013:10:04:23 -0400] "GET /realtime.txt?_=1367589862022 HTTP/1.1" 200 270 "http://cheesewhiz.dyndns.org/realtimeCumulus.htm" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0"
216.x.x.x - - [03/May/2013:10:05:23 -0400] "GET /realtime.txt?_=1367589922023 HTTP/1.1" 200 269 "http://cheesewhiz.dyndns.org/realtimeCumulus.htm" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0"


I have no idea what the problem is.

Re: HighCharts displaying wrong date

Posted: Fri 03 May 2013 2:20 pm
by N0BGS
If I input the following URL: http://cheesewhiz.dyndns.org/realtimeLo ... 5&temp&dew

This is the output:

Code: Select all

{"temp":[[1117879915000,54.4],[1117879975000,54.5],[1117880035000,54.5],[1117880095000,54.5],[1117880155000,54.6]],"dew":[[1117879915000,42.1],[1117879975000,42.2],[1117880035000,41.7],[1117880095000,41.7],[1117880155000,42.3]]}
So, I think it is working.

Re: HighCharts displaying wrong date

Posted: Fri 03 May 2013 2:33 pm
by mcrossley
The realtimeLogParser is returning the incorrect date for some reason.

Can you look at your realtime table in MySQL and check what the date/times are showing up as there?

Re: HighCharts displaying wrong date

Posted: Fri 03 May 2013 2:47 pm
by nitrx
The data are not extracted from mysql but from http://cheesewhiz.dyndns.org/realtime.log

Re: HighCharts displaying wrong date

Posted: Fri 03 May 2013 4:19 pm
by mcrossley
Ah, sorry, still catching up from a few days away in Scotland.

Try the following script - I have added a config param of the date format ($date_format = 'dmy'; is the default), change that to 'ymd'
(I think 0.1 was the last one I used? Sorry but I am using the SQL version).

Renaming from .txt to .php obviously ;)

Re: HighCharts displaying wrong date

Posted: Sat 04 May 2013 2:59 am
by N0BGS
That's done it Mark!

Your code, with the settings below, made it work:

Code: Select all

// The name of your realtime.txt log file
$logfile = 'realtime.log';
// The various delimiters used in your version of realtime.txt
$field_delimiter = ' ';
$date_delimiter = '-';
$time_delimiter = ':';
$date_format = 'ymd';  // valid formats are 'dmy', 'mdy', and 'ymd'
Part of what was throwing me was the "The various delimiters used in your version of realtime.txt" line.
I believe that should read, at least in my case, "The various delimiters used in your version of realtime.log" because the delimiters in my realtime.txt and realtime.log files are not the same.
In any case, it would not have worked without the addition of your "$date_format = " snippet.

BTW, I do have MySql on my Linux box and would much prefer to have the capability to pull near-realtime and historical data from there. I know how to get the data into the db, I just don't know how to get it out. SO, if you happen to have some old code laying around that you aren't using... :)

Thanks so much...again!

--Kurt

Re: HighCharts displaying wrong date

Posted: Sat 04 May 2013 1:27 pm
by mcrossley
N0BGS wrote:That's done it Mark!
Great.
N0BGS wrote:BTW, I do have MySql on my Linux box and would much prefer to have the capability to pull near-realtime and historical data from there. I know how to get the data into the db, I just don't know how to get it out. SO, if you happen to have some old code laying around that you aren't using... :)
Just take a look at my now/index page... ;)
http://weather.wilmslowastro.com/realti ... p?view=sce