summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 90421d4)
raw | patch | inline | side by side (parent: 90421d4)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 3 Jan 2008 21:30:59 +0000 (21:30 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 3 Jan 2008 21:30:59 +0000 (21:30 +0000) |
program/doc/rrdgraph_examples.pod | patch | blob | history | |
program/doc/rrdgraph_graph.pod | patch | blob | history | |
program/src/rrd_graph_helper.c | patch | blob | history |
index 35301932a75e0d5be8a75735923ff468879bd505..664b965dc9f3f1e28f25b2496cd0e117b1a5ee5d 100644 (file)
=item *
default style: - - - - -
- LINE1:data#FF0000:"dashed line":DASHED
+ LINE1:data#FF0000:"dashed line":dashes
=item *
more fancy style with offset: - - --- - --- -
- LINE1:data#FF0000:"another dashed line":DASHED:dashes=15,5,5,10:dash-offset=10
+ LINE1:data#FF0000:"another dashed line":dashes=15,5,5,10:dash-offset=10
=head2 Time ranges
index bba50440115f9800bd5cf8b29feedc49d9133b4f..f40877cbae03d70ddd22b756f3f0054cf6697c07 100644 (file)
B<COMMENT>B<:>I<text>
-B<VRULE>B<:>I<time>B<#>I<color>[B<:>I<legend>][B<:DASHED>[B<:dashes=>I<n_on>[,I<n_off>[,I<n_on>,I<n_off>,[...]]]][B<:dash-offset=>I<offset>]]
+B<VRULE>B<:>I<time>B<#>I<color>[B<:>I<legend>][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
-B<HRULE>B<:>I<value>B<#>I<color>[B<:>I<legend>][B<:DASHED>[B<:dashes=>I<n_on>[,I<n_off>[,I<n_on>,I<n_off>,[...]]]][B<:dash-offset=>I<offset>]]
+B<HRULE>B<:>I<value>B<#>I<color>[B<:>I<legend>][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
-B<LINE>[I<width>]B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]][B<:DASHED>[B<:dashes=>I<n_on>[,I<n_off>[,I<n_on>,I<n_off>,[...]]]][B<:dash-offset=>I<offset>]]
+B<LINE>[I<width>]B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
B<AREA>B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]]
RRDtool 1.2 you have to escape colons in COMMENT text in the same way you
have to escape them in B<*PRINT> commands by writing B<'\:'>.
-=item B<VRULE>B<:>I<time>B<#>I<color>[B<:>I<legend>][B<:DASHED>[B<:dashes=>I<n_on>[,I<n_off>[,I<n_on>,I<n_off>,[...]]]][B<:dash-offset=>I<offset>]]
+=item B<VRULE>B<:>I<time>B<#>I<color>[B<:>I<legend>][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
Draw a vertical line at I<time>. Its color is composed from three
hexadecimal numbers specifying the rgb color components (00 is off, FF is
maximum) red, green and blue followed by an optional alpha. Optionally, a legend box and string is
printed in the legend section. I<time> may be a number or a variable
from a B<VDEF>. It is an error to use I<vname>s from B<DEF> or B<CDEF> here.
-Dashed lines can be drawn using the B<DASHED> modifier. See B<LINE> for more
+Dashed lines can be drawn using the B<dashes> modifier. See B<LINE> for more
details.
-=item B<HRULE>B<:>I<value>B<#>I<color>[B<:>I<legend>][B<:DASHED>[B<:dashes=>I<n_on>[,I<n_off>[,I<n_on>,I<n_off>,[...]]]][B<:dash-offset=>I<offset>]]
+=item B<HRULE>B<:>I<value>B<#>I<color>[B<:>I<legend>][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
Draw a horizontal line at I<value>. HRULE acts much like LINE except that
will have no effect on the scale of the graph. If a HRULE is outside the
graphing area it will just not be visible.
-=item B<LINE>[I<width>]B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]][B<:DASHED>[B<:dashes=>I<n_on>[,I<n_off>[,I<n_on>,I<n_off>,[...]]]][B<:dash-offset=>I<offset>]]
+=item B<LINE>[I<width>]B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
Draw a line of the specified width onto the graph. I<width> can be a
floating point number. If the color is not specified, the drawing is done
is stacked on top of the previous element which can be a B<LINE> or an
B<AREA>.
-The B<DASHED> modifier enables dashed line style. Without any further options
-a symmetric dashed line with a segment length of 5 pixels will be drawn.
-The dash pattern can be changed using the B<dashes> parameter, which can be
-followed by either one value or an even number (1, 2, 4, 6, ...) of positive
-values. Each value provides the length of alternate I<n_on> and I<n_off>
-portions of the stroke. The B<dash-offset> parameter specifies an I<offset>
-into the pattern at which the stroke begins.
+The B<dashes> modifier enables dashed line style. Without any further options
+a symmetric dashed line with a segment length of 5 pixels will be drawn. The
+dash pattern can be changed if the B<dashes=> parameter is followed by either
+one value or an even number (1, 2, 4, 6, ...) of positive values. Each value
+provides the length of alternate I<on_s> and I<off_s> portions of the
+stroke. The B<dash-offset> parameter specifies an I<offset> into the pattern
+at which the stroke begins.
When you do not specify a color, you cannot specify a legend. Should
you want to use STACK, use the "LINEx:<value>::STACK" form.
index d4b37329c4e92c3855f536c147b0526a40d1b107..cac3d7a6e56dda44977f280a8c0abc74b5559642 100644 (file)
dprintf("- not STACKing\n");
}
- dprintf("- still more, should be DASHED[:...]\n");
+ dprintf("- still more, should be dashes[=...]\n");
dprintf("- parsing '%s'\n", &line[*eaten]);
if (line[*eaten] != '\0') {
- // parse dash arguments here. Possible options:
- // DASHED
- // DASHED:dashes=n_on,n_off,n_on,n_off
- // DASHED:dashes=n_on,n_off,n_on,n_off:dash-offset=offset
- // start with DASHED
- j = scan_for_col(&line[*eaten], 6, tmpstr);
- if (!strcmp("DASHED", tmpstr)) {
+ /* parse dash arguments here. Possible options:
+ - dashes
+ - dashes=n_on[,n_off[,n_on,n_off]]
+ - dashes[=n_on[,n_off[,n_on,n_off]]]:dash-offset=offset
+ allowing 64 characters for definition of dash style */
+ j = scan_for_col(&line[*eaten], 64, tmpstr);
+ /* start with dashes */
+ if (strcmp(tmpstr, "dashes") == 0) {
+ /* if line was "dashes" or "dashes:dash-offset=xdashes="
+ tmpstr will be "dashes" */
dprintf("- found %s\n", tmpstr);
- // initialise all required variables we need for dashed lines
- // using default dash length of 5 pixels
+ /* initialise all required variables we need for dashed lines
+ using default dash length of 5 pixels */
gdp->dash = 1;
gdp->p_dashes = (double *) malloc(sizeof(double));
gdp->p_dashes[0] = 5;
gdp->ndash = 1;
gdp->offset = 0;
(*eaten) += j;
- if (line[*eaten] == ':')
- (*eaten) += 1;
- }
- if (line[*eaten] == '\0') {
- dprintf("- done parsing line\n");
- return 0;
- }
- // DASHED:dashes=n_on,n_off,n_on,n_off
- // allowing 64 characters for definition of dash style
- j = scan_for_col(&line[*eaten], 64, tmpstr);
- if (sscanf(tmpstr, "dashes=%s", tmpstr)) {
+ } else if (sscanf(tmpstr, "dashes=%s", tmpstr)) {
+ /* dashes=n_on[,n_off[,n_on,n_off]] */
char csv[64];
char *pch;
float dsh;
pch = strtok(NULL, ",");
count++;
}
- dprintf("- %d dash values found: ", count);
- gdp->ndash = count;
- if (gdp->p_dashes != NULL)
- free(gdp->p_dashes);
- gdp->p_dashes = (double *) malloc(sizeof(double) * count);
- pch = strtok(csv, ",");
- count = 0;
- while (pch != NULL) {
- if (sscanf(pch, "%f", &dsh)) {
- gdp->p_dashes[count] = (double) dsh;
- dprintf("%.1f ", gdp->p_dashes[count]);
- count++;
+ dprintf("- %d dash value(s) found: ", count);
+ if (count > 0) {
+ gdp->dash = 1;
+ gdp->ndash = count;
+ gdp->p_dashes = (double *) malloc(sizeof(double) * count);
+ pch = strtok(csv, ",");
+ count = 0;
+ while (pch != NULL) {
+ if (sscanf(pch, "%f", &dsh)) {
+ gdp->p_dashes[count] = (double) dsh;
+ dprintf("%.1f ", gdp->p_dashes[count]);
+ count++;
+ }
+ pch = strtok(NULL, ",");
}
- pch = strtok(NULL, ",");
- }
- dprintf("\n");
+ dprintf("\n");
+ } else
+ dprintf("- syntax error. No dash lengths found!\n");
(*eaten) += j;
- if (line[*eaten] == ':')
- (*eaten) += 1;
- }
- if (line[*eaten] == '\0') {
+ } else
+ dprintf("- error: expected dashes[=...], found %s\n", tmpstr);
+ if (line[*eaten] == ':') {
+ (*eaten) += 1;
+ } else if (line[*eaten] == '\0') {
dprintf("- done parsing line\n");
return 0;
}
- // DASHED:dashes=n_on,n_off,n_on,n_off:dash-offset=offset
- // allowing 16 characters for dash-offset=....
- // => 4 characters for the offset value
+ /* dashes[=n_on[,n_off[,n_on,n_off]]]:dash-offset=offset
+ allowing 16 characters for dash-offset=....
+ => 4 characters for the offset value */
j = scan_for_col(&line[*eaten], 16, tmpstr);
if (sscanf(tmpstr, "dash-offset=%lf", &gdp->offset)) {
- dprintf("- found %s\n", tmpstr);
+ dprintf("- found dash-offset=%.1f\n", gdp->offset);
gdp->dash = 1;
(*eaten) += j;
if (line[*eaten] == ':')