summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e44c4e2)
raw | patch | inline | side by side (parent: e44c4e2)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 13 Feb 2005 16:13:33 +0000 (16:13 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 13 Feb 2005 16:13:33 +0000 (16:13 +0000) |
-- Henrik Stoerner <henrik@hswn.dk>
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@297 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@297 a5681a0c-68f1-0310-ab6d-d61299d08faa
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 717ff1f923d3bbf86867f28371f9c6dfce6b4a99..dc2974b0b187e766ad78e214d68449d91bb14ee8 100644 (file)
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
Mike Slifcak <slif@bellsouth.net> many rrdtool-1.1.x fixes
Peter Speck <speck@vitality.dk> eps/svg/pdf file format code in rrdtool-1.x
David Grimes <dgrimes@navisite.com> SQRT/SORT/REV/SHIFT/TREND
+ Henrik Storner <henrik@hswn.dk> make rrd_graph() provide the min/max values of data in graph
Documentation
index 28a6bde1a200c1b73f5aab8e630311675ae01cad..558bdc0720b27183ca6eee891d2e5c6f9df4acd7 100644 (file)
PREINIT:
char **calcpr=NULL;
int i,xsize,ysize;
+ double ymin,ymax;
char **argv;
AV *retar;
PPCODE:
}
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 2a2fb410c0aa6167fbf3cce5e4cf3edf1b8dab77..3cc171151ff22acdf7d7fb14702358e7ad9841a0 100644 (file)
--- a/bindings/tcl/tclrrd.c
+++ b/bindings/tcl/tclrrd.c
{
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 7509540b1c230128c3149d0e5913f0b9bb7f09d4..f63d1178037c2bb14199321f7e73f69931812e2a 100644 (file)
--- a/src/rrd.h
+++ b/src/rrd.h
*****************************************************************************
* $Id$
* $Log$
+ * Revision 1.9 2005/02/13 16:13:33 oetiker
+ * let rrd_graph return the actual value range it picked ...
+ * -- Henrik Stoerner <henrik@hswn.dk>
+ *
* Revision 1.8 2004/05/26 22:11:12 oetiker
* reduce compiler warnings. Many small fixes. -- Mike Slifcak <slif@bellsouth.net>
*
/* 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 411b02bb23f75bafa0324a5379d26a5601c41dae..610413f0f239635ce329a23d12f427669f9d0f3c 100644 (file)
--- a/src/rrd_cgi.c
+++ b/src/rrd_cgi.c
char* drawgraph(long argc, char **args){
int i,xsize, ysize;
+ double ymin,ymax;
for(i=0;i<argc;i++)
if(strcmp(args[i],"--imginfo")==0 || strcmp(args[i],"-g")==0) break;
if(i==argc) {
optind=0; /* reset gnu getopt */
opterr=0; /* reset gnu getopt */
calfree();
- if( rrd_graph(argc+1, args-1, &calcpr, &xsize, &ysize,NULL) != -1 ) {
+ if( rrd_graph(argc+1, args-1, &calcpr, &xsize, &ysize,NULL,&ymin,&ymax) != -1 ) {
return stralloc(calcpr[0]);
} else {
if (rrd_test_error()) {
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index 85984b3e46adcf0d63615256387636ea2d567a6a..3ac36234212b27a5579cbdffa473b02177a1b2e3 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
** - script parsing now in rrd_graph_script()
*/
int
-rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize, FILE *stream)
+rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize, FILE *stream, double *ymin, double *ymax)
{
image_desc_t im;
@@ -2676,6 +2676,8 @@ rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize, FILE *s
*xsize=im.ximg;
*ysize=im.yimg;
+ *ymin=im.minval;
+ *ymax=im.maxval;
if (im.imginfo) {
char *filename;
if (!(*prdata)) {
diff --git a/src/rrd_graph.h b/src/rrd_graph.h
index 181474cbd217a41009e23920e003f3e32cd5f6cb..d67f135f17ca145b981df1bb9a59ceaf201dfa43 100644 (file)
--- a/src/rrd_graph.h
+++ b/src/rrd_graph.h
void pie_part(image_desc_t *, gfx_color_t, double, double, double, double, double);
int gdes_alloc(image_desc_t *);
int scan_for_col(char *, int, char *);
-int rrd_graph(int, char **, char ***, int *, int *, FILE *);
+int rrd_graph(int, char **, char ***, int *, int *, FILE *, double *, double *);
void rrd_graph_init(image_desc_t *);
void rrd_graph_options(int, char **, image_desc_t *);
void rrd_graph_script(int, char **, image_desc_t *, int);
diff --git a/src/rrd_tool.c b/src/rrd_tool.c
index fce0925c8e8945f53c8cc25c586572a6ab009d08..94c2b157bc94f79a4afdcb503647750ab89e505f 100644 (file)
--- a/src/rrd_tool.c
+++ b/src/rrd_tool.c
const char *imgfile = argv[2]; /* rrd_graph changes argv pointer */
#endif
int xsize, ysize;
+ double ymin,ymax;
int i;
int tostdout = (strcmp(argv[2],"-") == 0);
- if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize, NULL) != -1 ) {
+ if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) != -1 ) {
if (!tostdout)
printf ("%dx%d\n",xsize,ysize);
if (calcpr) {