summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3355b3d)
raw | patch | inline | side by side (parent: 3355b3d)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 6 May 2005 21:52:55 +0000 (21:52 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 6 May 2005 21:52:55 +0000 (21:52 +0000) |
this saves quite some time ...
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@490 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@490 a5681a0c-68f1-0310-ab6d-d61299d08faa
program/src/rrd_gfx.c | patch | blob | history | |
program/src/rrd_graph.c | patch | blob | history | |
program/src/rrd_graph.h | patch | blob | history |
diff --git a/program/src/rrd_gfx.c b/program/src/rrd_gfx.c
index 3ad318a97e226294c94aa019345d72dd3a687c26..8b3493ec1c9351cb58508b51fe50995b5056d591 100644 (file)
--- a/program/src/rrd_gfx.c
+++ b/program/src/rrd_gfx.c
if (node->closed_path)
gfx_libart_close_path(node, &vec);
/* gfx_round_scaled_coordinates(vec); */
- pvec = art_vpath_perturb(vec);
- art_free(vec);
+ /* pvec = art_vpath_perturb(vec);
+ art_free(vec); */
if(node->type == GFX_LINE){
- svp = art_svp_vpath_stroke ( pvec, ART_PATH_STROKE_JOIN_ROUND,
+ svp = art_svp_vpath_stroke ( vec, ART_PATH_STROKE_JOIN_ROUND,
ART_PATH_STROKE_CAP_ROUND,
node->size*canvas->zoom,4,0.25);
} else {
- svp = art_svp_from_vpath ( pvec );
- svpt = art_svp_uncross( svp );
+ svp = art_svp_from_vpath ( vec );
+/* svpt = art_svp_uncross( svp );
art_svp_free(svp);
svp = art_svp_rewind_uncrossed(svpt,ART_WIND_RULE_NONZERO);
- art_svp_free(svpt);
+ art_svp_free(svpt);*/
}
- art_free(pvec);
+ art_free(vec);
/* this is from gnome since libart does not have this yet */
gnome_print_art_rgba_svp_alpha (svp ,0,0, pys_width, pys_height,
node->color, buffer, rowstride, NULL);
index 01e174ce7cb0ed5fcdf38ed5ede01350a72cd951..597abafc22b020fdb990d1ae268fd0995b824ad8 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
} /* for */
/* *******************************************************
- ___
- | | ___
+ a ___. (a,t)
+ | | ___
____| | | |
| |___|
- -------|---------------------------------------
+ -------|--t-1--t--------------------------------
- if we know the value of y at time t was a then
+ if we know the value at time t was a then
we draw a square from t-1 to t with the value a.
********************************************************* */
/* GF_LINE and friend */
if(stack_gf == GF_LINE ){
node = NULL;
- for(ii=1;ii<im->xsize;ii++){
- if (isnan(im->gdes[i].p_data[ii])){
+ for(ii=1;ii<im->xsize;ii++){
+ if (isnan(im->gdes[i].p_data[ii]) || (im->slopemode==1 && isnan(im->gdes[i].p_data[ii-1]))){
node = NULL;
continue;
}
if ( node == NULL ) {
- node = gfx_new_line(im->canvas,
+ if ( im->slopemode == 0 ){
+ node = gfx_new_line(im->canvas,
ii-1+im->xorigin,ytr(im,im->gdes[i].p_data[ii]),
ii+im->xorigin,ytr(im,im->gdes[i].p_data[ii]),
im->gdes[i].linewidth,
im->gdes[i].col);
+ } else {
+ node = gfx_new_line(im->canvas,
+ ii-1+im->xorigin,ytr(im,im->gdes[i].p_data[ii-1]),
+ ii+im->xorigin,ytr(im,im->gdes[i].p_data[ii]),
+ im->gdes[i].linewidth,
+ im->gdes[i].col);
+ }
} else {
- gfx_add_point(node,ii-1+im->xorigin,ytr(im,im->gdes[i].p_data[ii]));
+ if ( im->slopemode==0 ){
+ gfx_add_point(node,ii-1+im->xorigin,ytr(im,im->gdes[i].p_data[ii]));
+ };
gfx_add_point(node,ii+im->xorigin,ytr(im,im->gdes[i].p_data[ii]));
};
}
} else {
- for(ii=1;ii<im->xsize;ii++){
+ float ybase0 = DNAN,ytop0;
+ 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 */
float ybase,ytop;
+ if ( im->slopemode == 0 && ii==0){
+ continue;
+ }
if ( isnan(im->gdes[i].p_data[ii]) ) {
+ ybase0 = DNAN;
continue;
}
ytop = ytr(im,im->gdes[i].p_data[ii]);
ybase = ytr(im,areazero);
}
if ( ybase == ytop ){
- continue;
+ ybase0 = DNAN;
+ continue;
}
- node = gfx_new_area(im->canvas,
- ii-1+im->xorigin,ybase,
- ii-1+im->xorigin,ytop,
+ /* every area has to be wound clock-wise,
+ so we have to make sur base remains base */
+ if (ybase > ytop){
+ float extra = ytop;
+ ytop = ybase;
+ ybase = extra;
+ }
+ if ( im->slopemode == 0){
+ ybase0 = ybase;
+ ytop0 = ytop;
+ }
+ if ( !isnan(ybase0) ){
+ node = gfx_new_area(im->canvas,
+ ii-1+im->xorigin,ybase0,
+ ii-1+im->xorigin,ytop0,
ii+im->xorigin,ytop,
im->gdes[i].col
);
- gfx_add_point(node,ii+im->xorigin,ybase);
+ gfx_add_point(node,
+ ii+im->xorigin,ybase
+ );
+ }
+ ybase0=ybase;
+ ytop0=ytop;
}
} /* else GF_LINE */
} /* if color != 0x0 */
im->gridfit = 1;
im->imginfo = NULL;
im->lazy = 0;
+ im->slopemode = 0;
im->logarithmic = 0;
im->ygridstep = DNAN;
im->draw_x_grid = 1;
{"only-graph", no_argument, 0, 'j'},
{"alt-y-grid", no_argument, 0, 'Y'},
{"no-minor", no_argument, 0, 'I'},
+ {"slope-mode", no_argument, 0, 'E'},
{"alt-autoscale", no_argument, 0, 'A'},
{"alt-autoscale-max", no_argument, 0, 'M'},
{"no-gridfit", no_argument, 0, 'N'},
int col_start,col_end;
opt = getopt_long(argc, argv,
- "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMX:L:S:T:NR:B:",
+ "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:",
long_options, &option_index);
if (opt == EOF)
case 'z':
im->lazy = 1;
break;
+ case 'E':
+ im->slopemode = 1;
+ break;
+
case 'o':
im->logarithmic = 1;
if (isnan(im->minval))
index 58af260d532fa2f12b9006ad366058f6243faff6..ca3e7c3978b525a046462402c77c87404892ef41 100644 (file)
--- a/program/src/rrd_graph.h
+++ b/program/src/rrd_graph.h
int lazy; /* only update the image if there is
reasonable probablility that the
existing one is out of date */
+ int slopemode; /* connect the dots of the curve directly, not using a stair */
int logarithmic; /* scale the yaxis logarithmic */
/* status information */