projects
/
collection4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4568880
)
graph_def.c: Implement the "Stack" and "Area" options.
author
Florian Forster
<ff@octo.it>
Mon, 14 Jun 2010 21:53:07 +0000
(23:53 +0200)
committer
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Mon, 14 Jun 2010 21:53:07 +0000
(23:53 +0200)
graph_def.c
patch
|
blob
|
history
diff --git
a/graph_def.c
b/graph_def.c
index
36b6747
..
71ba1bd
100644
(file)
--- a/
graph_def.c
+++ b/
graph_def.c
@@
-20,6
+20,8
@@
struct graph_def_s
char *ds_name;
char *legend;
uint32_t color;
char *ds_name;
char *legend;
uint32_t color;
+ _Bool stack;
+ _Bool area;
graph_def_t *next;
};
graph_def_t *next;
};
@@
-206,6
+208,13
@@
int def_config (graph_config_t *cfg, const oconfig_item_t *ci) /* {{{ */
graph_config_get_string (child, &def->legend);
else if (strcasecmp ("Color", child->key) == 0)
def_config_color (child, &def->color);
graph_config_get_string (child, &def->legend);
else if (strcasecmp ("Color", child->key) == 0)
def_config_color (child, &def->color);
+ else if (strcasecmp ("Stack", child->key) == 0)
+ graph_config_get_bool (child, &def->stack);
+ else if (strcasecmp ("Area", child->key) == 0)
+ graph_config_get_bool (child, &def->area);
+ else
+ fprintf (stderr, "def_config: Ignoring unknown config option \"%s\"",
+ child->key);
}
return (gl_graph_add_def (cfg, def));
}
return (gl_graph_add_def (cfg, def));
@@
-310,9
+319,11
@@
int def_get_rrdargs (graph_def_t *def, graph_ident_t *ident, /* {{{ */
index, index);
/* Graph part */
index, index);
/* Graph part */
- array_append_format (args, "LINE1:def_%04i_avg#%06"PRIx32":%s",
+ array_append_format (args, "%s:def_%04i_avg#%06"PRIx32":%s%s",
+ def->area ? "AREA" : "LINE1",
index, def->color,
index, def->color,
- (def->legend != NULL) ? def->legend : def->ds_name);
+ (def->legend != NULL) ? def->legend : def->ds_name,
+ def->stack ? ":STACK" : "");
array_append_format (args, "GPRINT:vdef_%04i_min:%%lg min,", index);
array_append_format (args, "GPRINT:vdef_%04i_avg:%%lg avg,", index);
array_append_format (args, "GPRINT:vdef_%04i_max:%%lg max,", index);
array_append_format (args, "GPRINT:vdef_%04i_min:%%lg min,", index);
array_append_format (args, "GPRINT:vdef_%04i_avg:%%lg avg,", index);
array_append_format (args, "GPRINT:vdef_%04i_max:%%lg max,", index);