Commit 03aae80a authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Begin getting a feel for the graphing code. Fix a bug in the scatter

plot drawing.

2000-07-04  Jody Goldberg <jgoldberg@home.com>

	* graph-view-util.h (ADJUST_X) : new macro.
	(MAP_X) : Use ADJUST_X.

	* graph-view-scatter.c (graph_view_scatter_plot) : Remove the debug
	  printout.
parent 449e5868
2000-07-04 Jody Goldberg <jgoldberg@home.com>
* graph-view-util.h (ADJUST_X) : new macro.
(MAP_X) : Use ADJUST_X.
* graph-view-scatter.c (graph_view_scatter_plot) : Remove the debug
printout.
2000-06-18 Jody Goldberg <jgoldberg@home.com>
* Release 0.56
......
......@@ -26,6 +26,9 @@ plot_point (ViewDrawCtx *ctx, int xi, double x, int series, double y)
sym = symbol_setup (ctx, series);
symbol_draw (ctx, sym, MAP_X (ctx, x), MAP_Y (ctx, y));
#ifdef DEBUG_SCATTER
printf ("%d: %g %g [%g %g]\n", xi, x, y, MAP_X (ctx, x), MAP_Y (ctx, y));
#endif
}
/*
......@@ -64,7 +67,7 @@ graph_view_line_plot (GraphView *graph_view, GdkDrawable *drawable,
for (vector = 1; vector < vector_count; vector ++){
double last_x, last_y;
int xi;
last_y = graph_vector_get_double (vectors [vector], 0);
last_x = graph_vector_get_double (x_vector, 0);
......@@ -103,7 +106,7 @@ graph_view_scatter_plot (GraphView *graph_view, GdkDrawable *drawable,
vector_count = graph_view->graph->layout->n_series;
setup_view_ctx (&ctx, graph_view, drawable, graph_view->fill_gc, x, y, width, height);
/*
* FIXME:
*
......@@ -116,16 +119,12 @@ graph_view_scatter_plot (GraphView *graph_view, GdkDrawable *drawable,
for (xi = 0; xi < x_vals; xi++){
double const xv = graph_vector_get_double (x_vector, xi);
int vector;
for (vector = 1; vector < vector_count; vector++){
double y;
y = graph_vector_get_double (vectors [vector], xi);
printf ("%d: %g %g [%g %g]\n", xi, xv, y, ctx.graph->x_size, ctx.graph->y_size);
plot_point (&ctx, xi, xv, vector, y);
}
}
}
......@@ -52,7 +52,7 @@ void setup_view_ctx (ViewDrawCtx *ctx, GraphView *gv, GdkDrawable *d, GdkGC *g
* The Column/Bar does not use this one, it uses ctx->scale, because it
* has to handle 2 different scaling systems depending on column or bar.
*/
/*
* Maps a pixel value in the 0..xl,0..yl ranges to an actual
* position in the canvas (ctx->{x,y} contains the offset of the pixmap
......@@ -63,13 +63,13 @@ void setup_view_ctx (ViewDrawCtx *ctx, GraphView *gv, GdkDrawable *d, GdkGC *g
#define CANVAS_MAP_X(ctx,xv) ((xv) - (ctx)->x + (ctx)->graph_view->bbox.x0)
#define CANVAS_MAP_Y(ctx,yv) (((ctx)->yl - (yv)) - (ctx)->y + (ctx)->graph_view->bbox.y0)
#define ADJUST_X(ctx,x) ((x) - (ctx)->graph->x_low)
#define ADJUST_Y(ctx,y) ((y) - (ctx)->graph->low)
/*
* Maps a x,y coordinate to a pixel value
*/
#define MAP_X(ctx,xv) CANVAS_MAP_X ((ctx), (((xv) * (ctx)->xl) / (ctx)->graph->x_size))
#define MAP_X(ctx,xv) CANVAS_MAP_X ((ctx), (((ADJUST_X ((ctx),(xv))) * (ctx)->xl) / (ctx)->graph->x_size))
#define MAP_Y(ctx,yv) CANVAS_MAP_Y ((ctx), (((ADJUST_Y ((ctx),(yv))) * (ctx)->yl) / (ctx)->graph->y_size))
#endif /* GRAPH_VIEW_UTIL_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment