WXforum.net
Weather Software => Cumulus => Topic started by: the beteljuice on November 25, 2019, 04:21:19 PM
-
graphfixPro.js V1 - IE11 bug fix and can now do translations ! - 21st March 2020
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
[ You are not allowed to view attachments ]
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="graphfix.js"></script>
Then in the same page edit ALL the 'buttons' 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 !
// 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 ....
See the README and the file itself for how to do translations.
If you've already modified the distribution copy of the cumuluscharts.js ... you're on your own :roll:
-
V2 - IMPORTANT BUG FIX 27 Feb 2020
Errors caused by dynamic data loading discovered / fixed. :oops:
Anyone using this should use the above revised code !!
-
Version 2.1 27 Feb 2020
](*,) 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.
-
No ... Not a bug fix :-)
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 ...
-
V4 -Improved functionality - 29th Feb 2020
The script nowallows you to completely remove or change the default visibility of plots created by cumuluscharts.js.
-
Hello Dear Readers ..
IE11 bug fix
NEW - can do translations !
New graphfixPro.js file from first post ...