summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6f83b8c)
raw | patch | inline | side by side (parent: 6f83b8c)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 20 Jan 2010 19:47:04 +0000 (19:47 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 20 Jan 2010 19:47:04 +0000 (19:47 +0000) |
NEWS | patch | blob | history | |
doc/rrdgraph.pod | patch | blob | history | |
src/rrd_graph.c | patch | blob | history | |
src/rrd_graph.h | patch | blob | history |
index 3b13f7f3f5ad6282e5bd8184095f4a4a860851bb..bac4d122f5355cb68899a4dc4c0d99582227148b 100644 (file)
--- a/NEWS
+++ b/NEWS
* new graph option --border to set the 3d border width
by Bernhard Reutner-Fischer
-* draw different color swats depending on the type of line drawn in the
- graph by Loïc Tortay
+* draw different color markers (enable with --dynamic-labels) depending on the
+ type of element in the graph by Loïc Tortay
for more detail see the CHANGES file.
diff --git a/doc/rrdgraph.pod b/doc/rrdgraph.pod
index 9f0dcf40a690a9a8ecd954c4a551e0d9927557af..e40b046bec1a809b4c1d1c3058e8a22e97749e49 100644 (file)
--- a/doc/rrdgraph.pod
+++ b/doc/rrdgraph.pod
disables the border. See C<SHADEA> and C<SHADEB> above for setting the border
color.
+[B<--dynamic-labels>]
+
+Pick the shape of the color marker next to the label according to the element drawn on the graph.
+
[B<--zoom> I<factor>]
Zoom the graphics by the given amount. The factor must be E<gt> 0
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index 6a3962690f1274a92bbac5a305a2e3d86aba4c94..258eb528dc3ea0e1af1d045a54ef17f7d557998a 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
boxV = boxH;
/* shift the box up a bit */
Y0 -= boxV * 0.4;
- if (im->gdes[i].gf == GF_HRULE) { /* [-] */
+
+ if (im->dynamic_labels && im->gdes[i].gf == GF_HRULE) { /* [-] */
cairo_save(im->cr);
cairo_new_path(im->cr);
cairo_set_line_width(im->cr, 1.0);
X0 + boxH, Y0 - boxV / 2,
1.0, im->gdes[i].col);
gfx_close_path(im);
- } else if (im->gdes[i].gf == GF_VRULE) { /* [|] */
+ } else if (im->dynamic_labels && im->gdes[i].gf == GF_VRULE) { /* [|] */
cairo_save(im->cr);
cairo_new_path(im->cr);
cairo_set_line_width(im->cr, 1.0);
X0 + boxH / 2, Y0 - boxV,
1.0, im->gdes[i].col);
gfx_close_path(im);
- } else if (im->gdes[i].gf == GF_LINE) { /* [/] */
+ } else if (im->dynamic_labels && im->gdes[i].gf == GF_LINE) { /* [/] */
cairo_save(im->cr);
cairo_new_path(im->cr);
cairo_set_line_width(im->cr, im->gdes[i].linewidth);
im->draw_x_grid = 1;
im->draw_y_grid = 1;
im->draw_3d_border = 2;
+ im->dynamic_labels = 0;
im->extra_flags = 0;
im->font_options = cairo_font_options_create();
im->forceleftspace = 0;
{ "legend-direction", required_argument, 0, 1006},
{ "border", required_argument, 0, 1007},
{ "grid-dash", required_argument, 0, 1008},
+ { "dynamic-labels", no_argument, 0, 1009},
{ 0, 0, 0, 0}
};
/* *INDENT-ON* */
rrd_set_error("expected grid-dash format float:float");
return;
}
- break;
+ break;
+ case 1009: /* enable dynamic labels */
+ im->dynamic_labels = 1;
+ break;
case 1002: /* right y axis */
if(sscanf(optarg,
diff --git a/src/rrd_graph.h b/src/rrd_graph.h
index 7a85f340689ccd9173b9c30be2ab784a9d43fe79..8e28f63fec38544333b0e92e5b5596ab0d3116bb 100644 (file)
--- a/src/rrd_graph.h
+++ b/src/rrd_graph.h
int draw_x_grid; /* no x-grid at all */
int draw_y_grid; /* no y-grid at all */
unsigned int draw_3d_border; /* size of border in pixels, 0 for off */
+ unsigned int dynamic_labels; /* pick the label shape according to the line drawn */
double grid_dash_on, grid_dash_off;
xlab_t xlab_user; /* user defined labeling for xaxis */
char xlab_form[210]; /* format for the label on the xaxis */