From: Michael Tremer Date: Thu, 2 Oct 2025 10:11:02 +0000 (+0000) Subject: graph: Import the default arguments from the Python implementation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4863968a48695def12dff3ce735b59f53d099277;p=telemetry.git graph: Import the default arguments from the Python implementation Signed-off-by: Michael Tremer --- diff --git a/src/daemon/graph.c b/src/daemon/graph.c index d798937..e7b494d 100644 --- a/src/daemon/graph.c +++ b/src/daemon/graph.c @@ -24,6 +24,7 @@ #include #include "args.h" +#include "colors.h" #include "ctx.h" #include "daemon.h" #include "graph.h" @@ -39,6 +40,29 @@ struct collecty_graph { const collecty_graph_impl* impl; }; +const char* DEFAULT_RENDER_ARGS[] = { + // Change the background color + "--color=BACK" COLOR_BLACK, + + // Disable the border around the image + "--border=0", + + // Let's width and heigh define the size of the entire image + "--full-size-mode", + + // Give the curves a more organic look + "--slope-mode", + + // Show nicer labels + "--dynamic-labels", + + // Add a watermark + "--watermark=PACKAGE_NAME", + + // Sentinel + NULL, +}; + static void collecty_graph_free(collecty_graph* self) { if (self->daemon) collecty_daemon_unref(self->daemon); @@ -174,6 +198,11 @@ int collecty_graph_render(collecty_graph* self, if (r < 0) goto ERROR; + // Push the default arguments + r = collecty_args_pushv(args, DEFAULT_RENDER_ARGS); + if (r < 0) + goto ERROR; + // Call the implementation to add some arguments r = self->impl->render(self->ctx, self, args, object); if (r < 0)