def init_xyplot(fd_fff): xx = [0.0] * 20 #float xx[ 20 ], yy = [0.0] * 20 #yy[ 20 ]; #for ( i = 0; i <= 10; i++ ) for i in range(0, 10+1): xx[i] = float(i) yy[i] = math.exp( - (xx[i] - 5) * (xx[i] - 5) / 8) xfl.fl_set_xyplot_data(fd_fff.xyplot, xx, yy, 8, "Plot Title", \ "X-Axis", "Y|Axis") xfl.fl_set_xyplot_ybounds(fd_fff.xyplot, 0, 1.1) xfl.fl_set_xyplot_xbounds(fd_fff.xyplot, 0, 10) xfl.fl_add_xyplot_overlay(fd_fff.xyplot, 1, xx, yy, 11, xfl.FL_YELLOW) xfl.fl_set_xyplot_overlay_type(fd_fff.xyplot, 1, xfl.FL_LINEPOINTS_XYPLOT) xfl.fl_set_xyplot_interpolate(fd_fff.xyplot, 1, 2, 0.1) xfl.fl_add_xyplot_text(fd_fff.xyplot, 0.5, 1.0, "Gaussian\nDistribution", \ xfl.FL_ALIGN_RIGHT, xfl.FL_WHITE) xfl.fl_set_xyplot_key(fd_fff.xyplot, 0, "Original") xfl.fl_set_xyplot_key(fd_fff.xyplot, 1, "Overlay") xfl.fl_set_xyplot_key_position(fd_fff.xyplot, 9.8, 1.08, \ xfl.FL_ALIGN_LEFT_BOTTOM)
def main(lsysargv, sysargv): global xypui x = [0.0] * 11 y = [0.0] * 11 xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) xypui = create_form_axypform() # Fill-in form initialization code xfl.fl_set_xyplot_ybounds(xypui.xyplot, 1.0, 10.0) for i in range(0, 11): x[i] = y[i] = float(i) + 1 xfl.fl_add_xyplot_overlay(xypui.xyplot, 1, x, y, 10, xfl.FL_YELLOW) xfl.fl_set_xyplot_overlay_type(xypui.xyplot, 1, xfl.FL_LINEPOINTS_XYPLOT) xfl.fl_set_xyplot_interpolate(xypui.xyplot, 1, 2, 0.1) #srand( time( NULL ) ); random.seed(None) RAND_MAX = xfl.INT_MAX for i in range(0, 10): y[i] += float(random.random() / RAND_MAX - 0.5) xfl.fl_set_xyplot_data(xypui.xyplot, x, y, 11, \ "Active (log) xyplot with overlay", "x-axis", "y-axis") xfl.fl_set_xyplot_linewidth(xypui.xyplot, 0, 2) xfl.fl_set_xyplot_xgrid(xypui.xyplot, xfl.FL_GRID_MINOR) # Show the first form xfl.fl_show_form(xypui.axypform, xfl.FL_PLACE_MOUSE | xfl.FL_FREE_SIZE, xfl.FL_FULLBORDER, "xyplotactivelog") xfl.fl_do_forms() return 0
def init_gui(fd): x = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0] y = [5.5, 4.0, 4.5, 3.8, 4.0, 5.0] label = ["Mon", "Tue", "Wed", "Thur", "Fri", "Sat"] xfl.fl_add_nmenu_items(fd.menu, "One\tF1|Two\tF2|Three\tF3|Four\tF4") xfl.fl_add_select_items(fd.choice, "Option1|Option2|Option3") crab = xfl.fls_import_xpmdata_from_file("crab45.xpm") xfl.fl_set_pixmapbutton_data(fd.pixbutton, crab) xfl.fl_set_pixmap_data(fd.pix, crab) bm1_width, bm1_height, bm1_bits = xfl.fls_import_xbmdata_from_file( \ "bm1.xbm") xfl.fl_set_bitmapbutton_data(fd.bitbutton, bm1_width, bm1_height, \ bm1_bits) nomail_width, nomail_height, nomail_bits = \ xfl.fls_import_xbmdata_from_file("nomail.xbm") xfl.fl_set_bitmap_data(fd.bit, nomail_width, nomail_height, nomail_bits) xfl.fl_set_browser_fontsize(fd.browser, xfl.FL_NORMAL_SIZE) xfl.fl_addto_browser(fd.browser, "browser line 1\nbrowser line 2") xfl.fl_addto_browser(fd.browser, "browser line 3\nbrowser line 4") xfl.fl_addto_browser(fd.browser, "browser line 5\nbrowser line 6") xfl.fl_addto_browser(fd.browser, "browser line 7\nbrowser line 8") xfl.fl_addto_browser(fd.browser, "browser line 9\nbrowser line 10") xfl.fl_addto_browser(fd.browser, "browser line 11\nbrowser line 12") xfl.fl_addto_browser(fd.browser, "browser line 13\nbrowser line 14") xfl.fl_addto_browser(fd.browser, "browser line 15\nbrowser line 16") xfl.fl_addto_browser(fd.browser, "browser line 17\nbrowser line 18") for i in range(0, len(y)): xfl.fl_add_chart_value(fd.chart, y[i], label[i], i + 1) xfl.fl_set_xyplot_data(fd.xyplot, x, y, 6, "", "","") xfl.fl_add_xyplot_overlay(fd.xyplot, 1, x, y, 6, xfl.FL_RED) xfl.fl_add_xyplot_text(fd.xyplot, 2.5, 5.2, "Weekly Summary", \ xfl.FL_ALIGN_CENTER, xfl.FL_BLUE) xfl.fl_add_xyplot_text(fd.xyplot, 3, 3.85, "@-22->", xfl.FL_ALIGN_TOP, \ xfl.FL_RED) xfl.fl_set_xyplot_overlay_type(fd.xyplot, 1, xfl.FL_NORMAL_XYPLOT) xfl.fl_set_xyplot_alphaxtics(fd.xyplot, "Mon|Tue|Wed|Thu|Fri|Sat", "") xfl.fl_set_xyplot_ytics(fd.xyplot, -1, -1) xfl.fl_set_xyplot_linewidth(fd.xyplot, 0, 3)