Page 13 of 17
Re: Cumulus Server Sided JpGraph Graphs
Posted: Fri 08 Jan 2010 11:42 pm
by regg001
i0i wrote:Hello. Been collecting data for my jpgraphs since recieiving a weather station for Christmas

Now got 4 months worth and want to see all of it in one graph. Would really appreciate some ideas, I work by reverse engineering these scripts and as a result have trouble getting them to do new things.
I want the temp365 graph to draw a 365 data point x axis and gradually fill it during the year, rather than draw an x axis with 4 months of data and increase it in size each day.
I tried your code and each and every record are plotted - there's no selection to them so they got all selected and plotted. Do you mean you want to have one single record per day containing the min and max temperature per day.
So you'll need to get the last record of each day containing the tempTH and tempTL (highest and lowest temp of that day). That way, you'll plot one bar per day containing the high/low temps. Is that what you want to acheive ?
Re: Cumulus Server Sided JpGraph Graphs
Posted: Sun 10 Jan 2010 2:03 am
by Sandro
Hello I would like to use those graphs to show graphs for data of the last 24h.
As i read in the description you have to send regularly realtime.txt to enable the logging. The problem is I don't have the PC always on so when I re-open the PC and open the website what will I found? Graphs completely flat (I mean same data for as long as the realtime.txt was not updated) ?
What I wanted is to "turn-off" the logging while the pc is closed and than continue when it's re-open. The problem would always be that previous missing data would not be recovered in any way so the user won't see a tendency for the last 24h

. The only way is to let the graphs work on the monthlog.txt file from Cumulus. I didn't look at the script but I guess it could be done, the only problem is that I won't have to upload a less-than-1kb file but a really heavy file every minute, which is not that fascinating.
Re: Cumulus Server Sided JpGraph Graphs
Posted: Sun 10 Jan 2010 3:47 am
by TNETWeather
The graphs are designed to work the way there are because I could not come up with a reasonable way of transferring the data any other way.
In order to chart 24 hours worth of data, you have to have the 24 hours worth of data to work from. With your PC off for long periods of time, you would have to somehow catch up the data on the website so that the graphs could work.
Otherwise you have to do something on the PC side... which i can't really help you with.
I saw something about Cumulus being able to change the graph period of time, but I don't know if that would help much if your PC is offline for extended periods of time. The website would still be out of date parts of the day.
Re: Cumulus Server Sided JpGraph Graphs
Posted: Sun 10 Jan 2010 9:32 am
by regg001
regg001 wrote:i0i wrote:Hello. Been collecting data for my jpgraphs since recieiving a weather station for Christmas

Now got 4 months worth and want to see all of it in one graph. Would really appreciate some ideas, I work by reverse engineering these scripts and as a result have trouble getting them to do new things.
I want the temp365 graph to draw a 365 data point x axis and gradually fill it during the year, rather than draw an x axis with 4 months of data and increase it in size each day.
I tried your code and each and every record are plotted - there's no selection to them so they got all selected and plotted. Do you mean you want to have one single record per day containing the min and max temperature per day.
So you'll need to get the last record of each day containing the tempTH and tempTL (highest and lowest temp of that day). That way, you'll plot one bar per day containing the high/low temps. Is that what you want to acheive ?
Here's what i've been able to pull from the data with a different PHp receipe to select the available data . Currently it's only showing January's data, but by changing the xaxis value to (0,365), a year of data can be plotted - dough you'll probably get a very large realtime.log file to process. Suggestion would be to split the realtime.log per months - preprocess the files for the completed months and add the partial (on going) month's data to the year graph.
Remember working with txt files, is sequential reading - not really cpu friendly even if PHp does help alot. If you have many people requesting the same year chart, your server will have to compute all the records of that year for each html pages loaded from all those peoples. Maybe the best solution is to have PHP on your pc, manage all the database locally and create PNG graph files that will be uploaded to your server. A lot less stress to your server. If you want to keep everything on the server, then have the php to create pngs on the server and use the pngs for your webpage. A simple Cron running your php code 2 times a day, will update the pngs. Again, less stress on your server.
It's not completed yet, but it shows the actual High/Low temps for the current january period.
As i said in my previous message, the high/low of the day is already in the record so there's no need to search for them. So you have to find the last record of the day to pickup the values and plot them. That's what the following code is doing. It works because the current realtime.log file is already in the right order (sequential). Otherwise, you would have to sort the records prior to search for the right one. Other method can be used , but that one is working fine.
Big thanks to Hyrules who found the best way to make it.
Code: Select all
foreach($rawdata as $key)
{
$DATA = preg_split('/ +/', $key);
while($oldesttime < ret_value("time"))
{
$oldesttime = ret_value("time");
$y1[] = ret_value("tempTH");
$y2[] = ret_value("tempTL");
$x[] = ret_value("date");
$y[] = ret_value("time");
}
$oldesttime = ret_value("time");
$got++;
}
$y1 = array_reverse($y1);
$y2 = array_reverse($y2);
$x = array_reverse($x);
$y = array_reverse($y);
Re: Cumulus Server Sided JpGraph Graphs
Posted: Sun 10 Jan 2010 4:22 pm
by TNETWeather
With the upcoming ability to have Cumulus trigger a scheduler, a cached version of the charts will be available. This means that if you have a heavy visitor load, you can use the resulting static images on your pages rather than the php generated ones and only have the processing done at a specific interval.
For example, if you use the level 4 resolution 24 hour charts, they only really need to be generated once every 15 minutes rather than each time someone visits your page.
There are other changes coming including log rotation and ability to use previous months collected data for extended graphs, easier color modification etc..
Re: Cumulus Server Sided JpGraph Graphs
Posted: Mon 11 Jan 2010 6:37 pm
by Sandro
TNETWeather wrote:With the upcoming ability to have Cumulus trigger a scheduler, a cached version of the charts will be available. This means that if you have a heavy visitor load, you can use the resulting static images on your pages rather than the php generated ones and only have the processing done at a specific interval.
For example, if you use the level 4 resolution 24 hour charts, they only really need to be generated once every 15 minutes rather than each time someone visits your page.
There are other changes coming including log rotation and ability to use previous months collected data for extended graphs, easier color modification etc..
This could solve my problem, cause if the graph is created by calling a scheduler from Cumulus, when its closed no more images will be created.
You could also call a script that populates the missing data, the problem could be that if someone has a more than 1 minute log the graph won't work properly? Does it need a 1-minute interval log?
Re: Cumulus Server Sided JpGraph Graphs
Posted: Mon 11 Jan 2010 6:57 pm
by TNETWeather
Currently 1 minute increments are needed since the graphs look for specific times in the data. If they are not there, that interval is skipped.
Planned changes will only need once an hour, twice and hour and/or 4 times an hour increments which would greatly reduce the amount of data sent.
I have no way to "catch up" data from the Cumulus weather station though. That would need something on the PC end of things.
These are really designed for stations that run 24 hours a day though which already send data on a constant basis.
Re: Cumulus Server Sided JpGraph Graphs
Posted: Mon 14 Jun 2010 3:14 pm
by lapa
Hi there folks!
I'm sorry for writing post here instead of making new topic... I'm running the latest version of cumulus with jpgraph interface (site in polish ,no much data so far:
http://diana.idl.pl/pogoda/graphs/). I have the following problems:
The station is connected to computer in the middle of nowhere with GPRS internet. The quality of connection is very poor, so some of the realtime.txt are empty. As it turns out some of data in 00/15/30/45 minutes are missing. Now here are my issues/questions:
1) Is it possible to modify code so it would take data form xx:14 packet if xx:15 is missing (you get the point.. right :>)?
2) I've been trying to change freq_change function to change frequency to 00/10/20/30/40/50 minutes, but no good. Any clue how to modify php code to do that?
OK, I'd appreciate any help. Anyway, great job on jpgraph graphs - work rly nice

.
Tom
Re: Cumulus Server Sided JpGraph Graphs
Posted: Sun 10 Oct 2010 5:55 pm
by 6719jason
Hi there
As a very happy user of the JpGraph & Tnet Package, I was wondering if there is a way of using 'Cumulus Toolbox' to 'call' all the different php graphs and export to a .png file to ease website speed and traffic?
Jason
Re: Cumulus Server Sided JpGraph Graphs
Posted: Mon 11 Oct 2010 12:32 pm
by gemini06720
6719jason wrote:...to ease website speed and traffic?
Jason, how about reducing the number of weather graphics on one page - I have created 5 pages each containing 7 graphics - way faster than trying to create and display 35 graphics on one single page...

Re: Cumulus Server Sided JpGraph Graphs
Posted: Sun 31 Oct 2010 12:27 pm
by josebp
Hola, me llamo José y como mi inglés es muy malo utilizaré el traductor de Google. Disculpas por cualquier error del traductor.
Quiero poner en mi web los TNET Cumulus JpGraph Graphs y los tengo en prueba aqui:
http://www.tiempoensevilla.es/jpgraph/samp-graph.php
Como podeis comprobar, el gráfico de lluvia se sale de escala y no marca los 21.4mm de esta noche. También veo que en el de viento no marca los 51.5 Km/h de la racha de viento, se queda mucho más abajo.
¿Hay algo que he configurado mal?
Muchas Gracias por este mágnifico programa que es Cumulus y vuestras ideas para que la web sea más agradable para el visitante.
Saludos,
José
-----------------------------------------------------------------------------------------------------------------------
Hello, my name is Jose and as my English is very bad will use the Google translator. Apologies for any error of the translator.
I put on my website the TNET Cumulus JpGraph Graphs and test I have in here:
http://www.tiempoensevilla.es/jpgraph/samp-graph.php
As you can see, the graph of rain out of scale and does not mark 21.4mm tonight. I also see that the wind does not mark the 51.5 km / h gust of wind, is much lower.
Is there something I have configured wrong?
Thank you very much for this wonderful program that is Cumulus and your ideas to make the web more enjoyable for visitors.
Regards,
José
Re: Cumulus Server Sided JpGraph Graphs
Posted: Sun 31 Oct 2010 1:28 pm
by steve
If I understand you correctly, I think the answer is that the graphs are sampled at a particular interval (like the ones in Cumulus itself), so any peaks that occur between samples don't get recorded. Unless a graph plots every reading, it will only ever give you an overall picture of the data.
Re: Cumulus Server Sided JpGraph Graphs
Posted: Mon 01 Nov 2010 1:11 pm
by gemini06720
José, there might be some adjustments needed to get the two rain information (lines) to better display on the graphic. Have a look at my
24 Hour Weather Graphics page - be aware that the cumulative/total amount of rain was automatically reset to zero (by my weather station console) at the beginning of October when the rain season in my area really starts.
Re: Cumulus Server Sided JpGraph Graphs
Posted: Mon 01 Nov 2010 2:38 pm
by josebp
Hola Gemini, así se ven mucho mejor.
¿Me podrías decir que parámetros hay que cambiar, para que se vea así de bien?
De programación no tengo ni idea, pero poco a poco voy aprendiendo.
Es que queda muy mal que el gráfico de lluvia esté en 14mm y no en 22mm, así la lluvia de 21.4mm entraría bien en el gráfico y no se iría por arriba.
Gracias.
Saludos,
José
P.D. Perdón por seguir utilizando el traductor de google, a lo mejor no se entiende bien lo que quiero decir.
---------------------------------------------------------------------------------------------------------------
Hi Gemini, and are much better.
Can you tell me what parameters must be changed, to make it look this good?
Programming I have no idea, but am slowly learning.
It is very bad that the graph of rain is in 14mm, not 22mm and 21.4mm rain would go well in the plot and would not go above.
Thanks.
Regards,
José
P. S. Sorry to continue using the google translator, maybe not fully understand what I mean.

Re: Cumulus Server Sided JpGraph Graphs
Posted: Tue 02 Nov 2010 3:08 pm
by gemini06720
josebp wrote:
¿Me podrías decir que parámetros hay que cambiar, para que se vea así de bien?
---------------------------------------------------------------------------------------------------------------
Can you tell me what parameters must be changed, to make it look this good?
José, here is what you need to modify - line 199 has to be commented out (or completely removed):
Old Code - starting at line 195:
Code: Select all
//y-axis
$graph->yaxis->SetColor($SITE['txtcolor']);
$graph->yaxis->SetLabelFormat('%01.0f ' . $SITE['rainunit']);
$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,6);
$graph->yscale->SetAutoMax(10);
$graph->yscale->SetAutoMin(0);
$graph->yaxis->scale->SetGrace(10);
$graph->yaxis->HideTicks(true,true);
New Code - starting at line 195:
Code: Select all
//y-axis
$graph->yaxis->SetColor($SITE['txtcolor']);
$graph->yaxis->SetLabelFormat('%01.0f ' . $SITE['rainunit']);
$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,6);
// $graph->yscale->SetAutoMax(10);[/color]
$graph->yscale->SetAutoMin(0);
$graph->yaxis->scale->SetGrace(10);
$graph->yaxis->HideTicks(true,true);
Let me know if the modification corrects the display problem.
There are a few other lines of code that also need to be changed in the other PHP scripts (graphics) - I have been working on the scripts all day Thursday and should be finished reviewing the scripts by Friday or Saturday.