From 825b3f777c8b937bc8b11fb1333538a479183687 Mon Sep 17 00:00:00 2001 From: oetiker Date: Tue, 1 May 2007 16:19:47 +0000 Subject: [PATCH] added --alt-autoscale-min (see --alt-autoscale-max) -- Helge Oldach git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@1036 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/doc/rrdgraph.pod | 8 ++++++++ program/src/rrd_graph.c | 11 +++++++++++ program/src/rrd_graph.h | 15 ++++++++------- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/program/doc/rrdgraph.pod b/program/doc/rrdgraph.pod index 59d3ac4a..9060bd83 100644 --- a/program/doc/rrdgraph.pod +++ b/program/doc/rrdgraph.pod @@ -123,6 +123,14 @@ maximum y-axis from the actual minimum and maximum data values. Our example would display slightly less than C<260-0.001> to slightly more than C<260+0.001> (this feature was contributed by Sasha Mikheev). +[B<-J>|B<--alt-autoscale-min>] + +Where C<--alt-autoscale> will modify both the absolute maximum AND minimum +values, this option will only affect the minimum value. The maximum +value, if not defined on the command line, will be 0. This option can +be useful when graphing router traffic when the WAN line uses compression, +and thus the throughput may be higher than the WAN line speed. + [B<-M>|B<--alt-autoscale-max>] Where C<--alt-autoscale> will modify both the absolute maximum AND minimum diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 47c187ad..e7554ac6 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -399,6 +399,13 @@ expand_range(image_desc_t *im) im->minval -= adj; im->maxval += adj; } + else if(im->extra_flags & ALTAUTOSCALE_MIN) { + /* measure the amplitude of the function. Make sure that + graph boundaries are slightly lower than min vals + so we can see amplitude on the graph */ + adj = (im->maxval - im->minval) * 0.1; + im->minval -= adj; + } else if(im->extra_flags & ALTAUTOSCALE_MAX) { /* measure the amplitude of the function. Make sure that graph boundaries are slightly higher than max vals @@ -3223,6 +3230,7 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im) {"no-minor", no_argument, 0, 'I'}, {"slope-mode", no_argument, 0, 'E'}, {"alt-autoscale", no_argument, 0, 'A'}, + {"alt-autoscale-min", no_argument, 0, 'J'}, {"alt-autoscale-max", no_argument, 0, 'M'}, {"no-gridfit", no_argument, 0, 'N'}, {"units-exponent",required_argument, 0, 'X'}, @@ -3255,6 +3263,9 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im) break; case 'A': im->extra_flags |= ALTAUTOSCALE; + break; + case 'J': + im->extra_flags |= ALTAUTOSCALE_MIN; break; case 'M': im->extra_flags |= ALTAUTOSCALE_MAX; diff --git a/program/src/rrd_graph.h b/program/src/rrd_graph.h index e970d8b2..e83b442a 100644 --- a/program/src/rrd_graph.h +++ b/program/src/rrd_graph.h @@ -10,14 +10,15 @@ #define ALTYGRID 0x01 /* use alternative y grid algorithm */ #define ALTAUTOSCALE 0x02 /* use alternative algorithm to find lower and upper bounds */ -#define ALTAUTOSCALE_MAX 0x04 /* use alternative algorithm to find upper bounds */ -#define NOLEGEND 0x08 /* use no legend */ -#define NOMINOR 0x10 /* Turn off minor gridlines */ -#define ONLY_GRAPH 0x20 /* use only graph */ -#define FORCE_RULES_LEGEND 0x40 /* force printing of HRULE and VRULE legend */ +#define ALTAUTOSCALE_MIN 0x04 /* use alternative algorithm to find lower bounds */ +#define ALTAUTOSCALE_MAX 0x08 /* use alternative algorithm to find upper bounds */ +#define NOLEGEND 0x10 /* use no legend */ +#define NOMINOR 0x20 /* Turn off minor gridlines */ +#define ONLY_GRAPH 0x40 /* use only graph */ +#define FORCE_RULES_LEGEND 0x80 /* force printing of HRULE and VRULE legend */ -#define FORCE_UNITS 0x80 /* mask for all FORCE_UNITS_* flags */ -#define FORCE_UNITS_SI 0x80 /* force use of SI units in Y axis (no effect in linear graph, SI instead of E in log graph) */ +#define FORCE_UNITS 0x100 /* mask for all FORCE_UNITS_* flags */ +#define FORCE_UNITS_SI 0x100 /* force use of SI units in Y axis (no effect in linear graph, SI instead of E in log graph) */ enum tmt_en {TMT_SECOND=0,TMT_MINUTE,TMT_HOUR,TMT_DAY, TMT_WEEK,TMT_MONTH,TMT_YEAR}; -- 2.30.2