1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
=cut
TITLE=dataimage.cgi
DESCRIPTION=generates images from live data
KEYWORDS=dataimage.cgi
DOCTOP=index
DOCPREV=availability-report.cgi
DOCNEXT=datapage.cgi
=pod
=head1 dataimage.cgi - create images driven by live data
=head2 Usage:
<IMG SRC="@@HTMLURL@@/dataimage.cgi?imagename">
=head2 Description:
C<Dataimage.cgi> reads an image definition from
C<@@INSTALLDIR@@/datapage/imagename.image>. Some of the commands are in common
with L<datapage.cgi|datapage-cgi.html#common_commands> and are documented
there:
oid, rrd, status, eval, debug, macro, macroend and *EOD*
These retrieve and manipulate data. There are also commands to create
images:
image, colordef, color, linewidth, line, rectangle, circle,
fill, font, text, out, flow
=head1 Image Commands
=head2 image
The image command has two formats. The first looks like:
image WIDTH HEIGHT
This creates a blank image of the size specified. Sometimes you'll want a
background for the image, and you can use the second form to specify
a file to read for the background:
image BGFILE
This will create the new image the same size as the one in C<BGFILE>,
by reading C<BGFILE> and using its contents as the background. N.B., the
image must be a PNG graphic.
The C<image> command also defines a few colors (see C<colordef> below):
C<black>, C<white> and C<transparent>, sets the current color to
C<black>, fills the image with C<white> and sets the C<linewidth> to 1.
=head2 colordef
[It can also be spelled C<colourdef>.]
This defines a new colour and names it. The command looks like:
colordef COLORNAME RED GREEN BLUE
where C<RED>, C<GREEN> and C<BLUE> specify the level of each of those colours
to be mixed to define the colour referred to in the script as C<COLORNAME>.
=head2 color
[It can also be spelled C<colour>.]
This sets the current colour, to be used by those commands that don't specify
a colour. It is used as simply:
color COLORNAME
=head2 linewidth
This sets the width of lines. It isn't honoured by all other commands,
unfortunately, but so far this hasn't been a problem for me. It looks like:
linewidth WIDTH
=head2 line
This just draws a line in the current C<color> and C<linewidth>:
line X1 Y1 X2 Y2
=head2 rectangle
This is a way to draw a rectangle, without useing C<line> 4 times:
rectangle X1 Y1 X2 Y2 [filled]
The co-ordinates (C<X1>, C<Y1>) and (C<X2>, C<Y2>) define oposite corners
of the rectangle. If the keyword C<filled> is added to the end, the
rectangle will be filled with the current colour as well.
=head2 circle
Here you get a circle:
circle X Y RADIUS [filled]
The circle will be centered on (C<X>, C<Y>) with a radius of C<RADIUS>.
If the keyword C<filled> is added to the end, the
circle will be filled with the current colour as well.
=head2 fill
This command permits you to fill arbitrary regions:
fill X Y [COLORNAME]
The C<COLORNAME> is optional.
=head2 text
The C<text> command sets text into the image, for labelling things:
text X Y TEXT
=head2 font
This changes the font for the C<text> command:
font (giant|large|mediumbold|medium|small|tiny)
=head2 out
This permits the script to output additional information to an auxiliary
file. I added this for doing image-maps automatically, which can be
automatically loaded by a L<datapage.cgi|datapage-cgi> web-page.
The syntax is:
out TEXT
=head2 flow
This draws a strange double-headed, bi-coloured arrow. Think of it as two
half arrows, split lengthwise, one in each direction. The colour and width
of each half arrow indicates the flow in that direction. I use it for
indicating network traffic flow, which usually isn't the same in both
directions. It looks like:
flow X1 Y1 X2 Y2 INFLOW OUTFLOW
The co-ordinates (C<X1>, C<Y1>), (C<X2>, C<Y2>) indicate the ends of the
flow. C<INFLOW> and C<OUTFLOW> indicate the level in each direction,
relative to (C<X1>, C<Y1>).
|