]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
make dashed lines work again and add test to perl bindings
authorTobias Oetiker <tobi@oetiker.ch>
Thu, 30 Apr 2015 08:14:15 +0000 (10:14 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Thu, 30 Apr 2015 08:14:15 +0000 (10:14 +0200)
bindings/perl-shared/t/base.t
src/rrd_graph_helper.c

index 7b6c016aba44d848cbc47bbc08a7dc82c9c17250..c30417b8ced07845751fbe579159dfe647e40b74 100755 (executable)
@@ -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",
index 4a2276032ce2754009ffb479cf7552ef7a6e8167..ae1423ffc6f1144501fa480e712fa91a0ab80d84 100644 (file)
@@ -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; }
     }
   }