int collecty_graph_render(collecty_graph* self,
const char* object, char** buffer, size_t* length) {
collecty_args* args = NULL;
+ char** data = NULL;
FILE* f = NULL;
int w = 0;
int h = 0;
+ double ymin = 0;
+ double ymax = 0;
int r;
// Log action
// Render the graph
r = rrd_graph(collecty_args_argc(args), (char**)collecty_args_argv(args),
- NULL, &w, &h, f, NULL, NULL);
+ &data, &w, &h, f, &ymin, &ymax);
if (r < 0) {
ERROR(self->ctx, "Failed to generate the graph: %s\n", rrd_get_error());
rrd_clear_error();
// Log action
DEBUG(self->ctx, "Rendered graph %s:\n", collecty_graph_get_name(self));
- DEBUG(self->ctx, " Width : %d\n", w);
- DEBUG(self->ctx, " Height : %d\n", h);
+ DEBUG(self->ctx, " width : %d\n", w);
+ DEBUG(self->ctx, " height : %d\n", h);
+ DEBUG(self->ctx, " ymin : %.2f\n", ymin);
+ DEBUG(self->ctx, " ymax : %.2f\n", ymax);
+
+ // Print all content of the data array
+ if (data) {
+ for (unsigned int i = 0; data[i]; i++)
+ DEBUG(self->ctx, " data[%2d]: %s\n", i, data[i]);
+ }
ERROR:
+ if (data) {
+ for (unsigned int i = 0; data[i]; i++)
+ free(data[i]);
+ free(data);
+ }
if (args)
collecty_args_unref(args);
if (f)