summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f106db0)
raw | patch | inline | side by side (parent: f106db0)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 24 Apr 2002 20:49:00 +0000 (20:49 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 24 Apr 2002 20:49:00 +0000 (20:49 +0000) |
rrdtool 1.0 Avoids drawing minor vertical gridlines where a major gridline
is to avoid artifacts from having the grey line beneath the red one. Patches
src/rrd_graph.c and src/rrd_graph.h
-- Peter Speck <speck@ruc.dk
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@127 a5681a0c-68f1-0310-ab6d-d61299d08faa
is to avoid artifacts from having the grey line beneath the red one. Patches
src/rrd_graph.c and src/rrd_graph.h
-- Peter Speck <speck@ruc.dk
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@127 a5681a0c-68f1-0310-ab6d-d61299d08faa
program/src/rrd_graph.c | patch | blob | history | |
program/src/rrd_graph.h | patch | blob | history |
index 135a8a0683a96ed7fc890845c08b407f66bc72d7..9b4631157148d61053cff68fd367eb874ce1fb67 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
im->text_prop[TEXT_PROP_AXIS].size,
im->tabwidth, 0.0, GFX_H_RIGHT, GFX_V_CENTER,
graph_label );
- gfx_new_line ( im->canvas,
+ gfx_new_dashed_line ( im->canvas,
X0-2,Y0,
X1+2,Y0,
- MGRIDWIDTH, im->graph_col[GRC_MGRID] );
+ MGRIDWIDTH, im->graph_col[GRC_MGRID],
+ im->grid_dash_on, im->grid_dash_off);
} else {
- gfx_new_line ( im->canvas,
+ gfx_new_dashed_line ( im->canvas,
X0-1,Y0,
X1+1,Y0,
- GRIDWIDTH, im->graph_col[GRC_GRID] );
+ GRIDWIDTH, im->graph_col[GRC_GRID],
+ im->grid_dash_on, im->grid_dash_off);
}
}
while(yloglab[minoridx][++i] > 0){
Y0 = ytr(im,value * yloglab[minoridx][i]);
if (Y0 <= im->yorigin - im->ysize) break;
- gfx_new_line ( im->canvas,
+ gfx_new_dashed_line ( im->canvas,
X0-1,Y0,
X1+1,Y0,
- GRIDWIDTH, im->graph_col[GRC_GRID] );
+ GRIDWIDTH, im->graph_col[GRC_GRID],
+ im->grid_dash_on, im->grid_dash_off);
}
}
while(yloglab[majoridx][++i] > 0){
Y0 = ytr(im,value * yloglab[majoridx][i]);
if (Y0 <= im->yorigin - im->ysize) break;
- gfx_new_line ( im->canvas,
+ gfx_new_dashed_line ( im->canvas,
X0-2,Y0,
X1+2,Y0,
- MGRIDWIDTH, im->graph_col[GRC_MGRID] );
+ MGRIDWIDTH, im->graph_col[GRC_MGRID],
+ im->grid_dash_on, im->grid_dash_off);
sprintf(graph_label,"%3.0e",value * yloglab[majoridx][i]);
gfx_new_text ( im->canvas,
image_desc_t *im )
{
int xlab_sel; /* which sort of label and grid ? */
- time_t ti, tilab;
+ time_t ti, tilab, timajor;
long factor;
char graph_label[100];
double X0,Y0,Y1; /* points for filled graph and more*/
/* paint the minor grid */
for(ti = find_first_time(im->start,
im->xlab_user.gridtm,
- im->xlab_user.gridst);
+ im->xlab_user.gridst),
+ timajor = find_first_time(im->start,
+ im->xlab_user.mgridtm,
+ im->xlab_user.mgridst);
ti < im->end;
ti = find_next_time(ti,im->xlab_user.gridtm,im->xlab_user.gridst)
){
/* are we inside the graph ? */
if (ti < im->start || ti > im->end) continue;
+ while (timajor < ti) {
+ timajor = find_next_time(timajor,
+ im->xlab_user.mgridtm, im->xlab_user.mgridst);
+ }
+ if (ti == timajor) continue; /* skip as falls on major grid line */
X0 = xtr(im,ti);
- gfx_new_line(im->canvas,X0,Y0+1, X0,Y1-1,GRIDWIDTH, im->graph_col[GRC_GRID]);
+ gfx_new_dashed_line(im->canvas,X0,Y0+1, X0,Y1-1,GRIDWIDTH,
+ im->graph_col[GRC_GRID],
+ im->grid_dash_on, im->grid_dash_off);
}
/* are we inside the graph ? */
if (ti < im->start || ti > im->end) continue;
X0 = xtr(im,ti);
- gfx_new_line(im->canvas,X0,Y0+2, X0,Y1-2,MGRIDWIDTH, im->graph_col[GRC_MGRID]);
+ gfx_new_dashed_line(im->canvas,X0,Y0+3, X0,Y1-2,MGRIDWIDTH,
+ im->graph_col[GRC_MGRID],
+ im->grid_dash_on, im->grid_dash_off);
}
/* paint the labels below the graph */
im->gdes_c = 0;
im->gdes = NULL;
im->canvas = gfx_new_canvas();
+ im->grid_dash_on = 1;
+ im->grid_dash_off = 1;
for(i=0;i<DIM(graph_col);i++)
im->graph_col[i]=graph_col[i];
index 6fac38d6ea454f35d3ca4badcd1dc82a947f4caa..e61d6b02f5ff6495febbc2e27720b8b5a55a3ca4 100644 (file)
--- a/program/src/rrd_graph.h
+++ b/program/src/rrd_graph.h
char title[200]; /* title for graph */
int draw_x_grid; /* no x-grid at all */
int draw_y_grid; /* no x-grid at all */
+ double grid_dash_on, grid_dash_off;
xlab_t xlab_user; /* user defined labeling for xaxis */
char xlab_form[200]; /* format for the label on the xaxis */