index 79a23be482ec8da82040afdd217fc30a6a391e66..047d9c27d7e1b001de509b747cb14de844805a9b 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
/****************************************************************************
- * RRDtool 1.2rc9 Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.1 Copyright by Tobi Oetiker, 1997-2005
****************************************************************************
* rrd__graph.c produce graphs from data in rrdfiles
****************************************************************************/
#ifndef RRD_DEFAULT_FONT
/* there is special code later to pick Cour.ttf when running on windows */
-#define RRD_DEFAULT_FONT "VeraMono.ttf"
+#define RRD_DEFAULT_FONT "DejaVuSansMono-Roman.ttf"
#endif
text_prop_t text_prop[] = {
/* yaxis unit description */
gfx_new_text( im->canvas,
- 7, (im->yorigin - im->ysize/2),
+ 12, (im->yorigin - im->ysize/2),
im->graph_col[GRC_FONT],
im->text_prop[TEXT_PROP_UNIT].font,
im->text_prop[TEXT_PROP_UNIT].size, im->tabwidth,
/* graph title */
gfx_new_text( im->canvas,
- im->ximg/2, im->text_prop[TEXT_PROP_TITLE].size*1.2,
+ im->ximg/2, im->text_prop[TEXT_PROP_TITLE].size*1.3+4,
im->graph_col[GRC_FONT],
im->text_prop[TEXT_PROP_TITLE].font,
im->text_prop[TEXT_PROP_TITLE].size, im->tabwidth, 0.0,
** | |..............legends......................|
** +-+-------------------------------------------+
*/
- int Xvertical=0, Yvertical=0,
- Xtitle =0, Ytitle =0,
+ int Xvertical=0,
+ Ytitle =0,
Xylabel =0,
Xmain =0, Ymain =0,
#ifdef WITH_PIECHART
if (im->ylegend[0] != '\0' ) {
Xvertical = im->text_prop[TEXT_PROP_UNIT].size *2;
- Yvertical = gfx_get_text_width(im->canvas, 0,
- im->text_prop[TEXT_PROP_UNIT].font,
- im->text_prop[TEXT_PROP_UNIT].size,
- im->tabwidth,im->ylegend, 0);
}
** automatically has some vertical spacing. The horizontal
** spacing is added here, on each side.
*/
- Xtitle = gfx_get_text_width(im->canvas, 0,
+ /* don't care for the with of the title
+ Xtitle = gfx_get_text_width(im->canvas, 0,
im->text_prop[TEXT_PROP_TITLE].font,
im->text_prop[TEXT_PROP_TITLE].size,
im->tabwidth,
- im->title, 0) + 2*Xspacing;
- Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.5;
+ im->title, 0) + 2*Xspacing; */
+ Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.6+10;
}
if (elements) {
im->text_prop[TEXT_PROP_AXIS].font,
im->text_prop[TEXT_PROP_AXIS].size,
im->tabwidth,
- "0", 0) * im->unitslength + im->text_prop[TEXT_PROP_AXIS].size * 2;
+ "0", 0) * im->unitslength + Xspacing;
}
}
im->xorigin = Xspacing + Xylabel;
- if (Xtitle > im->ximg) im->ximg = Xtitle;
+ /* the length of the title should not influence with width of the graph
+ if (Xtitle > im->ximg) im->ximg = Xtitle; */
if (Xvertical) { /* unit description */
im->ximg += Xvertical;
im->yimg += Ytitle;
im->yorigin += Ytitle;
} else {
- im->yimg += Yspacing;
- im->yorigin += Yspacing;
+ im->yimg += 1.5*Yspacing;
+ im->yorigin += 1.5*Yspacing;
}
/* reserve space for padding below the graph */
im->yimg += Yspacing;
if(leg_place(im)==-1)
return -1;
- /* last of three steps: check total height of image */
- if (im->yimg < Yvertical) im->yimg = Yvertical;
#if 0
if (Xlegend > im->ximg) {
rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize, FILE *stream, double *ymin, double *ymax)
{
image_desc_t im;
-
rrd_graph_init(&im);
im.graphhandle = stream;
if (windir != NULL) {
strncpy(rrd_win_default_font,windir,999);
rrd_win_default_font[999] = '\0';
- strcat(rrd_win_default_font,"\\fonts\\cour.ttf");
+ strcat(rrd_win_default_font,"\\fonts\\");
+ strcat(rrd_win_default_font,RRD_DEFAULT_FONT);
for(i=0;i<DIM(text_prop);i++){
strncpy(text_prop[i].font,rrd_win_default_font,sizeof(text_prop[i].font)-1);
text_prop[i].font[sizeof(text_prop[i].font)-1] = '\0';
long long_tmp;
struct rrd_time_value start_tv, end_tv;
gfx_color_t color;
+ optind = 0; opterr = 0; /* initialize getopt */
parsetime("end-24h", &start_tv);
parsetime("now", &end_tv);