[rrd-users] Can this kind of chart be drawn with RRDTool ?

Koaps koaps at yahoo.com
Fri Feb 12 02:03:31 CET 2010


you can try using php gd to merge the images.

You would have to make the background image in GD or have several premade backgrounds for the different times of day and you pick one based on when the script is run.

When you run rrdtool graph you set the canvas to transparent white:

--color CANVAS#FFFFFFFF


Then you can merge it with the background.


<?php
$background = imagecreatefromjpeg("bg.jpg");
$insert = imagecreatefrompng("fg.png");

// Either a color at a specific point on the image
// imagecolortransparent($insert,imagecolorat($insert,0,0));
// or a specific color (the color I used is magenta, #ff00ff)
imagecolortransparent($insert,imagecolorexact($insert,255,255,255));

$insert_x = imagesx($insert);
$insert_y = imagesy($insert);

// As said above, you can't use imagecopy (bug?)
imagecopymerge($background,$insert,0,0,0,0,$insert_x,$insert_y,100);

// imagejpeg or imagepng doesn't matter here
imagejpeg($background,"new.jpg",100);
?>


You can get an image like this....

http://koaps.angrypacket.com/new.jpg

-k


--- On Thu, 2/11/10, A Darren Dunham <ddunham at taos.com> wrote:

> From: A Darren Dunham <ddunham at taos.com>
> Subject: Re: [rrd-users] Can this kind of chart be drawn with RRDTool ?
> To: rrd-users at lists.oetiker.ch
> Date: Thursday, February 11, 2010, 3:51 PM
> On Thu, Feb 11, 2010 at 08:27:51PM
> +1100, Jean-Yves Avenard wrote:
> > I'd like to draw something like this:
> > http://i46.tinypic.com/5bd3et.png
> > 
> > Pretty much, it's a solar power chart ; the backround
> would show the
> > ephemeris of the Sun ; dark when it's night time,
> gradually lighter
> > and then a different colour.. Pretty much using
> gradients.
> > The grid would be drawn on top of it...
> 
> I don't know how to do that exactly (grid on top
> especially), but you
> could do an AREA graph with the color you want from bottom
> to top, and
> then give it some transparency so the grid shows through.
> 
> You could even draw the sun by creating a hemispherical
> data set and
> graphing that in AREA with yellow.
> 
> -- 
> Darren
> 
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
> 


      



More information about the rrd-users mailing list