Author Topic: HighCharts - lose the plot gracefully  (Read 1472 times)

0 Members and 1 Guest are viewing this topic.

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
HighCharts - lose the plot gracefully
« 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 !

Code: [Select]
// 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:
« Last Edit: March 22, 2020, 09:17:33 AM by the beteljuice »
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: HighCharts - lose the plot gracefully
« Reply #1 on: February 27, 2020, 07:07:54 AM »
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 !!
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: HighCharts - lose the plot gracefully
« Reply #2 on: February 27, 2020, 04:33:38 PM »
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.
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: HighCharts - lose the plot gracefully
« Reply #3 on: February 28, 2020, 11:19:53 AM »
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 ...
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: HighCharts - lose the plot gracefully
« Reply #4 on: February 29, 2020, 07:37:03 PM »
V4 -Improved functionality - 29th Feb 2020

The script nowallows you to completely remove or change the default visibility of plots created by cumuluscharts.js.
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
lose the plot gracefully - NEW with translations
« Reply #5 on: March 21, 2020, 06:17:51 PM »
Hello Dear Readers ..

IE11 bug fix
NEW - can do translations !

New graphfixPro.js file from first post ...
Imagine what you will KNOW tomorrow !

 

anything