Page 1 of 1

Change default width and height of graph dashlets

Posted: Wed Oct 30, 2013 7:10 am
by WillemDH
Hello,

I've been looking for a way to change the default width and height of graphexplorer dashlets added to a dashboards. In the file grapexplorerinclude.js, I found the following:

Code: Select all

function graphexplorer_display_graph(host,service) {
	display_child_popup(300); 
	//prepare container for graph
	var content = "<div style='padding-top:10px; clear:both;' id='graphcontainer'><img src='/nagiosxi/images/throbber1.gif' /></div>";
	content += "<div id='scriptcontainer'></div>"; 
	
	$("#child_popup_container").height(300);
	$("#child_popup_container").width(650);
	$("#child_popup_layer").height(320);
	$("#child_popup_layer").width(680);
	$("#child_popup_layer").css('position','fixed');
	center_child_popup();
	
	set_child_popup_content(content); 

	var args ='height=250&witdh=600&type=timeline&host='+host+'&service='+service+'&div=graphcontainer'; 
	var url=base_url+'includes/components/graphexplorer/visApi.php?'+args;
	//alert(url);
	$("#scriptcontainer").load(base_url+'includes/components/graphexplorer/visApi.php?'+args,function() {

	}); 
	
	$('#close_child_popup_link').click(function() {
		set_child_popup_content(''); 
		$("#child_popup_layer").css('position','absolute');
		$("#child_popup_layer").width(300);
		$("#child_popup_container").width(300);
		center_child_popup();
	}); 

}
Any tips which code should be changed in order to change the default size of a graph when added to a dashboard from the grap explorer? I already made feature request for this some time ago, but if I would be able to change this myself in the graphexplorer component, this would be awesome. (as it's a pain to make a dasboard with multiple graphexplorer dashlets of the same size.

http://tracker.nagios.com/view.php?id=445

Thanks.

Willem

Re: Change default width and height of graph dashlets

Posted: Wed Oct 30, 2013 1:13 pm
by lmiltchev
This is not the file that you need to modify. Try modifying "/usr/local/nagiosxi/html/includes/components/graphexplorer/graphexplorer.inc.php" (lines 66, 67):

Code: Select all

$args[DASHLET_WIDTH]="500";
$args[DASHLET_HEIGHT]="450";
Hope this helps.

Re: Change default width and height of graph dashlets

Posted: Thu Oct 31, 2013 5:19 am
by WillemDH
Perfect. Exactly what we needed. Changed the default size to width 375 and height 175, which gives a perfect grid of 3 x 3 dashlets on a dashboard.

You can close http://tracker.nagios.com/view.php?id=445 by the way, although it would still be a very nice feature to be able to define the width and height through the XI gui for each dashlet seperately. So if you think this could one day get implemented, you can leave it open.. Your choice.. :)

Thanks again.

Willem

Re: Change default width and height of graph dashlets

Posted: Thu Oct 31, 2013 9:48 am
by slansing
We can keep it up just in case it is picked up and added in as standard functionality. :)