Realtime graph window not resizing
Realtime graph popout windows rely on the realtimePopout variable being true in order execute setRealtimeWindowSize().
realtimePopout is set twice as far as I can see, once in graph_realtime.php (var realtimePopout = true;) and again in realtime.js (var realtimePopout = false;)
Setting the realtime.js one to true fixes the resizing problem, but I'm not sure if the original intention was that the resize only happens when the window is a smaller than than the #rtfilter and #rimage elements?
If so, this one liner should only resize if the window is too small:
realtimePopout = $('#rtfilter').outerHeight() + 60 + $('#rimage').outerHeight() + 30 > window.innerHeight || $('#rimage').outerWidth() + 40 > window.innerWidth ? true : false;
If the window is too small then it will expand to fit the graph, if you manually resize it larger then it'll return false and keep the window size.
I put it in the .done handler after the graph is loaded and it seems to work fine:
$.getJSON(url)
.done(function(data) {
if ($('#rimage').length) {
$('#rimage').attr('src', 'data:image/png;base64,'+data.data);
} else {
$('#image').html('<img id="rimage" class="realtimeimage" src="data:image/png;base64,'+data.data+'"/>');
}
realtimePopout = $('#rtfilter').outerHeight() + 60 + $('#rimage').outerHeight() + 30 > window.innerHeight || $('#rimage').outerWidth() + 40 > window.innerWidth ? true : false;
if (realtimePopout) {
setRealtimeWindowSize();
...
To Reproduce
Steps to reproduce the behavior:
Start a realtime graph where the graph template size is sufficiently large that it won't fit in the default popped window size. I use 700x300 for example.
Expected behavior
The popup window should resize to fit the #rtfilter and #rimage elements
Desktop (please complete the following information)
Realtime graph window not resizing
Realtime graph popout windows rely on the
realtimePopoutvariable being true in order executesetRealtimeWindowSize().realtimePopout is set twice as far as I can see, once in graph_realtime.php (
var realtimePopout = true;) and again in realtime.js (var realtimePopout = false;)Setting the realtime.js one to true fixes the resizing problem, but I'm not sure if the original intention was that the resize only happens when the window is a smaller than than the #rtfilter and #rimage elements?
If so, this one liner should only resize if the window is too small:
realtimePopout = $('#rtfilter').outerHeight() + 60 + $('#rimage').outerHeight() + 30 > window.innerHeight || $('#rimage').outerWidth() + 40 > window.innerWidth ? true : false;If the window is too small then it will expand to fit the graph, if you manually resize it larger then it'll return false and keep the window size.
I put it in the .done handler after the graph is loaded and it seems to work fine:
To Reproduce
Steps to reproduce the behavior:
Start a realtime graph where the graph template size is sufficiently large that it won't fit in the default popped window size. I use 700x300 for example.
Expected behavior
The popup window should resize to fit the #rtfilter and #rimage elements
Desktop (please complete the following information)
OS: Windows 10
Browser Chrome
Version 81.0.4044.138 (Official Build) (64-bit)