Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

HighCharts - lose the plot gracefully

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

HighCharts - lose the plot gracefully

Post by beteljuice »

graphfixPro.js V1.1 - English bug fix - 6th Feb 2021

Following quite a few people wanting to modify the highcharts as provided (cumuluscharts.js), the beteljuice has created a 'plug-in' for the HTML page that holds them.

This script allows you to completely remove or change the default visibility of plots
created by cumuluscharts.js.

It can now rename / translate your titles / labels / tooltips etc.

Wherever your holding page is generated is and this javascript file is where you need to edit.

It will NOT remove graphs (edit your buttons for that).
You cannot remove the 'first' plot in any graph (the beteljuice seriously can't be bothered to write code for that !)

Here's the script and a README
graphfixPro.zip

Usage:

Edit graphfixPro.js as per the README, some examples below and upload to same directory as 'charts' page.
At the bottom of the page containing the charts ADD below all the charts scripts

<script src="graphfixPro.js"></script>

Important:
Then in the same page edit ALL the 'buttons' for the graphs
so that they end with rollout();

<input name="btnTemp" class="button" style=tabindex="1" type="button" value="Temperature" onclick="changeGraph('temp'); rollout();">

EXAMPLES:-

Names are case sensitive and ENGLISH.
GRAPH name is the 'main' title at the top of the graphs.
PLOT names are the individual traces.
NB: "Temperature" GRAPH has a "Temperature" PLOT !

Code: Select all

// beteljuice plot REMOVER - cannot remove first plot of graph !!
// format: ['graph name', 'plot to lose 1', 'plot to lose 2'], NB: NO comma after last (or only) entry !

example: single graph, single plot
lose_plot = [
				["Temperature", "Inside"]
			];
			
example: single graph, muliple plots
lose_plot = [
				["Temperature", "Dew Point", "Wind Chill", "Heat Index"]
			];
			
example: multiple graphs, muliple plots
lose_plot = [
				["Temperature", "Dew Point", "Wind Chill", "Heat Index"],
				["Relative Humidity", "Indoor Humidity"]
			];


// ** A little bit more involved **
// beteljuice plot default VISIBILY - CAN hide first plot of graph 
// format: ['graph name', ['plot to show / hide 1', true],
//						  ['plot to show / hide 2', false] NB: NO comma after last plot !
//			], NB: NO comma after last graph !

example: single graph, single plot
display_plot = [
					["Temperature", ["Temperature", false]]
				];

example: single graph, multiple plots
display_plot = [
					["Temperature", ["Temperature", false], ["Wind Chill", true]]
				];

example: multiple graphs, multiple plots
display_plot = [
					["Temperature", ["Temperature", false], ["Wind Chill", true]],
					["Relative Humidity", ["Indoor Humidity", false]]
				];
That's it ....

Information on translating is in the README and the file itself.

If you've already modified the distribution copy of the cumuluscharts.js ... you're on your own :o
You do not have the required permissions to view the files attached to this post.
Last edited by beteljuice on Sat 06 Feb 2021 7:10 pm, edited 12 times in total.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
HansR
Posts: 5871
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: HighCharts - lose the plot gracefully

Post by HansR »

Ah, nice. I'm gonna try this.... Thnx. :) :clap:
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
User avatar
HansR
Posts: 5871
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: HighCharts - lose the plot gracefully

Post by HansR »

@beteljuice: so I implemented the thing and it works... partially. It works in the sense that the series are deactivated (for Temperature). But as a user (as viewer of the webpage) I can still enable the series and view them.

For the series 'Relative Humidity' it does not seem to work at all (the title is: title: {text: 'Relative Humidity'} ) and the series is name: 'Indoor Humidity'). so I entered in the wxgraphs.php file:

Code: Select all

lose_plot = [
			["Temperature", "Inside", "Apparent"]
			["Relative Humidity", "Indoor Humidity"]
		];
and it still shows the indoor humidity.

So, in summary I have the following observations:
1) The series do not really disappear, they are made invisible (but the user can make it still visible)
2) It does not work for Relative Humidity (maybe the two word title?)
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: HighCharts - lose the plot gracefully

Post by beteljuice »

1) The series do not really disappear, they are made invisible (but the user can make it still visible)
If they are invisible (and no legend) how can they be activated ?

but ... that may be because ...
2) It does not work for Relative Humidity (maybe the two word title?)

Code: Select all

lose_plot = [
			["Temperature", "Inside", "Apparent"]
			["Relative Humidity", "Indoor Humidity"]
		];
read again:

Code: Select all

// format: ['graph name', 'plot to lose 1', 'plot to lose 2'], NB: NO comma after last entry !
lose_plot = [
/* example
			["What", "something else"],
*/
			["Temperature", "Inside", "Apparent"]
		];
You need a comma after your first (Temperature) array ;)
Last edited by beteljuice on Fri 29 Nov 2019 10:02 am, edited 1 time in total.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
HansR
Posts: 5871
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: HighCharts - lose the plot gracefully

Post by HansR »

Ah, temperature now indeed works. :oops:
But alas, not the humidity graph. :roll:

And I did check and double checked spelling (title text and naming of the series), actually I used cut and paste but inside humidity stays visible.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: HighCharts - lose the plot gracefully

Post by beteljuice »

Ah ... logic error by the beteljuice :oops:

Fixed in first post ...
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
HansR
Posts: 5871
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: HighCharts - lose the plot gracefully

Post by HansR »

Ah... OK. Works great now.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: HighCharts - lose the plot gracefully

Post by beteljuice »

V2 - IMPORTANT bug fix - 27 Feb 2020

Errors through dynamic data loading discovered / resolved.

Please use NEW version (In first post)
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: HighCharts - lose the plot gracefully

Post by beteljuice »

Version 2.1 27 Feb 2020

:groan: Should've known it was too good to be true ...
Needed the mutation observer to fire up on new graph load as well as initial chart load.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Extra facility ?

Post by beteljuice »

No ... Not a bug fix :lol:

Comment has been made that a user not only wants to REMOVE some plots, but also change default VISIBILITY.

I'm pretty confident I can expand the script to accommodate this if there is an interest ...
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
HansR
Posts: 5871
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: HighCharts - lose the plot gracefully

Post by HansR »

Yes, that would be nice.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: HighCharts - lose the plot gracefully

Post by beteljuice »

V4 -Improved functionality - 29th Feb 2020

The script now allows you to completely remove or change the default visibility of plots
created by cumuluscharts.js.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
HansR
Posts: 5871
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: HighCharts - lose the plot gracefully

Post by HansR »

Works great. 8-) :!:
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

lose the plot gracefully - UPDATE

Post by beteljuice »

Hello Dear Readers ..

IE11 bug fix
NEW - can do translations !

New graphfixPro.js file from first post ...
Image
......................Imagine, what you will KNOW tomorrow !
iandrews
Posts: 139
Joined: Sun 03 Jan 2010 10:57 am
Weather Station: Davis Pro2
Operating System: Windows 2012R2
Location: London

Re: HighCharts - lose the plot gracefully

Post by iandrews »

Have just set this up on the latest version of CumulusMX (v3.9.7 (3107)) and have a small (well 2) issues.

All seems to be working (e.g I have hidden the Inside Temperature), however the "Wind Dir." chart now doesn't display, there is just white space where the chart should be. I haven't done anything in graphfixPro.js to do with the Wind Dir. chart, and if I remove the <script src="graphfixPro.js"></script> line from the trends.htm file it works again.

Also, if I go to the trends page from another page the Temperature chart (which displays by default) still has the Inside Temperature shown, however if I then click on the Temperature button the Inside Temperature is then not shown. Is there a way to have the Temperature chart display as expected as soon as the page loads without having to click on the button.
Post Reply