XForms: xyplot problem

moini@eleceng.adelaide.edu.au
Fri, 2 Oct 1998 10:22:32 +0930 (CST)

# To subscribers of the xforms list from moini@eleceng.adelaide.edu.au :

Hi,
When I use xyplot and try to zoom in the Y direction, I see many vertical
lines appearing. If I continue zooming then I will see thousands of line.

The really BIG problem is that if I doublebuffer the xyplot or its form,
the whole Xserver crashes.

Here comes a file that simulates the problem. Unfortunately, with this file
I couldn't crash my Xserver!!

My application heavily relies on the performance and reliability of the
xyplot, and I would really like to see it without major problems.

Thanks
Ali
/****************************************************************/
#include "forms.h"
#include <math.h>
#include <stdlib.h>
/** Header file generated with fdesign on Fri Oct 2 10:14:31 1998.**/

#ifndef FD_xy_h_
#define FD_xy_h_

/** Callbacks, globals and object handlers **/

/**** Forms and Objects ****/
typedef struct {
FL_FORM *xy;
void *vdata;
char *cdata;
long ldata;
FL_OBJECT *xy1;
FL_OBJECT *xy2;
} FD_xy;

extern FD_xy * create_form_xy(void);

#endif /* FD_xy_h_ */
/* Form definition file generated with fdesign. */

FD_xy *create_form_xy(void)
{
FL_OBJECT *obj;
FD_xy *fdui = (FD_xy *) fl_calloc(1, sizeof(*fdui));

fdui->xy = fl_bgn_form(FL_NO_BOX, 320, 550);
obj = fl_add_box(FL_UP_BOX,0,0,320,550,"");
fdui->xy1 = obj = fl_add_xyplot(FL_NORMAL_XYPLOT,10,20,300,220,"");
fdui->xy2 = obj = fl_add_xyplot(FL_NORMAL_XYPLOT,10,290,300,220,"");
fl_end_form();

fdui->xy->fdui = fdui;

return fdui;
}
/*---------------------------------------*/

static FD_xy *F;
#define N 100

int
main(int argc, char *argv[])
{
int i, j;
float tmp_f=0;
float x[N];
float y[N];

fl_initialize(&argc, argv, "FormDemo", 0, 0);
F=create_form_xy();

for(i=0;i<N;i++){
x[i]=i;
y[i]=sin(i);
}

/* make sure double buffer also works */

fl_show_form(F->xy, FL_PLACE_ASPECT, FL_TRANSIENT, "XYplot");
fl_set_xyplot_data(F->xy1, &tmp_f, &tmp_f, 1, "", "", "");
fl_set_xyplot_data(F->xy2, &tmp_f, &tmp_f, 1, "", "", "");

fl_set_object_dblbuffer(F->xy1, 1);
fl_set_object_dblbuffer(F->xy2, 1);
fl_add_xyplot_overlay(F->xy1,1,x,y,N,FL_RED);
fl_add_xyplot_overlay(F->xy2,1,x,y,N,FL_RED);
fl_set_xyplot_linewidth(F->xy1, 1, 2);
fl_set_xyplot_linewidth(F->xy2, 1, 2);
fl_set_xyplot_overlay_type(F->xy1,1,2);
fl_set_xyplot_overlay_type(F->xy2,1,2);
fl_set_xyplot_xbounds(F->xy1,0.0,(float)N);
fl_set_xyplot_xbounds(F->xy2,0.0,(float)N);
fl_set_xyplot_ybounds(F->xy2,-1.E-3,1.E-3);


while (1){
fl_do_forms();
}
return 0;
}

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/