Пример #1
0
    //==================ZEDGRAPH=================
    void OnIvFtpBrowserItemActivated_ZedGraph(object o, ItemActivatedArgs args)
    {
        string selected_file = get_BrowserItem_Value (ivFtpBrowser);
        StreamReader file_reader = c_current_ftp_session.CFTP_GetFile (selected_file);

        Viewport _port = new Viewport (new Adjustment(1000, 500, 1000, 5, 0, 500),
            new Adjustment (500, 500, 500, 0, 0, 500));
        _port.WidthRequest = 2000;
        _port.ResizeMode = ResizeMode.Parent;

        ZedGraphControl g_graph = new ZedGraphControl ();

        c_current_logfile = new CLogFile
                            (
                                file_reader,
                                c_current_ftp_session.CFTP_LogFileDate,
                                c_current_device.DeviceFileDescription
                               );

        c_current_graph = new CGraph (c_current_logfile.LogFileEntries);
        //c_current_graph.YAxisCodeIndex = c_current_logfile.CLogFile_Get_Y_Axis_Code_Index (c_current_device);
        c_current_graph.Title = selected_file;
        c_current_graph.YAxisCode = "CURTEMP";
        c_current_graph.YAxisLabel = "Current Temperature";
        c_current_graph.XAxisLabel = "Time Stamp";
        c_current_graph.CGRAPH_X_AxisData = c_current_logfile.LogFileTime;
        c_current_graph.CGRAPH_Y_AxisData = c_current_logfile.LogFileTemps;

        //Plot Graph
        c_current_graph.ploy_zedgraph (out g_graph);
        System.Drawing.Bitmap bmp_graph =
            new System.Drawing.Bitmap (g_graph.Width, g_graph.Height);

        g_graph.DrawToBitmap(bmp_graph,
            new System.Drawing.Rectangle(0, 0, g_graph.Width, g_graph.Height));

        bmp_graph.Save ("graph.bmp");

        img_graph.ModifyBg (StateType.Normal, CUtil.get_light_grey ());
        img_graph.ModifyBase (StateType.Normal, CUtil.get_light_grey ());
        img_graph.File = "graph.bmp";
        img_graph.QueueDraw ();
        img_graph.ShowAll ();

        /**
         * Fill Alarms Table
         */

        FillAlarmsTable (c_current_logfile.LogFileAlarms);

        file_reader.Close ();
        file_reader.Dispose ();

        nbFrames.CurrentPage = (int)nb_Notebook_Pages.GRAPH;
    }
Пример #2
0
    //========NPLOT===========
    void OnIvFtpBrowserItemActivated_NPlot(object o, ItemActivatedArgs args)
    {
        //TODO: Implement OnIvFtpBrowserItemActivated

        /* Get and parse file.
         * Populate appropriate classes.
         * --> LogFileEntries.
         * --> Graph Class
         * Plot graph and alarms.
         */

        NPlot.Gtk.PlotSurface2D graph = null;

        string selected_file = get_BrowserItem_Value (ivFtpBrowser);
        StreamReader file_reader = c_current_ftp_session.CFTP_GetFile (selected_file);

        Viewport _port = new Viewport (new Adjustment(1000, 500, 1000, 5, 0, 500),
            new Adjustment (500, 500, 500, 0, 0, 500));
        _port.WidthRequest = 2000;
        _port.ResizeMode = ResizeMode.Parent;

        c_current_logfile = new CLogFile
            (
                file_reader,
                c_current_ftp_session.CFTP_LogFileDate,
                c_current_device.DeviceFileDescription
            );

        c_current_graph = new CGraph (c_current_logfile.LogFileEntries);
        //c_current_graph.YAxisCodeIndex = c_current_logfile.CLogFile_Get_Y_Axis_Code_Index (c_current_device);
        c_current_graph.Title = selected_file;
        c_current_graph.YAxisCode = "CURTEMP";
        c_current_graph.YAxisLabel = "Current Temperature";
        c_current_graph.XAxisLabel = "Time Stamp";
        c_current_graph.CGRAPH_X_AxisData = c_current_logfile.LogFileTime;
        c_current_graph.CGRAPH_Y_AxisData = c_current_logfile.LogFileTemps;

        /**
         * Plot Graph
         */

        swGraph.Remove ((Widget)swGraph.Child);

        graph = new PlotSurface2D();
        graph.WidthRequest = 2000;
        graph.Allocation  = (new Gdk.Rectangle (0, 0, 2000, 500));

        c_current_graph.plot_nplot (out graph);

        swGraph.ReallocateRedraws = true;

        //swGraph.AddWithViewport (graph);
        _port.Add (graph);
        swGraph.ResizeMode = ResizeMode.Queue;
        swGraph.Add (_port);
        graph.QueueResize ();
        swGraph.QueueDraw ();
        swGraph.ShowAll ();

        /**
         * Fill Alarms Table
         */

        FillAlarmsTable (c_current_logfile.LogFileAlarms);

        file_reader.Close ();
        file_reader.Dispose ();

        nbFrames.CurrentPage = (int)nb_Notebook_Pages.GRAPH;
    }