Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3044 7 December 2018. See the Wiki for download

Different time trends ?

Discussion and support for 3rd-party (non-Sandaysoft) tools for Cumulus
tempe
Posts: 13
Joined: Mon 28 Jul 2014 1:17 pm
Weather Station: Vantage vue
Operating System: win 7
Location: Finland

Different time trends ?

Post by tempe » Mon 28 Jul 2014 1:25 pm

Hi, how can I make different time trends? I only found detailed chart period and daily chart period? I'd love to have separate trends for 12 hours, one day, week, month, 3 months etc. Is this possible? Is there/do I need some separate software for this?

User avatar
steve
Cumulus Author
Posts: 26714
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Different time trends ?

Post by steve » Mon 28 Jul 2014 1:28 pm

You can only select one range in Cumulus, you would need to use something else to plot your own graphs, e.g. Highcharts. Something like this, perhaps - http://weather.wilmslowastro.com/graphs_recent.php
Steve

tempe
Posts: 13
Joined: Mon 28 Jul 2014 1:17 pm
Weather Station: Vantage vue
Operating System: win 7
Location: Finland

Re: Different time trends ?

Post by tempe » Mon 28 Jul 2014 1:35 pm

Thank you for your fast answer! Is there any templates for highcharts available? Even thou my server doesnt support PHP, maybe I could run script locally and just upload the graphics. Or is there other log parsers that could do it withouth php etc? Also, I dont need realtime or interactive graphs, just pictures of charts would be awesome.

sfws
Posts: 462
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Customised mix of Fine Offset
Operating System: Tempermental Win. 10 PC
Location: UK

Re: Different time trends ?

Post by sfws » Mon 28 Jul 2014 2:54 pm

tempe wrote: Even thou my server doesnt support PHP,
You don't need PHP to run HighCharts.
tempe wrote:maybe I could run script locally
Yes highcharts can be written as a script either called from or embedded in HTML.
see http://api.highcharts.com/highcharts for allowed synatx. If embedded then it is preceded by

Code: Select all

<div id="graph_position"></div>
		<script>
	$('#graph_position').highcharts(// equivalent to jQuery 'Ready'
		{
to define position on page where graph is to be inserted and to load the highcharts vocabulary
and terminated by

Code: Select all

}
	);
		</script>
I like to define all common options first, then options specific to a plot type, then my x axis, then on my graphs I define multiple y axis, and finally define the series with all the various data to be plotted. For example on one graph I plot 2 temperature arrays as a line type, 2 frost arrays as column type and 2 rainfall arrays as area type, on another graph I have bars to plot highest and lowest temperatures using LH y axis for various months on X axis, with extra bars showing the day (1 to 31) of the month those extremes happen using the RH y axis. The first page is a modification to a Cumulus template, so it is processed by Cumulus for regular updating. The second graph is on a page that does not need processing by Cumulus, but it sets the arrays up by reading the dayfile.txt file and cumulus uploads that once a day. Before you ask, my pages are not online, just on my own computer because I am an intermittent user.

On the web page containing the syntax you will find links to various examples, some weather based, and you can even edit these and that is how I created my first HighCharts graph.

tempe
Posts: 13
Joined: Mon 28 Jul 2014 1:17 pm
Weather Station: Vantage vue
Operating System: win 7
Location: Finland

Re: Different time trends ?

Post by tempe » Mon 28 Jul 2014 6:30 pm

Thank you very much. Since I am pretty noobish with scripts and stuff, am I supposed to append data from realtime.txt to a rolling log file if I want highchart to compile a 12 hours or 7 days graph for example? I am guessing that log file hast to be parsed and formatted to different type for highchart to understand it? Any chance I could see some example of your setup?

sfws
Posts: 462
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Customised mix of Fine Offset
Operating System: Tempermental Win. 10 PC
Location: UK

Re: Different time trends ?

Post by sfws » Tue 29 Jul 2014 9:37 pm

tempe wrote:I dont need realtime or interactive graphs, just pictures of charts would be awesome.
To set up a chart quickly, as I previously suggested see an example like http://jsfiddle.net/gh/get/jquery/1.9.1 ... ine-basic/ where you can experiment by replacing the figures in the series array with your own and see effect. That would give you a static picture, that could be included on your site like any other picture.

For a dynamic option you could use the 'recent tags' feature of Cumulus and select whatever time resolution suits you (e.g. once an hour would yield a graph with 12 points for a 12 hour period and a fairly detailed graph of 168 points for the 7 day period). In essence, copy the example above to a local file, then change the x axis array from months to 12 hours or 7 days, and in one series array replace the numbers by a series of Cumulus recent tags for temperature within the curly brackets ('<#RecentOutsideTemp h=1>', and similar with h=2, h=3, ... h=12 for the 12 hour graph or h=168 for the 7 day graph). Treat the resulting code as a Cumulus template, i.e. quote it as a local file on the screen accessed from configuration menu, internet item, files tab as per description in Wiki for customised pages and view the resulting web page after your next regular upload. It is not what you need (you will want to choose what graph to show on a rolling time basis) and I've probably confused you already by trying to describe it, but you will have grasped this is not as simple as perhaps you hope.
tempe wrote:Any chance I could see some example of your setup?
To see a sample of the sort of script involved just look at http://weather.wilmslowastro.com/script ... tGraphs.js i.e. the script behind the 'recent graphs' of Mark Crossley that Steve's earlier posting directed you to. There is no PHP in that script, and that is the sort of complexity you need. But you need to read Mark's postings to find out how he feeds in the values from his database into that script, and that might be hard to understand.

I took a look at my existing code, but I think it will confuse you. To write new code is not a few minutes task! If you allow me a few days to snatch the necessary coding time from my busy life, I will try to write some simple code for a 7-day graph and add it to the standard Cumulus trendsT.htm web page if I manage to get it working. Hopefully I can produce a script that is useful for you and subsequently makes sense for others. It won't be as comprehensive as Mark's and will only attempt to cover temperature, rainfall, and pressure without any fancy selections.
tempe wrote:am I supposed to append data from realtime.txt to a rolling log file if I want highchart to compile a 12 hours or 7 days graph for example? I am guessing that log file has to be parsed and formatted to different type for highchart to understand it?
NO, as you realise realtime.txt is a snapshot, it will not give you figures for different times. Trying to create a rolling log file from that is not wise simply because at the longer time period of 7 days you mention this could create a real mess if you attempted to plot every value at your real-time processing interval if that is relatively short. Anyway your earlier posting suggested
tempe wrote:I dont need realtime or interactive graphs
You are wise to stay clear of realtime complexity.
The standard Cumulus trend graphs I believe are at one minute resolution and, depending on selected options, could cover a few days, but I supect that resolution could create a 'messy' graph for longer periods such as 7 days. The graphs at http://weather.wilmslowastro.com/graphs_recent.php are I believe based on one minute resolution, but only show up to 2 days at a time although you select from the period up to 4 days ago. If you did a search of this forum, there are some previous discussions on sampling frequency, and I believe suggested that hourly resolution was probably best. Many others produce a database based perhaps on the Cumulus monthly logs and that logging interval. They interrogate that for past statistics, easily selecting different resolutions until they get the result they want.

tempe
Posts: 13
Joined: Mon 28 Jul 2014 1:17 pm
Weather Station: Vantage vue
Operating System: win 7
Location: Finland

Re: Different time trends ?

Post by tempe » Wed 30 Jul 2014 8:35 am

Thank you very much for taking time to explain that. Ill have to chew on that info for some time. Also really looking for your code example whenever you find time to make it, thanks in advance!

sfws
Posts: 462
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Customised mix of Fine Offset
Operating System: Tempermental Win. 10 PC
Location: UK

Re: Different time trends ?

Post by sfws » Fri 01 Aug 2014 10:19 am

I really struggled getting punctuation and brackets right to make this work, but see if this is any use to you.
EDIT 2: ATTACHMENT (version 1) REMOVED AS IT HAS AN ERROR (positioning of X axis tic marks) - PLEASE SEE A MORE RECENT POSTING FOR VERSION 3
EDIT 1: This attachment (version 1) only works if you use a full stop for separating the integer and decimal parts of your real numbers. If you use a comma for such separator please use the attachment version 2 in my later posting in this same thread.
It is a standard Cumulus template file so it needs to be 'processed' by Cumulus.
I have modified it with loads of extra script code. Best practice is to put such script in external files, but that requires some value passing between the file that Cumulus processes and the external script, and so for simplicity I have left all code in one file.
To make it work, you will need to add a few 'libraries' to whatever folder your HTML is uploaded to by Cumulus, or modify the appropriate 'src' attributes to tell the HTML where these libraries are to be found.
The first library is 'jQuery', that basically provides a shorthand for many common operations so that the person writing the code does not need to worry which browser version is being used, the jQuery will try all possible coding that a browser might respond to, silently failing on un-understood code. You can download the jQuery library each time it is needed, or download it once and store it on your server - see http://jquery.com/download/ for details of the various approaches. Most versions of Microsoft's Internet Explorer work differently to other browsers, so my code looks for
jquery-1.9.1.js
if obsolete IE is being used, but for
jquery-2.1.1.js
by default.
The next library is 'HighCharts', my code looks for
highcharts.js
see http://www.highcharts.com/download for a download that contains all the components, but again it can be grabbed as explained at that url.
I have also included an attempt to load
highcharts-exporting.js
that adds a symbol looking like three horizontal lines to the top right of the plot and from clicking that you can choose to print the graph, or convert the graph to a static picture as you requested.

Hopefully once you have assembled all that, it will run straight away with your own data, it picks up units from Cumulus, and auto-scales the plots. I have set it up so that it shows day boundaries that move across depending on the hour at the time when Cumulus processed the page. Cumulus needs to have been running for at least 12 hours to have all the 'recent tags' populated to give observations for the correct times.

I am not any sort of computer professional, attempting to do this was rather trial and error, but I learnt a few things that have helped me to improve the limited use I had of such charts previously. As I said before, I have steered clear of the complexity of the Mark Crossley example that Steve Loft directed you to, mine is a rough and ready demonstration of what can be achieved. All that I have done could probably be done better. I leave it to you to decide whether my attempt helps you to get whatever you want. I have added 3 buttons within the table: 'Cumulus' effectively reverts the web page back to its standard appearance by hiding the highchart image; 'Highchart' hides the standard cumulus large graph and the instruction about clicking the small charts; 'Both' restores the default when the page is first loaded of both being shown.

In terms of your original request, the recent tags only cover up to one week, so you could edit the arrays in my example for different resolutions (every 2 hours, every half-hour) and shorter overall periods (although I have designed mine to be zoomed in for shorter x periods) but not for periods greater than 7 days.
My own monthly example simply (for one chosen month) plots the highest and lowest values (of a selected criterion) in that month for each of the years I have on my dayfile.txt. So my code picks part of dayfile.txt, identifies the required field in each row, calculates the highest and lowest, and puts that into an array that the series uses. But of course it is a lot more complicated than that suggests.
Therefore I would suggest you set up 'XAMPP' on your pc so you have your own server with PHP and a database and you then have the flexibility that Mark employs to run queries and produce whatever you want. If you read some of his postings on the forum, he explains much of this.
Last edited by sfws on Mon 04 Aug 2014 5:41 pm, edited 2 times in total.

water01
Posts: 1486
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: WH1081
Operating System: Windows 7 64bit HP SP1
Location: Somewhere in the USA
Contact:

Re: Different time trends ?

Post by water01 » Fri 01 Aug 2014 11:19 am

I assume you modified weatherstyle.css as I notice there are additional divs etc.?

Do you have a demo of the page on your site?

sfws
Posts: 462
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Customised mix of Fine Offset
Operating System: Tempermental Win. 10 PC
Location: UK

Re: Different time trends ?

Post by sfws » Fri 01 Aug 2014 3:35 pm

water01 wrote:I assume you modified weatherstyle.css as I notice there are additional divs etc.?
The Cumulus original weatherstyle.css is used. The styles for 'body' and 'table' cover HTML code whether old or new. There are also some in-line styles in the original template and in the script I added. All I did was add new rows to the standard 1.9.4 'trendsT.htm' existing table (check that against the file in your own 'cumulus\web\originals' sub folder), no new 'div's. You could improve the look by defining new styles or changing the ones I put in the script, but all I'm doing is demonstrating that a script can produce a graph without using PHP as the originator of this thread requested and showing off just a few of the options.
water01 wrote:Do you have a demo of the page on your site?
Please read the whole thread, I have already said 'my site' is only on my pc and just a rarely used testing feature.

water01
Posts: 1486
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: WH1081
Operating System: Windows 7 64bit HP SP1
Location: Somewhere in the USA
Contact:

Re: Different time trends ?

Post by water01 » Fri 01 Aug 2014 6:06 pm

Please read the whole thread, I have already said 'my site' is only on my pc and just a rarely used testing feature.
My apologies I just read your interesting last post. Is the searchDayfile.js your code, and if it is do you have an example of the calling parameters or am I correct in thinking it is e.g. 01,04,2014,24.00,2400 for rollover at midnight?

Thanks for clearing up the styles will check the additional code again (it's called looking but not seeing :D ).

sfws
Posts: 462
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Customised mix of Fine Offset
Operating System: Tempermental Win. 10 PC
Location: UK

Re: Different time trends ?

Post by sfws » Fri 01 Aug 2014 8:57 pm

David
A final point on style, I could define the colours as an array in highcharts.plotOptions, and by using elements from that array match the plot lines, axes, and text; I tried that for the trendsT.htm example but took it out to make the code simpler.

Apart from http://sandaysoft.com/forum/viewtopic.php?f=18&t=8690 and http://sandaysoft.com/forum/viewtopic.php?f=14&t=8631 and a few Wiki articles, my attempts to teach myself coding are neither preserved nor shared. There are no polished masterpieces, intermittent experimenting with web pages or scripts is just one of the ways I take a break from other pressures and worries in my life. It happens that the data used is historic weather summaries ( some manual weather records, some from my Fine Offset station (I long ago decided the quality of data from that was poor and ceased my being online experiment), and some from Met.O. public 30-year summaries), sometimes transfered around on a memory stick, but it could be any large volume of statistics for my purposes.
'searchDayfile.js' was one such script of mine, the second reference above refers, it no longer exists for me having served its purpose of exploring different ways of coding. It used '<#rollovertime>' so that for you would pass in 'Midnight' not 24.

tempe
Posts: 13
Joined: Mon 28 Jul 2014 1:17 pm
Weather Station: Vantage vue
Operating System: win 7
Location: Finland

Re: Different time trends ?

Post by tempe » Sun 03 Aug 2014 11:52 am

Holy smoke, you took some time of yours to pull this, thanks a lot! So far I am getting strange graph, but I suspect it has something to do with update iterval, so what should it be and should graph perioid (as confed from cumulus display setting) be other than 168 hours? Ill link a pictures of the graph.
You do not have the required permissions to view the files attached to this post.

sfws
Posts: 462
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Customised mix of Fine Offset
Operating System: Tempermental Win. 10 PC
Location: UK

Re: Different time trends ?

Post by sfws » Sun 03 Aug 2014 5:45 pm

It is good for me to have some challenges that work out ok, many things have not gone my way this last week, and my previous couple of weeks were very stressed.

- your web page update interval is irrelevant, both the plots in the image you posted are snapshots at a particular moment.
- your 'detailed chart period' on the 'display settings' screen represents what you want to see on the standard Cumulus plot, remember this is plotting at one minute interval, so choosing 168 hours is making Cumulus generate 10,080 points on the lower plot! Do you really need that level of detail? Anyway, that interval is irrelevant to what you choose for the new plot. The new plot does not need to be on the same web page as the old one, but for development purposes there are advantages in comparing old and new.

Thanks for the image including new and old plots, it tells me a lot:
- the fact that the standard Cumulus temperature graph is relatively smooth shows you have cumulus running for a long period, so you have avoided the problem with the 'recent tags' needing 12 hours of Cumulus operation to become correctly populated.

EDIT: I originally said that in your posting just before this one, I had managed to match some of the temperature points to the ones shown by the yellow line in the plot before, but the plot was too 'busy' to do a closer match. My posting after your next posting reveals the problem, so my other comments do not apply and have been removed from here.

Can I suggest that you go into the code and look for

Code: Select all

               name: 'S.L. Pressure',
					data: pressureArray,
					showInLegend: true,
					visible: true,
					yAxis: 2,
					type: 'line',
Change the 'true' for 'visible' property into 'false', that will make the plot less cluttered for you by removing the pressure line.

If you click your mouse on the left of the new graph, hold in the left button and move to above the 5 day tic on the x axis and then release, you will zoom into the new graph and I suspect that smaller portion will then match closer the Cumulus drawn graphs shown below it on the page for you too.

Over to you. If you still have problems, you need to post your template file (with the recent history tags you are using) and the cumulus trend graph for pressure, so I (or someone else) can investigate further when other responsibilities permit.
Last edited by sfws on Mon 04 Aug 2014 11:32 am, edited 1 time in total.

tempe
Posts: 13
Joined: Mon 28 Jul 2014 1:17 pm
Weather Station: Vantage vue
Operating System: win 7
Location: Finland

Re: Different time trends ?

Post by tempe » Mon 04 Aug 2014 8:24 am

I didnt modify your script files or any other files for that matter. Below is new graph with no pressure curve. It seems to show every other temperature value wrong. I wonder why it show 14 days as everything is untouched.
You do not have the required permissions to view the files attached to this post.

Post Reply