From: Tobias Oetiker Date: Thu, 30 Apr 2015 08:14:15 +0000 (+0200) Subject: make dashed lines work again and add test to perl bindings X-Git-Tag: v1.5.3~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e238d663787e73a4e716fc9cece7de23304e049;p=thirdparty%2Frrdtool-1.x.git make dashed lines work again and add test to perl bindings --- diff --git a/bindings/perl-shared/t/base.t b/bindings/perl-shared/t/base.t index 7b6c016a..c30417b8 100755 --- a/bindings/perl-shared/t/base.t +++ b/bindings/perl-shared/t/base.t @@ -125,9 +125,9 @@ for (my $i=0;$i<$GRUNS;$i++) { "AREA:alpha#0022e9:Short", "STACK:beta#00b871:Demo Text", "LINE1:gamma#ff0000:Line 1", - "LINE2:delta#888800:Line 2", - "LINE3:calc#00ff44:Line 3", - "LINE3:epsilon#000000:Line 4", + "LINE2:delta#888800:Line 2:dashes=5,5", + "LINE3:calc#00ff44:Line 3:dashes=10", + "LINE3:epsilon#000000:Line 4:dashes", "HRULE:1500#ff8800:Horizontal Line at 1500", "PRINT:alpha:AVERAGE:Average Alpha %1.2lf", "PRINT:alpha:MIN:Min Alpha %1.2lf %s", diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index 4a227603..ae1423ff 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -253,6 +253,9 @@ int parseArguments(const char* origarg, parsedargs_t* pa) { } else if ((poscnt>0)&&(strcmp(field,"strftime")==0)) { key="strftime"; value="1"; + } else if ((poscnt>0)&&(strcmp(field,"dashes")==0)) { + key="dashes"; + value="5,5"; } else if ((poscnt>0)&&(strcmp(field,"valstrftime")==0)) { key="vformatter"; value="timestamp"; @@ -619,6 +622,7 @@ static graph_desc_t* newGraphDescription(image_desc_t *const im,enum gf_en gf,pa char* dashes=getKeyValueArgument("dashes",1,pa); /* if we got dashes */ if (dashes) { + gdp->dash = 1; gdp->offset = 0; /* count the , in dashes */ int cnt=0;for(char*t=dashes;(*t)&&(t=strchr(t,','));t++,cnt++) {;} @@ -647,7 +651,7 @@ static graph_desc_t* newGraphDescription(image_desc_t *const im,enum gf_en gf,pa char* dashoffset=getKeyValueArgument("dash-offset",1,pa); if (dashoffset) { char* x; - if (getDouble(dashes,&gdp->offset,&x)) { + if (getDouble(dashoffset,&gdp->offset,&x)) { rrd_set_error("Could not parse dash-offset: %s",dashoffset); return NULL; } } }