Page 4 of 28

Re: Highcharts Graphs

Posted: Mon 26 Nov 2012 2:16 pm
by mcrossley
Did you keep a copy of sleep.exe from the RK? I suggest you put the sleep.exe and tail.exe either in the same folder as the batch file, or in the Windows folder (then they will be available to any batch file you write).

Re: Highcharts Graphs

Posted: Mon 26 Nov 2012 2:29 pm
by nitrx
mcrossley wrote:Did you keep a copy of sleep.exe from the RK? I suggest you put the sleep.exe and tail.exe either in the same folder as the batch file, or in the Windows folder (then they will be available to any batch file you write).
There is no sleep.exe in the zip what do you mean with RK ? Yo mean I've to download the win 2003 resource kit ? Is the lates not a self installing product..

Aha done works now used sleep form resource kit and tail from unixthings :D will setup now the other things

Re: Highcharts Graphs

Posted: Mon 26 Nov 2012 3:13 pm
by nitrx
Great job Mark ,

Data are displayed one hour behind for me but the graphs are almost working fine now :clap: http://www.apeldoorn.tk/weer/realtimecumulus.htm waiying a minute or more te graph behaves strange ...

Re: Highcharts Graphs

Posted: Mon 26 Nov 2012 3:40 pm
by mcrossley
That is bad! Your data shows one hour ahead of me, which is what I would expect. I cannot see how it is an hour behind for you as the time is just passed as a string.

I have updated the script again, I have changed the getRealtime() function to use JQuery AJAX so I can invoke its cach busting abilities (not available on the normal JQuery 'get()' as I think I was picking up an out of date realtime file from your site.

Code: Select all

		getRealtime = function () {
			$.ajax({
				url: './realtime.txt',
				datatype: 'text',
				success: function (data) { parseRealtime(data); },
				cache: false
			});
		},

Re: Highcharts Graphs

Posted: Mon 26 Nov 2012 4:02 pm
by nitrx
mcrossley wrote:That is bad! Your data shows one hour ahead of me, which is what I would expect. I cannot see how it is an hour behind for you as the time is just passed as a string.

I have updated the script again, I have changed the getRealtime() function to use JQuery AJAX so I can invoke its cach busting abilities (not available on the normal JQuery 'get()' as I think I was picking up an out of date realtime file from your site.

Code: Select all

		getRealtime = function () {
			$.ajax({
				url: './realtime.txt',
				datatype: 'text',
				success: function (data) { parseRealtime(data); },
				cache: false
			});
		},
Mark I really don't know how this can happen it's 16:57 over here but the graph displays 15:57 , so the view from the UK is right, can I add some time disclaimer , I don't think so because somebody from Asia or the US will see complete other times.

Anyway the script update did solve the weird graphs thank you :!:

Re: Highcharts Graphs

Posted: Mon 26 Nov 2012 11:19 pm
by mcrossley
It looks like Highcharts always uses UTC for the time stamps on the xAxis :(

So I have changed it all to avoid date constructs altogether, just pass the time as a string. It means that we lose the nice time interval plotting on a the xAxis, but avoid the nightmare TZ's were turning into!

Re: Highcharts Graphs

Posted: Tue 27 Nov 2012 10:19 am
by mcrossley
...I thought about this after I went to bed (sad!), I realised that I had been over complicating it all along. All you have to do is parse the station date/time on the server as a UTC date, then Highcharts will go on to display it as UTC - so the same date/time pops out on the chart as was generated by the station. Simples :bash: Then do the same on the client side for the realtime.txt dynamic updates.

Re: Highcharts Graphs

Posted: Tue 27 Nov 2012 11:55 am
by water01
I always solve my programming problems in bed when asleep, must have a background processor running. Always have a pad and pencil next to bed, write it down and go back to sleep, so I must be as sad as you!!

By the way are there any instructions on how to set this up as I would love to have these graphs on my site. Assume the first problem is to get a MySQL database built?

Re: Highcharts Graphs

Posted: Tue 27 Nov 2012 2:06 pm
by KevinF
By the way are there any instructions on how to set this up as I would love to have these graphs on my site. Assume the first problem is to get a MySQL database built?
Like David has said Mark, these graphs are very pleasing and professional looking for our websites and the viewers. In my case, I'm basic when it comes to computer language, but I am so impressed that I feel the need to dabble in MySQL to achieve what is shown on here.

So any little pointers would really be appreciated. Of course thanks for showing and sharing it.

Kind Regards Kevin

Re: Highcharts Graphs

Posted: Tue 27 Nov 2012 2:22 pm
by mcrossley
Hi Kevin, the 'realtime' chart doesn't need any SQL of course, it just uses the realtime.txt file you probably already have.

For the the historic charts, I am storing the Cumulus dayfile in an MySQL database (it makes the aggregated queries and time range selections so much easier than using a flat text file).

I use CumulusToolbox to copy the dayfile to the web server, and then an PHP command to import the latest data into a table. This script was written David Jamieson some time ago. You can find it in the wiki here: http://wiki.sandaysoft.com/a/ImportCumulusFile.

I do not bother with the full logfile (with 10 minute logging in my case), the daily summaries are fine for my needs.

Re: Highcharts Graphs

Posted: Tue 27 Nov 2012 8:23 pm
by water01
Mark, OK I get that, but I assume there is a requirement for some jquery files and some Highchart files to get the graphs displayed. Or do I just grab them and the html code from your pages?

And I have also assumed that the realtime and the historic graphs are both separate html pages?

Re: Highcharts Graphs

Posted: Tue 27 Nov 2012 8:29 pm
by mcrossley
I have put the realtime graph on my default index page (which was ajax enabled anyway) I suggest you use the 'template page' referred to above though, the code is much cleaner!

The historic graphs are on my 'historic' link, the only bit you cannot get for those is the PHP code, if you really want it I can make it available by putting a view=sce option in those too.

Re: Highcharts Graphs

Posted: Thu 29 Nov 2012 10:43 am
by mcrossley
I have added a zip of the realtime Highcharts to the Wiki and a small page about it here - http://wiki.sandaysoft.com/a/Realtime_Highcharts

Re: Highcharts Graphs

Posted: Thu 29 Nov 2012 1:35 pm
by water01
The historic graphs are on my 'historic' link, the only bit you cannot get for those is the PHP code, if you really want it I can make it available by putting a view=sce option in those too.
Could I be a pain and use your code pretty please?

Re: Highcharts Graphs

Posted: Thu 29 Nov 2012 1:47 pm
by mcrossley
Done.