From: Florian Forster Date: Wed, 14 Jul 2010 15:55:38 +0000 (+0200) Subject: src/graph_def.c: Make it possible for one "DEF" to handle multiple files correctly. X-Git-Tag: v4.0.0~88 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=593828eb6109b2f0ee43f090d64a252f0ff92774;p=collection4.git src/graph_def.c: Make it possible for one "DEF" to handle multiple files correctly. --- diff --git a/src/graph_def.c b/src/graph_def.c index 1f78ddd..9aba1ce 100644 --- a/src/graph_def.c +++ b/src/graph_def.c @@ -182,11 +182,11 @@ graph_def_t *def_create (graph_config_t *cfg, graph_ident_t *ident, /* {{{ */ return (NULL); } - ret->color = get_random_color (); + ret->color = UINT32_MAX; ret->next = NULL; ret->select = ident_copy_with_selector (selector, ident, - IDENT_FLAG_REPLACE_ALL); + IDENT_FLAG_REPLACE_ANY); if (ret->select == NULL) { ident_destroy (selector); @@ -316,6 +316,7 @@ int def_get_rrdargs (graph_def_t *def, graph_ident_t *ident, /* {{{ */ int index; char draw_def[64]; char legend[256]; + uint32_t color; if ((def == NULL) || (ident == NULL) || (args == NULL)) return (EINVAL); @@ -346,6 +347,10 @@ int def_get_rrdargs (graph_def_t *def, graph_ident_t *ident, /* {{{ */ } } + color = def->color; + if (color > 0x00ffffff) + color = get_random_color (); + index = args->index; args->index++; @@ -386,7 +391,7 @@ int def_get_rrdargs (graph_def_t *def, graph_ident_t *ident, /* {{{ */ if (def->area) array_prepend_format (args->areas, "AREA:%s#%06"PRIx32, - draw_def, fade_color (def->color)); + draw_def, fade_color (color)); /* Graph part */ array_prepend_format (args->lines, "GPRINT:vdef_%04i_lst:%s last\\l", @@ -398,7 +403,7 @@ int def_get_rrdargs (graph_def_t *def, graph_ident_t *ident, /* {{{ */ array_prepend_format (args->lines, "GPRINT:vdef_%04i_min:%s min,", index, (def->format != NULL) ? def->format : "%6.2lf"); array_prepend_format (args->lines, "LINE1:%s#%06"PRIx32":%s", - draw_def, def->color, legend); + draw_def, color, legend); free (file);