Page 1 of 2

Smooth graphic on your site if you use upload to wundergroun

Posted: Wed 06 Oct 2010 5:25 pm
by nitrx
I was looking for better history graphics (the graphics of wunderground self are terrible I think) and found a freeware package.

I use cumulus and send the data also too wunderground so if you want to take advantage of it you need a wundergound ID and send yor data from cumulus there.

The graphics generated can be exposed by the package that you can download here http://pocasi.hovnet.cz/wxwug.php?lang=en#construction , I just set it up on my server and it works fine (your sever musthave php5, mysql isn't needed)

An example is availble over here (it's raw don't use the close page button :D ) http://www.apeldoorn.tk/weer/wugraphs.php I've to work it out in a template

credits are from Radomir Luza, I hope this can be usefull for some cumulus users, I hadn't see it before .

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Wed 06 Oct 2010 5:29 pm
by steve
Nice!

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Wed 06 Oct 2010 8:17 pm
by daj
Great find.

I have thrown together a proof of concept of it reading the data produced from the dayfile.txt by Cumulus

http://www.grantownweather.co.uk/grapht ... ature.html

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Wed 06 Oct 2010 8:43 pm
by nitrx
Looks good it shoold be nice to use the stored data from the dayfiles do you have the source ?

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Wed 06 Oct 2010 9:33 pm
by daj
Ron,

At the moment I have it reading the dayfile.txt data from an SQL table (which is where I store all my data on the webserver)

Is that ok, or do you need it reading the text file directly?

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Wed 06 Oct 2010 9:37 pm
by nitrx
I prefer mysql :D it can wait I go to sleep thanks David

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Thu 07 Oct 2010 11:14 am
by daj
Attached is my 'proof of concept' code. This uses the Highcharts graphing tools discussed in this thread.

My code will read the dayfile.txt data which has previouslly been imported into a MySQL table on your webserver. I use the SQL structure as generated by the ImportCumulusFile tool, but any SQL table structure will do as long as you update the code accordingly.

Attached is the complete code and libraries.

You need to edit dbconfig.php to store your username, password, and table name for MySQL. Once done you should be able to browse to 'temperature.html' and get a graph similiar to mine (showing the last 60 days worth of your Temperature highs and lows)

How it works.
  • temperature.html is a basic HTML page -- it loads the necessary libraries and also js/graph.js which is my code to build the actual graph.
  • graph.js processes graphdata.php and uses this to build a chart and place it in a div called 'container' in the HTML page
  • graphdata.php reads the MySQL table and produces a CSV file for the charting tool to build a data series.
Any questions, I will try my best to help. As I say, its very basic but it does show that HighCharts can be used with the Cumulus data

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Thu 07 Oct 2010 11:44 am
by nitrx
Thank you David i'll give it a try this evening

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Thu 07 Oct 2010 6:12 pm
by nitrx
Hi David I tried but I dont get output, my logdates are stored as YYYY-MM-DD has this affect of the query ?

"SELECT date_format(LogDate,'%d %b %Y') as UKLogDate,MinTemp,MaxTemp FROM Dayfile ORDER BY LogDate DESC limit 60"; << Wondering why it's %b and not %m

Ron

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Thu 07 Oct 2010 6:41 pm
by daj
%b gives the abbreviated Month name, so Oct for example

I just like to manipulate my date slightly. Let's keep it simple for you for now, and change your SQL statement....

Code: Select all

SELECT LogDate,MinTemp,MaxTemp FROM Dayfile ORDER BY LogDate DESC limit 60";
You also need to modify the XAxis set a few lines down, as we are no longer using UKLogDate

Code: Select all

$XAxis .= $row[LogDate] . ",";
To prove it is getting the data, just open up graphdata.php in a browser window and it should return all the data in a raw format. example.... http://www.grantownweather.co.uk/grapht ... phdata.php

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Thu 07 Oct 2010 7:58 pm
by nitrx
Hmmmz I think there is another issue I've changed as you suggested (before changen I got this error and after chanching

http://www.apeldoorn.tk/weer/graph/graphdata.php , never seen this before just googled on it but found no solutions, I use localhost this work allways fine with other databases

IGNORE this post I've uploaded a wrong file :) be back soon

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Thu 07 Oct 2010 8:17 pm
by daj
I can see progress, but you need to update the graph.js file as you have not put it in the same location as I did

Code: Select all

$.get('/graphtest/graphdata.php', function(data) {
will need to be something like

Code: Select all

$.get('/weer/graph/graphdata.php', function(data) {
or use a relative path

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Thu 07 Oct 2010 8:28 pm
by nitrx
Great that did the job I made a great mistake for thr dbconfig, but I shouldn't have found the path in the .js file well it's workig fine (I think it will also wordk with the UK-date version, I shall do some investigations to the syntax it's a lot acracadrabra for me , Thanks a lot !
http://www.apeldoorn.tk/weer/graph/temperature.html

Anyway I see it's not correct the data are from now to hystory :lol: Your data too, so I think I must use ascendeng ...

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Sun 10 Oct 2010 9:22 am
by hve22
nitrx wrote:I was looking for better history graphics (the graphics of wunderground self are terrible I think) and found a freeware package.

I use cumulus and send the data also too wunderground so if you want to take advantage of it you need a wundergound ID and send yor data from cumulus there.

The graphics generated can be exposed by the package that you can download here http://pocasi.hovnet.cz/wxwug.php?lang=en#construction , I just set it up on my server and it works fine (your sever musthave php5, mysql isn't needed)

An example is availble over here (it's raw don't use the close page button :D ) http://www.apeldoorn.tk/weer/wugraphs.php I've to work it out in a template

credits are from Radomir Luza, I hope this can be usefull for some cumulus users, I hadn't see it before .
Hi, i came across your mentioned piece of software and it looks ok, so i did download it from the authers site [v0.7.9b]

After installing it on my website, it generates no graphs...

So i did test it on a virtual server, but it looks like the code is generating several errors. So are 2 files missing [settngs.php and commen.php] Further more the code generates errorcodes like missing variables ....


Apparently your version is working fine, so is it possible that you mail me a copy of your working version....??


regards

Re: Smooth graphic on your site if you use upload to wundergroun

Posted: Sun 10 Oct 2010 10:46 am
by nitrx
There is no file like settings.php look for WUG-settings.php and the file commen.php ? isn't in the package by me neither, you shoul have the same zip file as me.