summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5e5df75)
raw | patch | inline | side by side (parent: 5e5df75)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 1 Apr 2006 15:36:05 +0000 (15:36 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 1 Apr 2006 15:36:05 +0000 (15:36 +0000) |
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@782 a5681a0c-68f1-0310-ab6d-d61299d08faa
CONTRIBUTORS | patch | blob | history | |
doc/rrdgraph.pod | patch | blob | history | |
src/rrd_graph.c | patch | blob | history | |
src/rrd_graph.h | patch | blob | history | |
src/rrd_tool.c | patch | blob | history |
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 79c79ba5f508181a2fb4e9622fa6c665fc11883c..d7eb4b0523d4461420c16bef128f881e66c00998 100644 (file)
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
Radoslaw Karas <rkaras with tyndall.ie>
Rainer Bawidamann <Rainer.Bawidamann with informatik.uni-ulm.de>
Roman Hoogant <rhoogant with ee.ethz.ch>
+Ronan Mullally <ronan in 4L.ie>
Russ Wright <rwwright with home.com>
Sean Summers <sean with Fenstermaker.com> (RPM .spec)
Selena M Brewington <smbrewin with ichips.intel.com> add_ds
diff --git a/doc/rrdgraph.pod b/doc/rrdgraph.pod
index b5e92b8aadfbb7721f4a1e70b39c27eb4d27c322..da2b4e6f29ac5d7e5fb42a76dcdf61bbdb6d82f1 100644 (file)
--- a/doc/rrdgraph.pod
+++ b/doc/rrdgraph.pod
should be set to 1024 so that one Kb is 1024 byte. For traffic
measurement, 1 kb/s is 1000 b/s.
+[B<-W>|B<--watermark> I<string>]
+
+Adds the given string as a watermark, horizontally centred, at the bottom
+of the graph.
+
=item Data and variables
B<DEF:>I<vname>B<=>I<rrdfile>B<:>I<ds-name>B<:>I<CF>[B<:step=>I<step>][B<:start=>I<time>][B<:end=>I<time>]
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index 6fc877c1b952211631e9d796a18cb979787b06eb..a71a174a5001cc931a0013fed39a93e6d8302bc4 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
5.5, im->tabwidth, 270,
GFX_H_RIGHT, GFX_V_TOP,
"RRDTOOL / TOBI OETIKER");
+
+ /* graph watermark */
+ if(im->watermark[0] != '\0') {
+ gfx_new_text( im->canvas,
+ im->ximg/2, im->yimg-6,
+ ( im->graph_col[GRC_FONT] & 0xffffff00 ) | 0x00000044,
+ im->text_prop[TEXT_PROP_AXIS].font,
+ 5.5, im->tabwidth, 0,
+ GFX_H_CENTER, GFX_V_BOTTOM,
+ im->watermark);
+ }
/* graph labels */
if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) {
** |v+--+-------------------------------+--------+
** | |..............legends......................|
** +-+-------------------------------------------+
+ ** | watermark |
+ ** +---------------------------------------------+
*/
int Xvertical=0,
Ytitle =0,
#if 0
Xlegend =0, Ylegend =0,
#endif
- Xspacing =15, Yspacing =15;
+ Xspacing =15, Yspacing =15,
+
+ Ywatermark =4;
if (im->extra_flags & ONLY_GRAPH) {
im->xorigin =0;
xtr(im,0);
/* The vertical size is interesting... we need to compare
- ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend} with Yvertical
- ** however we need to know {Ytitle+Ymain+Yxlabel} in order to
- ** start even thinking about Ylegend.
+ ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend, Ywatermark} with
+ ** Yvertical however we need to know {Ytitle+Ymain+Yxlabel}
+ ** in order to start even thinking about Ylegend or Ywatermark.
**
** Do it in three portions: First calculate the inner part,
- ** then do the legend, then adjust the total height of the img.
+ ** then do the legend, then adjust the total height of the img,
+ ** adding space for a watermark if one exists;
*/
/* reserve space for main and/or pie */
*/
if(leg_place(im)==-1)
return -1;
-
+
+ if (im->watermark[0] != '\0') {
+ im->yimg += Ywatermark;
+ }
#if 0
if (Xlegend > im->ximg) {
im->step = 0;
im->ylegend[0] = '\0';
im->title[0] = '\0';
+ im->watermark[0] = '\0';
im->minval = DNAN;
im->maxval = DNAN;
im->unitsexponent= 9999;
{"tabwidth", required_argument, 0, 'T'},
{"font-render-mode", required_argument, 0, 'R'},
{"font-smoothing-threshold", required_argument, 0, 'B'},
+ {"watermark", required_argument, 0, 'W'},
{"alt-y-mrtg", no_argument, 0, 1000}, /* this has no effect it is just here to save old apps from crashing when they use it */
{0,0,0,0}};
int option_index = 0;
int col_start,col_end;
opt = getopt_long(argc, argv,
- "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:",
+ "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:W:",
long_options, &option_index);
if (opt == EOF)
im->canvas->font_aa_threshold = atof(optarg);
break;
+ case 'W':
+ strncpy(im->watermark,optarg,100);
+ im->watermark[99]='\0';
+ break;
+
case '?':
if (optopt != 0)
rrd_set_error("unknown option '%c'", optopt);
diff --git a/src/rrd_graph.h b/src/rrd_graph.h
index d0482b592f9b7329f914258bb559fe38cbb6715c..dca277f717c85e4a0e36e9fed52619a6c6d8d218 100644 (file)
--- a/src/rrd_graph.h
+++ b/src/rrd_graph.h
text_prop_t text_prop[TEXT_PROP_LAST]; /* text properties */
char ylegend[200]; /* legend along the yaxis */
char title[200]; /* title for graph */
+ char watermark[100]; /* watermark for graph */
int draw_x_grid; /* no x-grid at all */
int draw_y_grid; /* no x-grid at all */
double grid_dash_on, grid_dash_off;
diff --git a/src/rrd_tool.c b/src/rrd_tool.c
index 23344312868e6810c08047b2774f5ecde562c3b9..dd3f0f9197e1b266bfdbfad6a9103c91c39a68bc 100644 (file)
--- a/src/rrd_tool.c
+++ b/src/rrd_tool.c
"\t\t[-f|--imginfo printfstr]\n"
"\t\t[-a|--imgformat PNG]\n"
"\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n"
- "\t\t[DEF:vname=rrd:ds-name:CF]\n"
- "\t\t[CDEF:vname=rpn-expression]\n";
+ "\t\t[-W|--watermark string]\n"
+ "\t\t[DEF:vname=rrd:ds-name:CF]\n";
char help_graph3[] =
+ "\t\t[CDEF:vname=rpn-expression]\n"
"\t\t[VDEF:vdefname=rpn-expression]\n"
"\t\t[PRINT:vdefname:format]\n"
"\t\t[GPRINT:vdefname:format]\n"