you want to use B<STACK>, use the "LINEx:<value>::STACK" form.
-=head3 B<AREA>B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>][B<:skipscale>]]
+=head3 B<AREA>B<:>I<value>[B<#>I<color>[B<#>I<color2>]][B<:>[I<legend>][B<:STACK>][B<:skipscale>][B<:gradheight=>I<y>]
See B<LINE>, however the area between the x-axis and the line will
be filled.
-=head3 B<GRAD>B<:>I<value>[B<#>I<color1>[B<#>I<color2>B<:>I<height>][B<:>[I<legend>][B<:STACK>]]
+If color2 is specified, the area will be filled with a gradient.
-Similar to B<AREA>, except the area between the line and the x-axis will contain a gradient from color1 to color2.
+The I<gradheight> parameter can create three different behaviors. If
+I<gradheight> > 0, then the gradient is a fixed height, starting at the line
+going down. If I<gradheight> < 0, then the gradient starts at a fixed height
+above the x-axis, going down to the x-axis. If I<height> == 0, then the
+gradient goes from the line to x-axis.
-The I<height> parameter can create three different behaviors. If I<height> > 0, then the gradient is a fixed height, starting at the line going down. If I<height> < 0, then the gradient starts at fixed height above the x-axis, going down to the x-axis. If I<height> == 0, then the gradient goes from the line to x-axis.
-
-If not present, I<color2> defaults to #00000000 and I<height> defaults to 50.
+The default value for I<gradheight> is 50.
=head3 B<TICK>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<fraction>[B<:>I<legend>]]
conv_if(VRULE, GF_VRULE);
conv_if(LINE, GF_LINE);
conv_if(AREA, GF_AREA);
- conv_if(GRAD, GF_GRAD);
conv_if(STACK, GF_STACK);
conv_if(TICK, GF_TICK);
conv_if(TEXTALIGN, GF_TEXTALIGN);
if ((im->gdes[i].gf == GF_LINE)
|| (im->gdes[i].gf == GF_AREA)
|| (im->gdes[i].gf == GF_TICK)
- || (im->gdes[i].gf == GF_GRAD)
) {
if ((im->gdes[i].p_data = (rrd_value_t*)malloc((im->xsize + 1)
* sizeof(rrd_value_t))) == NULL) {
switch (im->gdes[ii].gf) {
case GF_LINE:
case GF_AREA:
- case GF_GRAD:
case GF_TICK:
if (!im->gdes[ii].stack)
paintval = 0.0;
break;
case GF_LINE:
case GF_AREA:
- case GF_GRAD:
case GF_TICK:
graphelement = 1;
break;
}
break;
case GF_LINE:
- case GF_AREA:
- case GF_GRAD: {
+ case GF_AREA: {
rrd_value_t diffval = im->maxval - im->minval;
rrd_value_t maxlimit = im->maxval + 9 * diffval;
rrd_value_t minlimit = im->minval - 9 * diffval;
} else {
double lastx=0;
double lasty=0;
+ int isArea = isnan(im->gdes[i].col2.red);
int idxI = -1;
double *foreY =
(double *) malloc(sizeof(double) * im->xsize * 2);
[cntI + 1], 4)) {
cntI++;
}
- if (im->gdes[i].gf != GF_GRAD) {
+ if (isArea) {
gfx_new_area(im,
backX[0], backY[0],
foreX[0], foreY[0],
+ 1], 4)) {
cntI++;
}
- if (im->gdes[i].gf != GF_GRAD) {
+ if (isArea) {
gfx_add_point(im, foreX[cntI], foreY[cntI]);
} else {
gfx_add_rect_fadey(im,
lasty = foreY[cntI];
}
}
- if (im->gdes[i].gf != GF_GRAD) {
+ if (isArea) {
gfx_add_point(im, backX[idxI], backY[idxI]);
} else {
gfx_add_rect_fadey(im,
- 1], 4)) {
idxI--;
}
- if (im->gdes[i].gf != GF_GRAD) {
+ if (isArea) {
gfx_add_point(im, backX[idxI], backY[idxI]);
} else {
gfx_add_rect_fadey(im,
}
idxI = -1;
drawem = 0;
- if (im->gdes[i].gf != GF_GRAD)
+ if (isArea)
gfx_close_path(im);
}
if (drawem != 0) {
}
lastgdes = &(im->gdes[i]);
break;
- } /* GF_AREA, GF_LINE, GF_GRAD */
+ } /* GF_AREA, GF_LINE*/
case GF_STACK:
rrd_set_error
("STACK should already be turned into LINE or AREA here");
im->gdes[im->gdes_c - 1].col.green = 0.0;
im->gdes[im->gdes_c - 1].col.blue = 0.0;
im->gdes[im->gdes_c - 1].col.alpha = 0.0;
- im->gdes[im->gdes_c - 1].col2.red = 0.0;
- im->gdes[im->gdes_c - 1].col2.green = 0.0;
- im->gdes[im->gdes_c - 1].col2.blue = 0.0;
+ im->gdes[im->gdes_c - 1].col2.red = DNAN;
+ im->gdes[im->gdes_c - 1].col2.green = DNAN;
+ im->gdes[im->gdes_c - 1].col2.blue = DNAN;
im->gdes[im->gdes_c - 1].col2.alpha = 0.0;
im->gdes[im->gdes_c - 1].gradheight = 50.0;
im->gdes[im->gdes_c - 1].legend[0] = '\0';
#define GRIDWIDTH 0.4
enum gf_en { GF_PRINT = 0, GF_GPRINT, GF_COMMENT, GF_HRULE, GF_VRULE, GF_LINE,
- GF_AREA,GF_GRAD, GF_STACK, GF_TICK, GF_TEXTALIGN,
+ GF_AREA,GF_STACK, GF_TICK, GF_TEXTALIGN,
GF_DEF, GF_CDEF, GF_VDEF, GF_SHIFT,
GF_XPORT, GF_XAXIS, GF_YAXIS
};
#define PARSE_SKIPSCALE (PARSE_FIELD1|(1ULL<<16))
#define PARSE_DASHES (PARSE_FIELD1|(1ULL<<20))
-#define PARSE_HEIGHT (PARSE_FIELD1|(1ULL<<21))
+#define PARSE_GRADHEIGHT (PARSE_FIELD1|(1ULL<<21))
#define PARSE_FORMAT (PARSE_FIELD1|(1ULL<<22))
#define PARSE_STRFTIMEVFMT (PARSE_FIELD1|(1ULL<<23))
#define PARSE_FRACTION (PARSE_FIELD1|(1ULL<<24))
dprintfparsed("got linewidth: %s (%g)\n",t,linewidth);
gdp->linewidth=linewidth;
}
- if (bitscmp(PARSE_HEIGHT)) {
- double height=0;
+ if (bitscmp(PARSE_GRADHEIGHT)) {
+ double gradheight=0;
char *t,*x;
- if ((t=getKeyValueArgument("height",1,pa))&&(*t!=0)) {
- if (getDouble(t,&height,&x)) {
- rrd_set_error("Bad height: %s",t); return NULL;
+ if ((t=getKeyValueArgument("gradheight",1,pa))&&(*t!=0)) {
+ if (getDouble(t,&gradheight,&x)) {
+ rrd_set_error("Bad gradheight: %s",t); return NULL;
}
- dprintfparsed("got height: %s (%g)\n",t,height);
- gdp->gradheight=height;
+ dprintfparsed("got gradheight: %s (%g)\n",t,gradheight);
+ gdp->gradheight=gradheight;
}
}
if (bitscmp(PARSE_STEP)) {
}
}
- /* and set some of those late assignments to accomodate the legacy parser*/
+ /* and set some of those late assignments to accommodate the legacy parser*/
/* first split vname into color */
if (vname) {
/* check for color */
|PARSE_SKIPSCALE
|PARSE_XAXIS
|PARSE_YAXIS
- |PARSE_HEIGHT
+ |PARSE_GRADHEIGHT
);
if (!gdp) { return 1;}
case GF_SHIFT: r=parse_shift(gf,&pa,im); break;
case GF_XPORT: r=parse_xport(gf,&pa,im); break;
/* unsupported types right now */
- case GF_GRAD:
- rrd_set_error("GRAD unsupported - use AREA instead");
- break;
- }
+ }
/* handle the return error case */
if (r) { freeParsedArguments(&pa); return;}
/* check for unprocessed keyvalue args */