projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
shorten space for y-axis labels a bit
[rrdtool.git]
/
src
/
rrd_graph.c
diff --git
a/src/rrd_graph.c
b/src/rrd_graph.c
index
597abaf
..
76115ec
100644
(file)
--- a/
src/rrd_graph.c
+++ b/
src/rrd_graph.c
@@
-1,5
+1,5
@@
/****************************************************************************
/****************************************************************************
- * RRDtool 1.2.
1
Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.
3
Copyright by Tobi Oetiker, 1997-2005
****************************************************************************
* rrd__graph.c produce graphs from data in rrdfiles
****************************************************************************/
****************************************************************************
* rrd__graph.c produce graphs from data in rrdfiles
****************************************************************************/
@@
-151,9
+151,9
@@
ytr(image_desc_t *im, double value){
if (! im->rigid) {
/* keep yval as-is */
} else if (yval > im->yorigin) {
if (! im->rigid) {
/* keep yval as-is */
} else if (yval > im->yorigin) {
- yval = im->yorigin
+2
;
+ yval = im->yorigin;
} else if (yval < im->yorigin - im->ysize){
} else if (yval < im->yorigin - im->ysize){
- yval = im->yorigin - im->ysize
- 2
;
+ yval = im->yorigin - im->ysize;
}
return yval;
}
}
return yval;
}
@@
-886,26
+886,29
@@
data_calc( image_desc_t *im){
* and the resulting number is the step size for the
* resulting data source.
*/
* and the resulting number is the step size for the
* resulting data source.
*/
- for(rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){
-
if(im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE
||
- im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER){
- long ptr = im->gdes[gdi].rpnp[rpi].ptr;
- if (im->gdes[ptr].ds_cnt == 0) {
+ for(rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){
+
if(im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE
||
+
im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER){
+ long ptr = im->gdes[gdi].rpnp[rpi].ptr;
+ if (im->gdes[ptr].ds_cnt == 0) {
/* this is a VDEF data source */
#if 0
#if 0
- printf("DEBUG: inside CDEF '%s' processing VDEF '%s'\n",
- im->gdes[gdi].vname,
- im->gdes[ptr].vname);
- printf("DEBUG: value from vdef is %f\n",im->gdes[ptr].vf.val);
+
printf("DEBUG: inside CDEF '%s' processing VDEF '%s'\n",
+
im->gdes[gdi].vname,
+
im->gdes[ptr].vname);
+
printf("DEBUG: value from vdef is %f\n",im->gdes[ptr].vf.val);
#endif
im->gdes[gdi].rpnp[rpi].val = im->gdes[ptr].vf.val;
im->gdes[gdi].rpnp[rpi].op = OP_NUMBER;
#endif
im->gdes[gdi].rpnp[rpi].val = im->gdes[ptr].vf.val;
im->gdes[gdi].rpnp[rpi].op = OP_NUMBER;
- } else {
- if ((steparray =
+ } else { /* normal variables and PREF(variables) */
+
+ /* add one entry to the array that keeps track of the step sizes of the
+ * data sources going into the CDEF. */
+ if ((steparray =
rrd_realloc(steparray,
(++stepcnt+1)*sizeof(*steparray)))==NULL){
rrd_realloc(steparray,
(++stepcnt+1)*sizeof(*steparray)))==NULL){
- rrd_set_error("realloc steparray");
- rpnstack_free(&rpnstack);
- return -1;
+
rrd_set_error("realloc steparray");
+
rpnstack_free(&rpnstack);
+
return -1;
};
steparray[stepcnt-1] = im->gdes[ptr].step;
};
steparray[stepcnt-1] = im->gdes[ptr].step;
@@
-915,6
+918,7
@@
data_calc( image_desc_t *im){
* to the earliest endpoint of any of the
* rras involved (ptr)
*/
* to the earliest endpoint of any of the
* rras involved (ptr)
*/
+
if(im->gdes[gdi].start < im->gdes[ptr].start)
im->gdes[gdi].start = im->gdes[ptr].start;
if(im->gdes[gdi].start < im->gdes[ptr].start)
im->gdes[gdi].start = im->gdes[ptr].start;
@@
-927,8
+931,8
@@
data_calc( image_desc_t *im){
* further save step size and data source
* count of this rra
*/
* further save step size and data source
* count of this rra
*/
- im->gdes[gdi].rpnp[rpi].data
=
im->gdes[ptr].data + im->gdes[ptr].ds;
- im->gdes[gdi].rpnp[rpi].step = im->gdes[ptr].step;
+ im->gdes[gdi].rpnp[rpi].data
=
im->gdes[ptr].data + im->gdes[ptr].ds;
+ im->gdes[gdi].rpnp[rpi].step
= im->gdes[ptr].step;
im->gdes[gdi].rpnp[rpi].ds_cnt = im->gdes[ptr].ds_cnt;
/* backoff the *.data ptr; this is done so
im->gdes[gdi].rpnp[rpi].ds_cnt = im->gdes[ptr].ds_cnt;
/* backoff the *.data ptr; this is done so
@@
-941,9
+945,9
@@
data_calc( image_desc_t *im){
/* move the data pointers to the correct period */
for(rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){
/* move the data pointers to the correct period */
for(rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){
- if(im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE ||
- im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER){
-
long ptr
= im->gdes[gdi].rpnp[rpi].ptr;
+
if(im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE ||
+
im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER){
+
long ptr
= im->gdes[gdi].rpnp[rpi].ptr;
long diff = im->gdes[gdi].start - im->gdes[ptr].start;
if(diff > 0)
long diff = im->gdes[gdi].start - im->gdes[ptr].start;
if(diff > 0)
@@
-1923,7
+1927,7
@@
grid_paint(image_desc_t *im)
} else {
res = draw_horizontal_grid(im);
}
} else {
res = draw_horizontal_grid(im);
}
-
+
/* dont draw horizontal grid if there is no min and max val */
if (! res ) {
char *nodata = "No Data found";
/* dont draw horizontal grid if there is no min and max val */
if (! res ) {
char *nodata = "No Data found";
@@
-1954,6
+1958,14
@@
grid_paint(image_desc_t *im)
im->text_prop[TEXT_PROP_TITLE].size, im->tabwidth, 0.0,
GFX_H_CENTER, GFX_V_CENTER,
im->title);
im->text_prop[TEXT_PROP_TITLE].size, im->tabwidth, 0.0,
GFX_H_CENTER, GFX_V_CENTER,
im->title);
+ /* rrdtool 'logo' */
+ gfx_new_text( im->canvas,
+ im->ximg-7, 7,
+ ( im->graph_col[GRC_FONT] & 0xffffff00 ) | 0x00000066,
+ im->text_prop[TEXT_PROP_AXIS].font,
+ 5.5, im->tabwidth, 270,
+ GFX_H_RIGHT, GFX_V_TOP,
+ "RRDTOOL / TOBI OETIKER");
/* graph labels */
if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) {
/* graph labels */
if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) {
@@
-2139,7
+2151,7
@@
graph_size_location(image_desc_t *im, int elements
}
if (im->ylegend[0] != '\0' ) {
}
if (im->ylegend[0] != '\0' ) {
- Xvertical = im->text_prop[TEXT_PROP_UNIT].size *
2
;
+ Xvertical = im->text_prop[TEXT_PROP_UNIT].size *
1.6
;
}
}
@@
-2484,7
+2496,7
@@
graph_paint(image_desc_t *im, char ***calcpr)
}
} else {
}
} else {
- float ybase0 = DNAN,ytop0;
+ float ybase0 = DNAN,ytop0
=DNAN
;
for(ii=0;ii<im->xsize;ii++){
/* keep things simple for now, just draw these bars
do not try to build a big and complex area */
for(ii=0;ii<im->xsize;ii++){
/* keep things simple for now, just draw these bars
do not try to build a big and complex area */
@@
-2792,7
+2804,7
@@
rrd_graph_init(image_desc_t *im)
im->minval = DNAN;
im->maxval = DNAN;
im->unitsexponent= 9999;
im->minval = DNAN;
im->maxval = DNAN;
im->unitsexponent= 9999;
- im->unitslength=
6
;
+ im->unitslength=
5
;
im->symbol = ' ';
im->viewfactor = 1.0;
im->extra_flags= 0;
im->symbol = ' ';
im->viewfactor = 1.0;
im->extra_flags= 0;