From 8e0f0172c60d3f207cc4dd61f996347fa2a63b09 Mon Sep 17 00:00:00 2001 From: oetiker Date: Thu, 4 Aug 2005 04:58:11 +0000 Subject: [PATCH] avoid drawing lines where two points are in the same spot. this mai be confusing libart git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@667 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_graph.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/rrd_graph.c b/src/rrd_graph.c index bb31289..2a13cb5 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -2472,31 +2472,35 @@ graph_paint(image_desc_t *im, char ***calcpr) if (im->gdes[i].col != 0x0){ /* GF_LINE and friend */ if(stack_gf == GF_LINE ){ + double last_y=0; node = NULL; - for(ii=1;iixsize;ii++){ + for(ii=1;iixsize;ii++){ if (isnan(im->gdes[i].p_data[ii]) || (im->slopemode==1 && isnan(im->gdes[i].p_data[ii-1]))){ node = NULL; continue; } if ( node == NULL ) { + last_y = ytr(im,im->gdes[i].p_data[ii]); if ( im->slopemode == 0 ){ node = gfx_new_line(im->canvas, - ii-1+im->xorigin,ytr(im,im->gdes[i].p_data[ii]), - ii+im->xorigin,ytr(im,im->gdes[i].p_data[ii]), + ii-1+im->xorigin,last_y, + ii+im->xorigin,last_y, im->gdes[i].linewidth, im->gdes[i].col); } else { node = gfx_new_line(im->canvas, ii-1+im->xorigin,ytr(im,im->gdes[i].p_data[ii-1]), - ii+im->xorigin,ytr(im,im->gdes[i].p_data[ii]), + ii+im->xorigin,last_y, im->gdes[i].linewidth, im->gdes[i].col); } } else { - if ( im->slopemode==0 ){ - gfx_add_point(node,ii-1+im->xorigin,ytr(im,im->gdes[i].p_data[ii])); + double new_y = ytr(im,im->gdes[i].p_data[ii]); + if ( im->slopemode==0 && new_y != last_y){ + gfx_add_point(node,ii-1+im->xorigin,new_y); + last_y = new_y; }; - gfx_add_point(node,ii+im->xorigin,ytr(im,im->gdes[i].p_data[ii])); + gfx_add_point(node,ii+im->xorigin,new_y); }; } -- 2.11.0