Change default width and height of graph dashlets

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Change default width and height of graph dashlets

Post 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
Nagios XI 5.8.1
https://outsideit.net
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Change default width and height of graph dashlets

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Change default width and height of graph dashlets

Post 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
Nagios XI 5.8.1
https://outsideit.net
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Change default width and height of graph dashlets

Post by slansing »

We can keep it up just in case it is picked up and added in as standard functionality. :)
Locked