From: Florian Forster Date: Tue, 15 Jun 2010 17:12:47 +0000 (+0200) Subject: graph.c: Implement the "ShowZero" config option. X-Git-Tag: v4.0.0~236^2~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8fbf7a365ef3984e093ba392c2354ce8093fd61d;p=collection4.git graph.c: Implement the "ShowZero" config option. --- diff --git a/graph.c b/graph.c index 154af77..1a8f327 100644 --- a/graph.c +++ b/graph.c @@ -28,6 +28,7 @@ struct graph_config_s /* {{{ */ char *title; char *vertical_label; + _Bool show_zero; graph_def_t *defs; @@ -154,6 +155,8 @@ int graph_config_add (const oconfig_item_t *ci) /* {{{ */ graph_config_get_string (child, &cfg->title); else if (strcasecmp ("VerticalLabel", child->key) == 0) graph_config_get_string (child, &cfg->vertical_label); + else if (strcasecmp ("ShowZero", child->key) == 0) + graph_config_get_bool (child, &cfg->show_zero); else if (strcasecmp ("DEF", child->key) == 0) def_config (cfg, child); } /* for */ @@ -284,6 +287,12 @@ int graph_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst, /* {{{ */ array_append (args, cfg->vertical_label); } + if (cfg->show_zero) + { + array_append (args, "-l"); + array_append (args, "0"); + } + return (0); } /* }}} int graph_get_rrdargs */