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 xyplot xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) create_form_xyplot() # Make sure double buffer also works for i in range(0, N): xfl.fl_set_object_dblbuffer(xyplot[i], 1) for j in range(0, 21): x[i][j] = j * 3.1415 / 10 + 0.2 y[i][j] = math.sin(2 * x[i][j]) + math.cos(x[i][j]) xfl.fl_set_xyplot_data(xyplot[i], x[i], y[i], 21, "TestTitle", \ "X-axis", "Y|axis") if i == 0: xfl.fl_add_xyplot_text(xyplot[i], x[i][15], 0.1, \ "@2->", xfl.FL_ALIGN_TOP, xfl.FL_BLUE) else: xfl.fl_add_xyplot_text(xyplot[i], x[i][8], 1.4, \ "Text Inset", xfl.FL_ALIGN_CENTER, xfl.FL_BLUE) if i == 3: xfl.fl_set_xyplot_xgrid(xyplot[i], xfl.FL_GRID_MAJOR) xfl.fl_set_xyplot_xgrid(xyplot[i], xfl.FL_GRID_MINOR) elif i == 0: xfl.fl_set_xyplot_xtics(xyplot[i], 7, 2) xfl.fl_set_xyplot_xbounds(xyplot[i], 6, 0) elif i == 1: xfl.fl_set_xyplot_ytics(xyplot[i], 5, 2) xfl.fl_set_xyplot_ybounds(xyplot[i], 2.4, -2.4) xfl.fl_set_object_posthandler(xyplot[i], post) xfl.fl_show_form( fxyplot, xfl.FL_PLACE_MOUSE | xfl.FL_FREE_SIZE, \ xfl.FL_TRANSIENT, "XYplot") while xfl.fl_do_forms(): pass 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)