summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f1b93dc)
raw | patch | inline | side by side (parent: f1b93dc)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 16 May 2005 10:12:26 +0000 (10:12 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 16 May 2005 10:12:26 +0000 (10:12 +0000) |
and with transparend backgrounds.
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@563 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@563 a5681a0c-68f1-0310-ab6d-d61299d08faa
program/src/rrd_graph.c | patch | blob | history | |
program/src/rrd_graph_helper.c | patch | blob | history |
index 7db75901a3f0040e30cc5791cb9326d18c3157ed..95ebfe78bf3800c462c37ff58a765244f3bf1d8b 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
if ( im->gdes[i].gf != GF_PRINT &&
im->gdes[i].gf != GF_GPRINT &&
im->gdes[i].gf != GF_COMMENT) {
- int boxL, boxH, boxV;
+ int boxH, boxV;
- boxL = gfx_get_text_width(im->canvas, 0,
+ boxH = gfx_get_text_width(im->canvas, 0,
im->text_prop[TEXT_PROP_LEGEND].font,
im->text_prop[TEXT_PROP_LEGEND].size,
- im->tabwidth,"oo", 0);
- boxH = boxL / 1.9;
- boxV = boxH+1;
+ im->tabwidth,"o", 0) * 1.2;
+ boxV = boxH*1.1;
- /* make sure transparent colors show up all the same */
+ /* make sure transparent colors show up the same way as in the graph */
node = gfx_new_area(im->canvas,
- X0-1,Y0-boxV,
- X0-1,Y0+1,
- X0+boxL+0.5,Y0+1,
- im->graph_col[GRC_BACK]);
- gfx_add_point ( node, X0+boxL+0.5, Y0-boxV );
- node = gfx_new_area(im->canvas,
- X0-1,Y0-boxV,
- X0-1,Y0,
+ X0,Y0-boxV,
+ X0,Y0,
X0+boxH,Y0,
- im->graph_col[GRC_CANVAS]);
+ im->graph_col[GRC_BACK]);
gfx_add_point ( node, X0+boxH, Y0-boxV );
node = gfx_new_area(im->canvas,
- X0-1,Y0-boxV,
- X0-1,Y0,
+ X0,Y0-boxV,
+ X0,Y0,
X0+boxH,Y0,
im->gdes[i].col);
gfx_add_point ( node, X0+boxH, Y0-boxV );
node = gfx_new_line(im->canvas,
- X0-1,Y0-boxV,
- X0-1,Y0,
- 1,im->graph_col[GRC_FRAME]);
+ X0,Y0-boxV,
+ X0,Y0,
+ 1.0,im->graph_col[GRC_FRAME]);
gfx_add_point(node,X0+boxH,Y0);
gfx_add_point(node,X0+boxH,Y0-boxV);
gfx_close_path(node);
index a12591b6acb926d416e08347bf9db17b9b6f4c8f..388dadfc3e58d85d09aa3e2cdf0876d342752bb7 100644 (file)
@@ -295,6 +295,21 @@ rrd_parse_PVHLAST(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc
int i,j,k;
int colorfound=0;
char tmpstr[MAX_VNAME_LEN + 10]; /* vname#RRGGBBAA\0 */
+ static int spacecnt = 0;
+
+ if (spacecnt == 0) {
+ float one_space = gfx_get_text_width(im->canvas, 0,
+ im->text_prop[TEXT_PROP_LEGEND].font,
+ im->text_prop[TEXT_PROP_LEGEND].size,
+ im->tabwidth," ", 0) / 4.0;
+ float target_space = gfx_get_text_width(im->canvas, 0,
+ im->text_prop[TEXT_PROP_LEGEND].font,
+ im->text_prop[TEXT_PROP_LEGEND].size,
+ im->tabwidth,"oo", 0);
+ spacecnt = target_space / one_space;
+ dprintf("- spacecnt: %i onespace: %f targspace: %f\n",spacecnt,one_space,target_space);
+ }
+
dprintf("- parsing '%s'\n",&line[*eaten]);
@@ -399,16 +414,15 @@ rrd_parse_PVHLAST(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc
dprintf("- examining '%s'\n",&line[*eaten]);
if (linecp[*eaten] != '\0' && linecp[*eaten] != ':') {
- /* If the legend is not empty, it has to be prefixed with "m ". This then gets
+ int spi;
+ /* If the legend is not empty, it has to be prefixed with spacecnt ' ' characters. This then gets
* replaced by the color box later on. */
- (*eaten)--;
- linecp[*eaten]='o';
- (*eaten)--;
- linecp[*eaten]='o';
+ for (spi=0;spi<spacecnt && (*eaten) > 1;spi++){
+ linecp[--(*eaten)]=' ';
+ }
}
if (rrd_parse_legend(linecp, eaten, gdp)) err=1;
-
free(linecp);
if (err) return 1;