summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 24b863c)
raw | patch | inline | side by side (parent: 24b863c)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 21 Mar 2004 11:40:49 +0000 (11:40 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 21 Mar 2004 11:40:49 +0000 (11:40 +0000) |
program/doc/rrdgraph.src | patch | blob | history | |
program/src/rrd_graph.c | patch | blob | history | |
program/src/rrd_graph.h | patch | blob | history | |
program/src/rrd_tool.c | patch | blob | history |
index 0f8489d798ca676c6ef69cde853e98d3c30aa6ad..8bd8a1ee810673ca394b60a031f793a5f58fc254 100644 (file)
--- a/program/doc/rrdgraph.src
+++ b/program/doc/rrdgraph.src
=head1 DESCRIPTION
-The B<graph> function of B<RRDtool> is used to represent the
+The B<graph> function of B<RRDtool> is used to present the
data from an B<RRD> to a human viewer. Its main purpose is to
create a nice graphical representation but it can also generate
a numerical report.
B<[-w|--width E<lt>pixelsE<gt>]>
B<[-h|--heigth E<lt>pixelsE<gt>]>
+B<[-j|--only-graph]>
The width and height of the B<canvas> (the part of the graph with
the actual lines and such). Defaults are 400 pixels by 100 pixels.
+If you sepcify the B<--only-graph> and set the hight < 32 pixels you will
+get a tiny graph image to use as an icon in a potential overview. All
+labeling will be stripped off the graph.
+
Z<>
=item Limits
index afcbc0147072fd6faf981b307f130c14b0e9e101..36c80548dee3308e4c077d895594a06aad45be77 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
char prt_fctn; /*special printfunctions */
int *legspace;
- if( !(im->extra_flags & NOLEGEND) ) {
+ if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) {
if ((legspace = malloc(im->gdes_c*sizeof(int)))==NULL){
rrd_set_error("malloc for legspace");
return -1;
im->title);
/* graph labels */
- if( !(im->extra_flags & NOLEGEND) ) {
+ if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) {
for(i=0;i<im->gdes_c;i++){
if(im->gdes[i].legend[0] =='\0')
continue;
#if 0
Xlegend =0, Ylegend =0,
#endif
- Xspacing =10, Yspacing =10;
+ Xspacing =10, Yspacing =10;
- if (im->ylegend[0] != '\0') {
- Xvertical = im->text_prop[TEXT_PROP_LEGEND].size *2;
- Yvertical = im->text_prop[TEXT_PROP_LEGEND].size * (strlen(im->ylegend)+1);
+ if (im->extra_flags & ONLY_GRAPH) {
+ if ( im->ysize > 32 ) {
+ rrd_set_error("height > 32 is not possible with --only-graph option");
+ return -1;
+ }
+ Xspacing =0;
+ Yspacing =0;
+ } else {
+ if (im->ylegend[0] != '\0') {
+ Xvertical = im->text_prop[TEXT_PROP_LEGEND].size *2;
+ Yvertical = im->text_prop[TEXT_PROP_LEGEND].size * (strlen(im->ylegend)+1);
+ }
}
if (im->title[0] != '\0') {
** forget about it at all; the legend will have to fit in the
** size already allocated.
*/
- im->ximg = Xylabel + Xmain + Xpie + Xspacing;
+ im->ximg = Xmain;
+
+ if ( !(im->extra_flags & ONLY_GRAPH) ) {
+ im->ximg = Xylabel + Xmain + Xpie + Xspacing;
+ }
+
if (Xmain) im->ximg += Xspacing;
if (Xpie) im->ximg += Xspacing;
- im->xorigin = Xspacing + Xylabel;
+
+ if (im->extra_flags & ONLY_GRAPH) {
+ im->xorigin = 0;
+ } else {
+ im->xorigin = Xspacing + Xylabel;
+ }
+
if (Xtitle > im->ximg) im->ximg = Xtitle;
if (Xvertical) {
im->ximg += Xvertical;
*/
/* reserve space for main and/or pie */
- im->yimg = Ymain + Yxlabel;
+
+ if (im->extra_flags & ONLY_GRAPH) {
+ im->yimg = Ymain;
+ } else {
+ im->yimg = Ymain + Yxlabel;
+ }
+
if (im->yimg < Ypie) im->yimg = Ypie;
- im->yorigin = im->yimg - Yxlabel;
+
+ if (im->extra_flags & ONLY_GRAPH) {
+ im->yorigin = im->yimg;
+ } else {
+ im->yorigin = im->yimg - Yxlabel;
+ }
+
/* reserve space for the title *or* some padding above the graph */
if (Ytitle) {
im->yimg += Ytitle;
if (!calc_horizontal_grid(im))
return -1;
+
if (im->gridfit)
apply_gridfit(im);
+
/**************************************************************
*** Calculating sizes and locations became a bit confusing ***
*** so I moved this into a separate function. ***
areazero = im->minval;
if (im->maxval < 0.0)
areazero = im->maxval;
-
- axis_paint(im);
+ if( !(im->extra_flags & ONLY_GRAPH) )
+ axis_paint(im);
}
if (piechart) {
im->draw_y_grid=0;
}
/* grid_paint also does the text */
- grid_paint(im);
+ if( !(im->extra_flags & ONLY_GRAPH) )
+ grid_paint(im);
/* the RULES are the last thing to paint ... */
for(i=0;i<im->gdes_c;i++){
{"lazy", no_argument, 0, 'z'},
{"zoom", required_argument, 0, 'm'},
{"no-legend", no_argument, 0, 'g'},
+ {"only-graph", no_argument, 0, 'j'},
{"alt-y-grid", no_argument, 0, 'Y'},
{"no-minor", no_argument, 0, 'I'},
{"alt-autoscale", no_argument, 0, 'A'},
opt = getopt_long(argc, argv,
- "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgYAMX:S:N",
+ "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjYAMX:S:N",
long_options, &option_index);
if (opt == EOF)
case 'M':
im->extra_flags |= ALTAUTOSCALE_MAX;
break;
+ case 'j':
+ im->extra_flags |= ONLY_GRAPH;
+ break;
case 'g':
im->extra_flags |= NOLEGEND;
break;
index 09c2f1d7fd0b302e06f8cff4da0f0fdcd348e1cb..0339e0b4e410bfa2a9918bb49e32c729e27f54f3 100644 (file)
--- a/program/src/rrd_graph.h
+++ b/program/src/rrd_graph.h
#define ALTAUTOSCALE_MAX 0x04 /* use alternative algorithm to find upper bounds */
#define NOLEGEND 0x08 /* use no legend */
#define NOMINOR 0x20 /* Turn off minor gridlines */
+#define ONLY_GRAPH 0x24 /* use only graph */
enum tmt_en {TMT_SECOND=0,TMT_MINUTE,TMT_HOUR,TMT_DAY,
diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c
index d23094f8d12bfb703f3a0c2342d8d009faea8f48..2cad365e32374d034cc8a224b5ff47eb02002e80 100644 (file)
--- a/program/src/rrd_tool.c
+++ b/program/src/rrd_tool.c
"\t\t[-u|--upper-limit value] [-z|--lazy]\n"
"\t\t[-l|--lower-limit value] [-r|--rigid]\n"
"\t\t[-g|--no-legend]\n"
+ "\t\t[-j|--only-graph]\n"
"\t\t[--font FONTTAG:size:font]\n"
"\t\t[--zoom factor]\n"
"\t\t[--alt-autoscale]\n"