[rrd-developers] Re: proposed TICK bug fix for negative values
Tobias Oetiker
oetiker at ee.ethz.ch
Wed Feb 1 21:57:13 MET 2006
Hi Dave,
try the following patch
Index: rrd_graph.c
===================================================================
--- rrd_graph.c (revision 746)
+++ rrd_graph.c (working copy)
@@ -2468,13 +2468,28 @@
if (!isnan(im->gdes[i].p_data[ii]) &&
im->gdes[i].p_data[ii] > 0.0)
{
+ double ya = ytr(im,0);
+ double yb = ytr(im,0) - (im -> gdes[i].yrule * im -> ysize);
+
+ if (ya > im->yorigin)
+ ya = im->yorigin;
+ if (ya < im->yorigin - im->ysize)
+ ya = im->yorigin - im->ysize;
+
+ if (yb > im->yorigin)
+ yb = im->yorigin;
+ if (yb < im->yorigin - im->ysize)
+ yb = im->yorigin - im->ysize;
+
/* generate a tick */
- gfx_new_line(im->canvas, im -> xorigin + ii,
- im -> yorigin - (im -> gdes[i].yrule * im -> ysize),
- im -> xorigin + ii,
- im -> yorigin,
- 1.0,
- im -> gdes[i].col );
+ if (ya != yb)
+ gfx_new_line(im->canvas, im -> xorigin + ii,
+ ya,
+ im -> xorigin + ii,
+ yb,
+ 1.0,
+ im -> gdes[i].col );
+
}
}
break;
cheers
tobi
Jan 24 Dave Plonka wrote:
> Hi folks,
>
> Please note the 5% TICK marks along the bottom of the attached sample
> graph, which shows Holt-Winters threshold failures for outbound and
> inbound traffic (with confidence bands) simumtaneously...
> (I did this graph with RRGrapher.)
>
> It surprised me that TICKs are drawn atop the lower boundary of the
> graph region instead of on the x-axis (zero value on y-axis).
>
> Also, if you graph a negative tick value, the ticks are actually
> plotted outside the graph region (overwriting the legends, etc.). It
> seems to me to be a bug that negative TICK values get plotted outside
> the graph region.
>
> I propose that it would be better, and more useful, if the TICKs were
> plotted as a percentage between the x-axis (zero on y-axis) and the top
> of the graph for positive values and as a percentage between the x-axis
> (zero on y-axis) and the top of the graph for negative values. I don't
> think this will break existing graphs that only plot positive ticks
> which is presumably the typical case. Since the negative values
> incorrectly plot outside the graph region, I'd like to fix that.
>
> Does anyone disagree that such a change would be a good way to fix this
> bug, and simultanously add a bit of functionality for these sort of
> outbound/inbound graphs?
>
> BTW, I haven't written a patch... I suspect it might be non-trivial for
> someone not familiar with that part of the code. If someone is willing
> to write it please let us know.
>
> Dave
>
>
--
______ __ _
/_ __/_ / / (_) Oetiker @ ISG.EE, ETL F24.2, ETH, CH-8092 Zurich
/ // _ \/ _ \/ / System Manager, Time Lord, Coder, Designer, Coach
/_/ \.__/_.__/_/ http://people.ee.ethz.ch/oetiker +41(0)44-632-5286
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://lists.ee.ethz.ch/rrd-developers
WebAdmin http://lists.ee.ethz.ch/lsg2.cgi
More information about the rrd-developers
mailing list