From 375995188dfc9e69f3884e8d4631809d137cc5e8 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sun, 13 Feb 2005 16:13:33 +0000 Subject: [PATCH] let rrd_graph return the actual value range it picked ... -- Henrik Stoerner git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@297 a5681a0c-68f1-0310-ab6d-d61299d08faa --- CONTRIBUTORS | 1 + bindings/perl-shared/RRDs.xs | 3 ++- bindings/tcl/tclrrd.c | 3 ++- src/rrd.h | 6 +++++- src/rrd_cgi.c | 3 ++- src/rrd_graph.c | 4 +++- src/rrd_graph.h | 2 +- src/rrd_tool.c | 3 ++- 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 717ff1f..dc2974b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -61,6 +61,7 @@ Debugging and code contributions Mike Slifcak many rrdtool-1.1.x fixes Peter Speck eps/svg/pdf file format code in rrdtool-1.x David Grimes SQRT/SORT/REV/SHIFT/TREND + Henrik Storner make rrd_graph() provide the min/max values of data in graph Documentation diff --git a/bindings/perl-shared/RRDs.xs b/bindings/perl-shared/RRDs.xs index 28a6bde..558bdc0 100644 --- a/bindings/perl-shared/RRDs.xs +++ b/bindings/perl-shared/RRDs.xs @@ -178,6 +178,7 @@ rrd_graph(...) PREINIT: char **calcpr=NULL; int i,xsize,ysize; + double ymin,ymax; char **argv; AV *retar; PPCODE: @@ -193,7 +194,7 @@ rrd_graph(...) } optind=0; opterr=0; rrd_clear_error(); - rrd_graph(items+1,argv,&calcpr,&xsize,&ysize,NULL); + rrd_graph(items+1,argv,&calcpr,&xsize,&ysize,NULL,&ymin,&ymax); for (i=0; i < items; i++) { free(argv[i+1]); } diff --git a/bindings/tcl/tclrrd.c b/bindings/tcl/tclrrd.c index 2a2fb41..3cc1711 100644 --- a/bindings/tcl/tclrrd.c +++ b/bindings/tcl/tclrrd.c @@ -217,13 +217,14 @@ Rrd_Graph(clientData, interp, argc, argv) { char **calcpr; int xsize, ysize; + double ymin, ymax; Tcl_Obj *listPtr; char **argv2; calcpr = NULL; argv2 = getopt_init(argc, argv); - if (rrd_graph(argc, argv2, &calcpr, &xsize, &ysize) != -1 ) { + if (rrd_graph(argc, argv2, &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) != -1 ) { listPtr = Tcl_GetObjResult(interp); Tcl_ListObjAppendElement(interp, listPtr, Tcl_NewIntObj(xsize)); Tcl_ListObjAppendElement(interp, listPtr, Tcl_NewIntObj(ysize)); diff --git a/src/rrd.h b/src/rrd.h index 7509540..f63d117 100644 --- a/src/rrd.h +++ b/src/rrd.h @@ -5,6 +5,10 @@ ***************************************************************************** * $Id$ * $Log$ + * Revision 1.9 2005/02/13 16:13:33 oetiker + * let rrd_graph return the actual value range it picked ... + * -- Henrik Stoerner + * * Revision 1.8 2004/05/26 22:11:12 oetiker * reduce compiler warnings. Many small fixes. -- Mike Slifcak * @@ -59,7 +63,7 @@ typedef double rrd_value_t; /* the data storage type is /* main function blocks */ int rrd_create(int, char **); int rrd_update(int, char **); -int rrd_graph(int, char **, char ***, int *, int *, FILE *); +int rrd_graph(int, char **, char ***, int *, int *, FILE *, double *, double *); int rrd_fetch(int, char **, time_t *, time_t *, unsigned long *, unsigned long *, char ***, rrd_value_t **); int rrd_restore(int, char **); diff --git a/src/rrd_cgi.c b/src/rrd_cgi.c index 411b02b..610413f 100644 --- a/src/rrd_cgi.c +++ b/src/rrd_cgi.c @@ -688,6 +688,7 @@ char* cgiget(long argc, const char **args){ char* drawgraph(long argc, char **args){ int i,xsize, ysize; + double ymin,ymax; for(i=0;i