Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support
It is currently Wed Apr 23, 2014 10:18 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: PATCH: graph_image.php and gadgets
PostPosted: Mon May 23, 2011 2:17 pm 
Offline
User avatar

Joined: Mon Mar 09, 2009 12:32 pm
Posts: 15
Location: Fargo, ND
Hi everyone,

I'm not sure where the best place to submit a patch is -- mailing list, or somewhere on the forum?

Anyway, I've been working on pulling in images directly from graph_image.php for use in some outside "web gadgets." I didn't need a title in the image since my web app already does this, and it was a real pain to try and shoehorn the resolution of the full image into a specific size of a div tag. (Since RRD is generating a graph based on the resolution of the data canvas, not the entire image with legend and stuff) If the resolution is off, the browser attempts to do a quick & dirty resize of the image which results in some nasty looking artifacts in the graphs.

I've added these options to graph_image.php:

graph_notitle=Y -- disable generation of the title in the graph. (Translates to the --title option on rrdgraph)

graph_full_size=Y -- the graph_width and graph_height resolutions specify the FINAL dimensions of the image, including title, legend, and rules. (Translates to the --full-size-mode option to rrdgraph)

This patch was created against Cacti 0.8.7g.

Thanks for your consideration into the official source! It would be handy to do upgrades and not have to manually apply my patch to new versions. ;-)


Attachments:
File comment: Patch to graph_image.php and lib/rrd.php
cals_gadget.patch [2.35 KiB]
Downloaded 84 times

_________________
--Cal
Top
 Profile  
 
 Post subject: Re: PATCH: graph_image.php and gadgets
PostPosted: Mon May 23, 2011 2:32 pm 
Offline
User avatar

Joined: Mon Mar 09, 2009 12:32 pm
Posts: 15
Location: Fargo, ND
I can show a little example of this. Here's what it looked like before:

Attachment:
gadget_before.jpeg
gadget_before.jpeg [ 23.24 KiB | Viewed 1839 times ]


Some graphs look worse than others, but you can see artifacts in the title and legend text.

With my patch, and creating an image that matches the exact dimensions of the div around it, it's nice and clear:

Attachment:
gadget_after.jpeg
gadget_after.jpeg [ 28.93 KiB | Viewed 1839 times ]


Much cleaner looking! :D

_________________
--Cal


Top
 Profile  
 
 Post subject: Re: PATCH: graph_image.php and gadgets
PostPosted: Tue May 24, 2011 12:26 am 
Offline
Cacti Guru User

Joined: Thu Aug 05, 2010 2:04 am
Posts: 1573
Location: Japan
Nice work! :D

Especially,
calh wrote:
graph_full_size=Y -- the graph_width and graph_height resolutions specify the FINAL dimensions of the image, including title, legend, and rules. (Translates to the --full-size-mode option to rrdgraph)

thanks to this, I can place graphs like as "tile", regardless of plot area size.
(Notice: "--full-size-mode" option is available since RRDtool 1.3)

Here is a sample for my 24-port switch.
Image
(I added some "--color" options to 'rrd.php', and using customized graph template)


Top
 Profile  
 
 Post subject: Re: PATCH: graph_image.php and gadgets
PostPosted: Tue May 24, 2011 9:18 am 
Offline
User avatar

Joined: Mon Mar 09, 2009 12:32 pm
Posts: 15
Location: Fargo, ND
Thanks!

I didn't realize that option was only available after RRD 1.3... I suppose a version check could be added, but then again, most new Cacti installs should be using the latest RRD tool as well.

_________________
--Cal


Top
 Profile  
 
 Post subject: Re: PATCH: graph_image.php and gadgets
PostPosted: Tue Jun 14, 2011 9:48 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
Many of this options are now implemented in TRUNK. I'm eagerly awaiting an alpha of this as I don't want to backport all those options. Many, many code changes ...
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: PATCH: graph_image.php and gadgets
PostPosted: Tue Jun 14, 2011 9:57 am 
Offline
User avatar

Joined: Mon Mar 09, 2009 12:32 pm
Posts: 15
Location: Fargo, ND
Oh did you already code this stuff, it just hadn't been released yet? Or did you add my patch to subversion?

I'll also be on the pulse of another Cacti release, as there are quite a few things I'm looking forward to for features / fixes.

Thank you!

_________________
--Cal


Top
 Profile  
 
 Post subject: Re: PATCH: graph_image.php and gadgets
PostPosted: Tue Jun 14, 2011 2:38 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
I didn't check your patch, to be honest. But I implemented virtually _every_ rrdtool graph option available with rrdtool 1.4.4. This has been done more than 6 months ago ...
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group