Re: XForms: problem using fl_set_xyplot_alphaxtics

From: Steve Lamont (spl@ncmir.ucsd.edu)
Date: Sun Jun 03 2001 - 09:46:32 EDT

  • Next message: Ivan Powis: "XForms: Problem updating sub-form coords in dragged tabfolders?"

    # To subscribers of the xforms list from Steve Lamont <spl@ncmir.ucsd.edu> :

    # To subscribers of the xforms list from Steve Lamont <spl@ncmir.ucsd.edu> :

    > I am trying to display a begining time string and a end time string on a
    > plot as shown in the following figure using
    > fl_set_xyplot_alphaxtics("xx:xx:xx|yy:yy:yy").
    >
    > | |
    > xx:xx:xx yy:yy:yy
    >
    > I have encountered two problems:
    >
    > 1. The fl_set_xyplot_alphaxtics() seems to interfere with the
    > fl_set_xyplot_xbounds(). ...

    Works for me. The following example works with version 0.89.6:

    #include <stdio.h>
    #include <math.h>
    #include <stdlib.h>

    #include <forms.h>

    typedef struct {
            FL_FORM *try;
            void *vdata;
            char *cdata;
            long ldata;
            FL_OBJECT *xyplot;
    } FD_try;

    FD_try *create_form_try( void )

    {

        FL_OBJECT *obj;
        FD_try *fdui = (FD_try *) fl_calloc(1, sizeof(*fdui));
          
        fdui->try = fl_bgn_form(FL_NO_BOX, 460, 290);
        obj = fl_add_box(FL_FLAT_BOX,0,0,460,290,"");
        fdui->xyplot = obj = fl_add_xyplot(FL_NORMAL_XYPLOT,30,40,410,210,"");
        fl_end_form();
      
        fl_adjust_form_size(fdui->try);
        fdui->try->fdui = fdui;
      
        return fdui;

    }

    int main( int argc, char **argv )

    {

        FD_try *fd_try;
        float x[61];
        float y[61];
        int i;
        
        fl_initialize(&argc, argv, 0, 0, 0);
        fd_try = create_form_try();
        
        fl_set_xyplot_xbounds( fd_try->xyplot, 0.0, 60.0 );
        fl_set_xyplot_alphaxtics( fd_try->xyplot,
                                  "5:12:00@0.0|5:13:30@60.0",
                                  NULL );

        for ( i = 0; i <= 60; i++ )
            y[i] = sin( ( x[i] = i ) / 60 * 2.0 * M_PI );
        fl_set_xyplot_data( fd_try->xyplot,
                            x, y, 61,
                            "Foo",
                            "Bar",
                            "Baz" );

        fl_show_form(fd_try->try,FL_PLACE_CENTERFREE,FL_FULLBORDER,"try");
        fl_do_forms();
        return 0;

    }

                                                            spl
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Mon Jun 04 2001 - 05:12:44 EDT