コード例 #1
0
ファイル: SingleGraph.cs プロジェクト: Kelvin312/KantVino
        public void AddCurve(GraphPane pane, string name, Color color, int capacity = 8192)
        {
            _dataPointList = new RollingPointPairList(capacity);

            // Добавим кривую пока еще без каких-либо точек
            pane.AddCurve(name, _dataPointList, color, SymbolType.None);
        }
コード例 #2
0
ファイル: SingleGraph.cs プロジェクト: Kelvin312/KantVino
        public void AddCurve(GraphPane pane, string name, string measure, Color color, SymbolType sType, int capacity)
        {
            _dataPointList = new RollingPointPairList(capacity);

            // Добавим кривую пока еще без каких-либо точек
            _myCurve = pane.AddCurve(string.Format("{0} ({1})",name,measure), _dataPointList, color, sType);
        }
コード例 #3
0
        // Constructor
        public LearnANNForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            RollingPointPairList listError = new RollingPointPairList(300);
            RollingPointPairList listValidate = new RollingPointPairList(300);
            RollingPointPairList listValidateP = new RollingPointPairList(300);
            GraphPane myPane = zedGraphControl1.GraphPane;
            LineItem curve = myPane.AddCurve("Качество обучения", listError, Color.Blue, SymbolType.Plus);
            LineItem curve2 = myPane.AddCurve("Кросс-валидация (вероятность)", listValidateP, Color.Green, SymbolType.Triangle);
            LineItem curve3 = myPane.AddCurve("Кросс-валидация (модуль)", listValidate, Color.Goldenrod, SymbolType.XCross);
            myPane.Title.Text = "Обучение нейронной сети";
            myPane.XAxis.Title.Text = "Итерации";
            myPane.YAxis.Title.Text = "Изменение ошибки обучения";
            myPane.XAxis.Scale.MajorStep = 10;
            myPane.YAxis.Scale.MajorStep = 10;
            myPane.XAxis.MajorGrid.Color = Color.Black;
            myPane.YAxis.MajorGrid.Color = Color.Black;
            myPane.Chart.Fill = new Fill(Color.White, Color.LightGray, 45.0f);
            myPane.YAxis.Scale.Max = 100;

            curve.Line.Width = 2.0F;
            curve2.Line.Width = 2.0F;
            curve3.Line.Width = 2.0F;
            myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MajorGrid.IsVisible = true;

            // init controls
            UpdateSettings();
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: seth-obi-msci/CSharp
        private void Form1_Load( object sender, EventArgs e )
        {
            GraphPane myPane = zedGraphControl1.GraphPane;
            myPane.Title.Text = "Test of Dynamic Data Update with ZedGraph\n" +
                    "(After 25 seconds the graph scrolls)";
            myPane.XAxis.Title.Text = "Time, Seconds";
            myPane.YAxis.Title.Text = "Sample Potential, Volts";

            // Save 1200 points.  At 50 ms sample rate, this is one minute
            // The RollingPointPairList is an efficient storage class that always
            // keeps a rolling set of point data without needing to shift any data values
            RollingPointPairList list = new RollingPointPairList( 1200 );

            // Initially, a curve is added with no data points (list is empty)
            // Color is blue, and there will be no symbols
            LineItem curve = myPane.AddCurve( "Voltage", list, Color.Blue, SymbolType.None );

            // Sample at 50ms intervals
            timer1.Interval = 50;
            timer1.Enabled = true;
            timer1.Start();

            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 30;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MajorStep = 5;

            // Scale the axes
            zedGraphControl1.AxisChange();

            // Save the beginning time for reference
            tickStart = Environment.TickCount;
        }
コード例 #5
0
        // ------------------  CHARTING ROUTINES ---------------------

        /// <summary> Sets up the chart. </summary>
        public void SetupChart()
        {
            MasterPane masterPane = chartControl.MasterPane;
            masterPane.PaneList.Clear();

            // get a reference to the GraphPane

            _temperaturePane = new GraphPane(new Rectangle(5, 5, 890, 350),
                "Temperature controller",
                "Time (s)",
                "Temperature (C)");
            masterPane.Add(_temperaturePane);

            // Create data arrays for rolling points
            _analog1List = new RollingPointPairList(3000);
            _analog3List = new RollingPointPairList(3000);
            _analog1List.Clear();
            _analog3List.Clear();

            // Create a smoothened red curve for the current temperature
            LineItem myCurve1 = _temperaturePane.AddCurve("Current temperature", _analog1List, Color.Red, SymbolType.None);
            myCurve1.Line.Width = 2;
            myCurve1.Line.IsSmooth = true;
            myCurve1.Line.SmoothTension = 0.2f;


            // Create a smoothened blue curve for the goal temperature
            LineItem myCurve3 = _temperaturePane.AddCurve("Goal temperature", _analog3List, Color.Blue, SymbolType.None);
            myCurve3.Line.Width = 2;
            myCurve3.Line.IsSmooth = true;
            myCurve3.Line.SmoothTension = 0.2f;
            // Tell ZedGraph to re-calculate the axes since the data have changed
            chartControl.AxisChange();

            _heaterPane = new GraphPane(new Rectangle(5, 360, 890, 250),
                null,
                null,
                null);
            masterPane.Add(_heaterPane);
            
            _heaterList = new RollingPointPairList(3000);
            _heaterPwmList = new RollingPointPairList(3000);
            _heaterList.Clear();
            _heaterPwmList.Clear();

            // Create a red curve for the heater value
            LineItem heaterCurve = _heaterPane.AddCurve(null, _heaterList, Color.YellowGreen, SymbolType.None);
            heaterCurve.Line.Width = 2;
            heaterCurve.Line.IsSmooth = false;

            // Create a red curve for the current heater pwm value
            LineItem heaterPwmCurve = _heaterPane.AddCurve(null, _heaterPwmList, Color.Blue, SymbolType.None);
            heaterPwmCurve.Line.Width = 2;
            heaterPwmCurve.Line.IsSmooth = false;

            SetChartScale(0);
        }
コード例 #6
0
ファイル: FullItemControl.cs プロジェクト: Kelvin312/KantVino
 public FullItemControl()
 {
     InitializeComponent();
     // !!! Создаем массив данных с ограниченной емкостью.
     // При превышениизаданной емкости первые элементы в массиве будут удаляться
     _dataTemper1 = new RollingPointPairList(Capacity);
     _dataTemper2 = new RollingPointPairList(Capacity);
     _dataPressure = new RollingPointPairList(Capacity);
     _dataLevel = new RollingPointPairList(Capacity);
 }
コード例 #7
0
ファイル: GraphTemp.cs プロジェクト: Kelvin312/KantVino
        public void AddCurve(string name, Color color, int capacity = 8192)
        {
            _dataPointList = new RollingPointPairList(capacity);

            GraphPane pane = _gControl.GraphPane;

            // Очистим список кривых на тот случай, если до этого сигналы уже были нарисованы
            pane.CurveList.Clear();
            // Добавим кривую пока еще без каких-либо точек
            pane.AddCurve(name, _dataPointList, color, SymbolType.None);
        }
コード例 #8
0
ファイル: RssiGraphControl.cs プロジェクト: kaaLabs15/LoRa
        public RssiGraphControl()
        {
            InitializeComponent();

            graph.ContextMenuBuilder += new ZedGraphControl.ContextMenuBuilderEventHandler(graph_ContextMenuBuilder);
            graph.IsShowPointValues = true;
            for (int index = 0; index < graphCurveListPoints.Length; ++index)
                graphCurveListPoints[index] = new RollingPointPairList(1200);
            MasterPaneInit();
            MasterPaneAddGraph(CreateLineGraph(3, "", "Samples", "Power [dBm]", true, true, false, true, false, false, true, false));
            MasterPaneLayout();
        }
コード例 #9
0
ファイル: RssiGraphControl.cs プロジェクト: JamesH001/SX1231
		public GraphPane CreateLineGraph(int nSeries, string title, string xAxisTitle, string yAxisTitle, bool xAxisTitleVisible, bool yAxisTitleVisible, bool xScaleVisible, bool yScaleVisible, bool xMajorGridVisible, bool xIsBetweenLabels, bool yMajorGridVisible, bool yIsBetweenLabels)
		{
			GraphPane graphPane = new GraphPane();
			SetupGraphPane(graphPane, title, xAxisTitle, yAxisTitle, xAxisTitleVisible, yAxisTitleVisible, xScaleVisible, yScaleVisible, xMajorGridVisible, xIsBetweenLabels, yMajorGridVisible, yIsBetweenLabels);
			RollingPointPairList[] listArray = new RollingPointPairList[nSeries];
			for (int i = 0; i < listArray.Length; i++)
			{
				listArray[i] = new RollingPointPairList(0x4b0);
				graphPane.AddCurve("", listArray[i], graphDataColors[i], SymbolType.None);
			}
			return graphPane;
		}
コード例 #10
0
		public SpectrumGraphControl()
		{
			InitializeComponent();
			graph.ContextMenuBuilder += new ZedGraphControl.ContextMenuBuilderEventHandler(graph_ContextMenuBuilder);
			graph.IsShowPointValues = true;
			for (int i = 0; i < graphCurveListPoints.Length; i++)
			{
				graphCurveListPoints[i] = new RollingPointPairList(0x4b0);
			}
			MasterPaneInit();
			MasterPaneAddGraph(CreateLineGraph(1, "", "Frequency [MHz]", "Power [dBm]", true, true, true, true, false, false, true, false));
			MasterPaneLayout();
		}
コード例 #11
0
        public PressPlot()
        {
            InitializeComponent();
            PressPane = zedGraphControl1.GraphPane;
            PressPane.Title.IsVisible = false;
            PressPane.XAxis.Title.Text = "time (sec)";
            PressPane.YAxis.Title.Text = "pressure (Pa)";
            PressPane.Y2Axis.IsVisible = true;
            PressPane.Y2Axis.Title.Text = "temperature (degC)";

            // Save 1200 points.  At 50 ms sample rate, this is one minute
            // The RollingPointPairList is an efficient storage class that always
            // keeps a rolling set of point data without needing to shift any data values
            RollingPointPairList xlist = new RollingPointPairList(20000);
            RollingPointPairList ylist = new RollingPointPairList(20000);

            // Initially, a curve is added with no data points (list is empty)
            // Color is blue, and there will be no symbols
            LineItem curve1 = PressPane.AddCurve("pressure", xlist, Color.Blue, SymbolType.None);
            LineItem curve2 = PressPane.AddCurve("temparature", ylist, Color.Red, SymbolType.None);
            curve2.IsY2Axis = true;

            // Sample at 50ms intervals
            timer1.Interval = 250;
            timer1.Enabled = true;
            timer1.Start();

            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps
            PressPane.XAxis.Scale.Min = 0;
            PressPane.XAxis.Scale.Max = (double)numericUpDown1.Value;
            PressPane.XAxis.Scale.MinorStep = 1;
            PressPane.XAxis.Scale.MajorStep = 5;
            PressPane.YAxis.Scale.Max = 110000;
            PressPane.YAxis.Scale.Min = 110000 / 5;
            PressPane.YAxis.MajorTic.IsOpposite = false;
            PressPane.YAxis.MinorTic.IsOpposite = false;
            PressPane.Y2Axis.MajorTic.IsOpposite = false;
            PressPane.Y2Axis.MinorTic.IsOpposite = false;
            PressPane.Y2Axis.MajorGrid.IsZeroLine = false;
            PressPane.Y2Axis.Scale.MajorStep = 20;
            PressPane.Y2Axis.Scale.MinorStep = 5;
            PressPane.Y2Axis.Scale.Max = 80;
            PressPane.Y2Axis.Scale.Min = -20;

            // Scale the axes
            zedGraphControl1.AxisChange();

            // Save the beginning time for reference
            tickStart = Environment.TickCount;
        }
コード例 #12
0
        private void Form1_Load(object sender, EventArgs e)
        {
            GraphPane myPane = zedGraphControl1.GraphPane;
            myPane.Title.Text = "Offsets";

            port.Encoding = Encoding.GetEncoding(28591);
            port.DataReceived += new
              SerialDataReceivedEventHandler(port_DataReceived);

            // Begin communications
            port.Open();

            // Save 1200 points.  At 50 ms sample rate, this is one minute
            // The RollingPointPairList is an efficient storage class that always
            // keeps a rolling set of point data without needing to shift any data values
            RollingPointPairList list_x = new RollingPointPairList(1200);
            RollingPointPairList list_y = new RollingPointPairList(1200);
            RollingPointPairList list_z = new RollingPointPairList(1200);

            // Initially, a curve is added with no data points (list is empty)
            // Color is blue, and there will be no symbols
            curve_x = myPane.AddCurve("X", list_x, Color.Blue, SymbolType.None);
            curve_y = myPane.AddCurve("Y", list_y, Color.Green, SymbolType.None);
            curve_z = myPane.AddCurve("Z", list_z, Color.Pink, SymbolType.None);

            // Sample at 50ms intervals
            timer1.Tick += new EventHandler(timer1_Tick);
            timer1.Interval = 100;
            timer1.Enabled = true;
            timer1.Start();

            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps
            myPane.XAxis.Title.Text = "Time";
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 30;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MajorStep = 5;

            myPane.YAxis.Title.Text = "G-force";

            // Scale the axes
            zedGraphControl1.AxisChange();

            // Save the beginning time for reference
            tickStart = Environment.TickCount;
        }
コード例 #13
0
ファイル: Form1.cs プロジェクト: Lords08/alanarduinotools
        private void Form1_Load(object sender, EventArgs e)
        {
            mPort = new SerialPort("COM18");
            mPort.BaudRate = 115200;
            mPort.DataBits = 8;
            mPort.ReadTimeout = 500;

            mPort.Open();

            #region Setup zedgraph
            //http://zedgraph.org/wiki/index.php?title=Display_Dynamic_or_Real-Time_Data
            GraphPane myPane = zgGraph.GraphPane;
            myPane.Title.Text = "Analog data";
            myPane.XAxis.Title.Text = "Time, Seconds";
            myPane.YAxis.Title.Text = "Input";

            // Save 1200 points.  At 50 ms sample rate, this is one minute
            // The RollingPointPairList is an efficient storage class that always
            // keeps a rolling set of point data without needing to shift any data values
            RollingPointPairList list = new RollingPointPairList(1200);

            RollingPointPairList listAvg = new RollingPointPairList(1200);

            // Initially, a curve is added with no data points (list is empty)
            // Color is blue, and there will be no symbols
            LineItem curve = myPane.AddCurve("Input", list, Color.Blue, SymbolType.None);

            LineItem curveAvg = myPane.AddCurve("Average", listAvg, Color.Red, SymbolType.None);

            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 30;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MajorStep = 5;

            // Scale the axes
            zgGraph.AxisChange();

            // Save the beginning time for reference
            tickStart = Environment.TickCount;

            #endregion

            ThreadPool.QueueUserWorkItem(new WaitCallback(this.ReadSerial));
        }
コード例 #14
0
        public void CreateGraph(ZedGraphControl zedGraphControl1, RollingPointPairList list1)
        {
            GraphPane myPane = zedGraphControl1.GraphPane;

            myPane.Title.Text       = "Oscilloscope";
            myPane.XAxis.Title.Text = "Samples";
            myPane.YAxis.Title.Text = "Volts";
            zedGraphControl1.GraphPane.CurveList.Clear();
            zedGraphControl1.GraphPane.GraphObjList.Clear();
            zedGraphControl1.IsZoomOnMouseCenter = true;
            zedGraphControl1.IsShowHScrollBar    = true;
            zedGraphControl1.IsAutoScrollRange   = true;
            zedGraphControl1.IsShowVScrollBar    = true;
            zedGraphControl1.IsAutoScrollRange   = true;
            Double.TryParse(Window_Size.Text, out window);
            LineItem myCurve = myPane.AddCurve("", list1, Color.Red, SymbolType.None);

            //
            if (Stream.Checked)
            {
                myPane.XAxis.Scale.Min = 0;
                myPane.XAxis.Scale.Max = window;
            }
            else
            {
                myPane.XAxis.Scale.Max = time;
                if (time > window)
                {
                    myPane.XAxis.Scale.Min = time - window;
                }
                else
                {
                    myPane.XAxis.Scale.Min = 0;
                }
            }
            myPane.XAxis.MajorGrid.IsVisible      = true;
            myPane.YAxis.Scale.MaxAuto            = true;
            myPane.YAxis.Scale.FontSpec.FontColor = Color.Red;
            myPane.YAxis.Title.FontSpec.FontColor = Color.Red;
            myPane.YAxis.MajorTic.IsOpposite      = false;
            myPane.YAxis.MinorTic.IsOpposite      = false;
            myPane.YAxis.MajorGrid.IsZeroLine     = false;
            myPane.YAxis.Scale.Align = AlignP.Inside;
            myPane.Chart.Fill        = new Fill(Color.White, Color.LightGray, 45.0f);
            zedGraphControl1.AxisChange();
        }
コード例 #15
0
ファイル: Form1.cs プロジェクト: jakemdrew/UBICOMP
        private void Form1_Load(object sender, EventArgs e)
        {
            // Get a reference to the GraphPane instance in the ZedGraphControl
            GraphPane myPane = zg1.GraphPane;

            // Set the titles and axis labels
            myPane.Title.Text = "A0 ADC Graph";
            myPane.XAxis.Title.Text = "Sample Timeline";
            myPane.YAxis.Title.Text = "Sample Voltage";

            // Save the last 300 points in this structure. 
            RollingPointPairList list = new RollingPointPairList(300);

            // Initially, a curve is added with no data points (list is empty)
            // Color is blue, and there will be no symbols
            LineItem curve = myPane.AddCurve("A0 Voltage", list, Color.Blue, SymbolType.None);

            // Fill the axis background with a gradient
            myPane.Chart.Fill = new Fill(Color.White, Color.LightGray, 45.0f);

            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 300;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MajorStep = 5;

            //myPane.YAxis.Scale.Min = 0;
            //myPane.YAxis.Scale.Max = 260;
            //myPane.YAxis.Scale.MinorStep = 1;
            //myPane.YAxis.Scale.MajorStep = 5;

            // Scale the axes
            zg1.AxisChange();

            //Create a reference to my Arduino controller.
            arduinoController = new ArduinoController(zg1);

            //Send command to start getting readings from arduino 
            arduinoController.sendCmd(ArduinoControllerCmd.sampleA0);
        }
コード例 #16
0
        /// <summary>
        /// Initializes the ZedGraph
        /// </summary>
        public void LoadZedGraph()
        {
            RectangleF rectF;
            GraphPane myPane = zedgraph.GraphPane;
            myPane.Title.Text = "Audio";
            myPane.XAxis.Title.Text = "Zeit [s]";
            myPane.YAxis.Title.Text = "Amplitude";

            //Manually set the axis for the Graph
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = Statics.timeDisplay / Statics.FS;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MajorStep = 2;

            myPane.YAxis.Scale.Min = 0-Statics.offset;
            myPane.YAxis.Scale.Max = 1024-Statics.offset;
            myPane.YAxis.Scale.MinorStep = 40;
            myPane.YAxis.Scale.MajorStep = 200;

            // Save 1200 points.  At 50 ms sample rate, this is one minute
            // The RollingPointPairList is an efficient storage class that always
            // keeps a rolling set of point data without needing to shift any data values
            RollingPointPairList list = new RollingPointPairList(Statics.FS*2);

            // Initially, a curve is added with no data points (list is empty)
            // Color is blue, and there will be no symbols
            LineItem curve = myPane.AddCurve("Audio", list, Color.Blue, SymbolType.None);
            curve.Label.IsVisible = false;

            // Scale the axes
            zedgraph.AxisChange();

            //Initialize the Rectangle for redrawing
            rectF = myPane.Chart.Rect;
            rect = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height);

            //Hide Border
            //myPane.Border.IsVisible = false;
            myPane.Border.Color = Color.SteelBlue;
            myPane.Border.Width = 3;
        }
コード例 #17
0
ファイル: AccPlot.cs プロジェクト: shintamainjp/NinjaScan_GUI
        public AccPlot()
        {
            InitializeComponent();
            gyroPane = zedGraphControl1.GraphPane;
            gyroPane.Title.IsVisible = false;
            gyroPane.XAxis.Title.Text = "time (sec)";
            gyroPane.YAxis.Title.Text = "acceleration (g)";

            // Save 1200 points.  At 50 ms sample rate, this is one minute
            // The RollingPointPairList is an efficient storage class that always
            // keeps a rolling set of point data without needing to shift any data values
            RollingPointPairList xlist = new RollingPointPairList(2000);
            RollingPointPairList ylist = new RollingPointPairList(2000);
            RollingPointPairList zlist = new RollingPointPairList(2000);

            // Initially, a curve is added with no data points (list is empty)
            // Color is blue, and there will be no symbols
            LineItem curve = gyroPane.AddCurve("x axis", xlist, Color.Blue, SymbolType.None);
            curve = gyroPane.AddCurve("y axis", ylist, Color.Red, SymbolType.None);
            curve = gyroPane.AddCurve("z axis", zlist, Color.Green, SymbolType.None);

            // Sample at 50ms intervals
            timer1.Interval = 10;
            timer1.Enabled = true;
            timer1.Start();

            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps
            gyroPane.XAxis.Scale.Min = 0;
            gyroPane.XAxis.Scale.Max = (double)numericUpDown1.Value;
            gyroPane.XAxis.Scale.MinorStep = 0.5;
            gyroPane.XAxis.Scale.MajorStep = 1;
            gyroPane.YAxis.Scale.Max = A_Page.fullScale_acc / 4;
            gyroPane.YAxis.Scale.Min = -A_Page.fullScale_acc / 4;

            // Scale the axes
            zedGraphControl1.AxisChange();

            // Save the beginning time for reference
            tickStart = Environment.TickCount;
        }
コード例 #18
0
ファイル: Graph.cs プロジェクト: kabzo/NXTuino
        public Graph(ZedGraphControl zedGraphControl1, string graphTitle, string xAxisTitle, string yAxisTitle, string name1,string name2,string name3)
        {
            this.zedGraphControl1 = zedGraphControl1;
            GraphPane myPane = zedGraphControl1.GraphPane;
            myPane.Title.Text = graphTitle;
            myPane.XAxis.Title.Text = xAxisTitle;
            myPane.YAxis.Title.Text = yAxisTitle;

            // Save 1200 points.  At 50 ms sample rate, this is one minute
            // The RollingPointPairList is an efficient storage class that always
            // keeps a rolling set of point data without needing to shift any data values
            RollingPointPairList list1 = new RollingPointPairList(70000);
            RollingPointPairList list2 = new RollingPointPairList(70000);
            RollingPointPairList list3 = new RollingPointPairList(70000);

            // Initially, a curve is added with no data points (list is empty)
            // Color is blue, and there will be no symbol
            LineItem curve1 = myPane.AddCurve(name1, list1, Color.Red, SymbolType.None);
            LineItem curve2 = myPane.AddCurve(name2, list2, Color.Blue, SymbolType.None);
            LineItem curve3 = myPane.AddCurve(name3, list3, Color.Green, SymbolType.None);
            curve1.Line.Width = 1.75F;
            curve2.Line.Width = 1.75F;
            curve3.Line.Width = 1.75F;
               //curve.Line.Fill = new Fill(Color.White, Color.Red, 45F);
            //curve.Line.Width = 2F;

            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 50;
            myPane.XAxis.Scale.MinorStep = 0;
            myPane.XAxis.Scale.MajorStep = 5;

            // Scale the axes
            zedGraphControl1.AxisChange();

            // Save the beginning time for reference
            tickStart = Environment.TickCount;
        }
コード例 #19
0
        /// <summary>
        /// Initliase the Active Learning graph
        /// </summary>
        private void InitialiseActiveLearningGraphs()
        {
            //AccuracyGraph Settings
            accuracyGraphPane = graphControlAccuracyGraph.GraphPane;
            accuracyGraphPane.CurveList.Clear() ; //clear the curveList in the graphpane

            //set x starting point of the AccuracyGraph
            accuracyGraphPane.XAxis.Scale.Min = currentExperimentSetting.initialStartingLabel - 1;

            //add curves into the accuracyGraphPane
            List<ExperimentModel> currentExperimentItemsList = currentExperimentSetting.experimentModels;

            for (int i = 0; i < currentExperimentItemsList.Count; i++)
            {
                // The RollingPointPairList is an efficient storage class that always
                // keeps a rolling set of point data without needing to shift any data values
                RollingPointPairList list = new RollingPointPairList(currentExperimentSetting.currentDataset.totalNumberOfLabellingRows);

                //Add the curve with an empty datalist into the accuracyGraphPane
                LineItem curve = accuracyGraphPane.AddCurve(currentExperimentItemsList[i].ToString(), list, colourOptions[i], SymbolType.None);
                curve.Line.Width = 2.0f;
            }

            //scale the axes
            accuracyGraphPane.AxisChange();
            //set the CurveList
            accuracyGraphCurveList = accuracyGraphPane.CurveList;
            graphControlAccuracyGraph.Visible = true;
           
        }
コード例 #20
0
ファイル: mainGUI.cs プロジェクト: cooldragon1/mw-wingui
        private void mainGUI_Load(object sender, EventArgs e)
        {
            //First step, check it gui_settings file is exists or not, if not then start settings wizard
            if (!File.Exists(sGuiSettingsFilename))
            {
                setup_wizard panelSetupWizard = new setup_wizard();
                panelSetupWizard.ShowDialog();

            }

            //Now there must be a valid settings file, so we can continue with normal execution

            splash_screen splash = new splash_screen();
            splash.sVersionLabel = sVersion;
            splash.Show();
            splash.Refresh();
            //Start with Settings file read, and parse exit if unsuccessfull
            gui_settings = new GUI_settings();
            if (!gui_settings.read_from_xml(sGuiSettingsFilename))
            {
                Environment.Exit(-1);
            }

            sOptionsConfigFilename = sOptionsConfigFilename + gui_settings.iSoftwareVersion + ".xml";
            read_options_config();                  //read and parse optionsconfig.xml file. sets iCheckBoxItems

            mw_gui = new mw_data_gui(iPidItems, iCheckBoxItems, gui_settings.iSoftwareVersion,gui_settings.bSupressI2CErrorData);

            mw_params = new mw_settings(iPidItems, iCheckBoxItems, gui_settings.iSoftwareVersion);

            //Define FC version dependant thingys :D
            if (gui_settings.iSoftwareVersion == 20)
            {
                PID_ROLL = 0; PID_PITCH = 1; PID_YAW = 2; PID_ALT = 3; PID_VEL = 4; PID_GPS = 5; PID_LEVEL = 6; PID_MAG = 7;
                iPacketSizeM = iPacketSizeM20;
                sRelName = sRelName20;
                splash.sFcVersionLabel = "MultiWii version " + sRelName20;
                if (gui_settings.bSupressI2CErrorData)
                {
                    l_i2cdatasupress.Text = "dev20120203 combatibity mode enabled";
                    iPacketSizeM = 153;     //This is hardcoded and eventually will be removed once MultiWii 2.0 is released
                    splash.sFcVersionLabel += Environment.NewLine + "20120203 compatibility mode";
                }
                splash.Refresh();


            }
            if (gui_settings.iSoftwareVersion == 19)
            {
                PID_ROLL = 0; PID_PITCH = 1; PID_YAW = 2; PID_ALT = 3; PID_VEL = 4; PID_LEVEL = 5; PID_MAG = 6;
                iPacketSizeM = iPacketSizeM19;
                sRelName = sRelName19;
                nPID_level_d.Visible = false;
                groupBoxGPS.Visible = false;
                splash.sFcVersionLabel = "MultiWii version " + sRelName19;
                splash.Refresh();

            }

            bSerialBuffer = new byte[iPacketSizeM];

            ToolTip toolTip1 = new ToolTip();
            toolTip1.AutoPopDelay = 5000;
            toolTip1.InitialDelay = 1000;
            toolTip1.ReshowDelay = 500;
            toolTip1.ShowAlways = true;

            rcOptions1 = new byte[iCheckBoxItems];
            rcOptions2 = new byte[iCheckBoxItems];

            //Fill out settings tab
            l_Capture_folder.Text = gui_settings.sCaptureFolder;
            l_LogFolder.Text = gui_settings.sLogFolder;
            l_Settings_folder.Text = gui_settings.sSettingsFolder;

            cb_Logging_enabled.Checked = gui_settings.bEnableLogging;
            switch (gui_settings.iSoftwareVersion)
            {
                case 19:
                    rb_sw19.Checked = true;
                    break;
                case 20:
                    rb_sw20.Checked = true;
                    break;
                default:
                    rb_sw20.Checked = true;
                    break;
            }

            //Set log enties checkboxes
            cb_Log1.Checked = gui_settings.logGraw;
            cb_Log2.Checked = gui_settings.logGatt;
            cb_Log3.Checked = gui_settings.logGmag;
            cb_Log4.Checked = gui_settings.logGrcc;
            cb_Log5.Checked = gui_settings.logGrcx;
            cb_Log6.Checked = gui_settings.logGmot;
            cb_Log7.Checked = gui_settings.logGsrv;
            cb_Log8.Checked = gui_settings.logGnav;
            cb_Log9.Checked = gui_settings.logGpar;
            cb_Log10.Checked = gui_settings.logGdbg;


            //Build the RC control checkboxes structure

            aux = new CheckBoxEx[4, 4, iCheckBoxItems];

            int startx = 200;
            int starty = 60;

            int a, b, c;
            for (c = 0; c < 4; c++)
            {
                for (a = 0; a < 3; a++)
                {
                    for (b = 0; b < iCheckBoxItems; b++)
                    {
                        aux[c, a, b] = new CheckBoxEx();
                        aux[c, a, b].Location = new Point(startx + a * 18 + c * 70, starty + b * 25);
                        aux[c, a, b].Visible = true;
                        aux[c, a, b].Text = "";
                        aux[c, a, b].AutoSize = true;
                        aux[c, a, b].Size = new Size(16, 16);
                        aux[c, a, b].UseVisualStyleBackColor = true;
                        aux[c, a, b].CheckedChanged += new System.EventHandler(this.aux_checked_changed_event);
                        //Set info on the given checkbox position
                        aux[c, a, b].aux = c;           //Which aux channel
                        aux[c, a, b].rclevel = a;       //which rc level
                        aux[c, a, b].item = b;          //Which item
                        this.tabPageRC.Controls.Add(aux[c, a, b]);

                    }
                }
            }

            aux_labels = new System.Windows.Forms.Label[4];
            lmh_labels = new System.Windows.Forms.Label[4, 3];          // aux1-4, L,M,H
            string strlmh = "LMH";
            for (a = 0; a < 4; a++)
            {
                aux_labels[a] = new System.Windows.Forms.Label();
                aux_labels[a].Text = "AUX" + String.Format("{0:0}", a + 1);
                aux_labels[a].Location = new Point(startx + a * 70 + 8, starty - 35);
                aux_labels[a].AutoSize = true;
                aux_labels[a].ForeColor = Color.White;
                this.tabPageRC.Controls.Add(aux_labels[a]);
                for (b = 0; b < 3; b++)
                {
                    lmh_labels[a, b] = new System.Windows.Forms.Label();
                    lmh_labels[a, b].Text = strlmh.Substring(b, 1); ;
                    lmh_labels[a, b].Location = new Point(startx + a * 70 + b * 18, starty - 20);
                    lmh_labels[a, b].AutoSize = true;
                    lmh_labels[a, b].ForeColor = Color.White;
                    this.tabPageRC.Controls.Add(lmh_labels[a, b]);
                }

            }

            cb_labels = new System.Windows.Forms.Label[20];

            for (z = 0; z < iCheckBoxItems; z++)
            {
                cb_labels[z] = new System.Windows.Forms.Label();
                cb_labels[z].Text = option_names[z];
                cb_labels[z].Location = new Point(10, starty + z * 25);
                cb_labels[z].Visible = true;
                cb_labels[z].AutoSize = true;
                cb_labels[z].ForeColor = Color.White;
                cb_labels[z].TextAlign = ContentAlignment.MiddleRight;
                toolTip1.SetToolTip(cb_labels[z], option_desc[z]);
                this.tabPageRC.Controls.Add(cb_labels[z]);
            }


            if (gui_settings.iSoftwareVersion == 19)
            {
                //Hide AUX3-AUX4 settings
                aux_labels[2].Visible = false;
                aux_labels[3].Visible = false;
                lmh_labels[2, 0].Visible = false;
                lmh_labels[2, 1].Visible = false;
                lmh_labels[2, 2].Visible = false;
                lmh_labels[3, 0].Visible = false;
                lmh_labels[3, 1].Visible = false;
                lmh_labels[3, 2].Visible = false;

                for (int i = 0; i < iCheckBoxItems; i++)
                {
                    aux[2, 0, i].Visible = false;
                    aux[2, 1, i].Visible = false;
                    aux[2, 2, i].Visible = false;
                    aux[3, 0, i].Visible = false;
                    aux[3, 1, i].Visible = false;
                    aux[3, 2, i].Visible = false;
                }
            }

            this.Refresh();

            serial_ports_enumerate();
            foreach (string speed in sSerialSpeeds)
            {
                cb_serial_speed.Items.Add(speed);
            }
            cb_serial_speed.SelectedItem = gui_settings.sPreferedSerialSpeed;

            if (cb_serial_port.Items.Count == 0)
            {
                b_connect.Enabled = false;          //Nos serial port, disable connect
            }

            //Init serial port object
            serialPort = new SerialPort();
            //Set up serial port parameters (at least the ones what we know upfront
            serialPort.DataBits = 8;
            serialPort.Parity = Parity.None;
            serialPort.StopBits = StopBits.One;
            serialPort.Handshake = Handshake.None;
            serialPort.DtrEnable = false;               //??

            serialPort.ReadBufferSize = 4096;            //4K byte of read buffer
            serialPort.ReadTimeout = 500;               // 500msec timeout;

            //Init Realtime Monitor panel controls
            foreach (string rate in sRefreshSpeeds)
            {
                cb_monitor_rate.Items.Add(rate);
            }
            cb_monitor_rate.SelectedIndex = 0;              //20Hz is the default

            //Setup timers
            timer_realtime.Tick += new EventHandler(timer_realtime_Tick);
            timer_realtime.Interval = iRefreshIntervals[cb_monitor_rate.SelectedIndex];
            timer_realtime.Enabled = true;
            timer_realtime.Stop();

            timer_rc.Tick += new EventHandler(timer_rc_Tick);
            timer_rc.Interval = 100; //(10Hz)
            timer_rc.Enabled = true;
            timer_rc.Stop();


            //Set up zgMonitor control for real time monitoring
            GraphPane myPane = zgMonitor.GraphPane;

            // Set the titles and axis labels
            myPane.Title.Text = "";
            myPane.XAxis.Title.Text = "";
            myPane.YAxis.Title.Text = "";

            //Set up pointlists and curves
            list_acc_roll = new RollingPointPairList(300);
            curve_acc_roll = myPane.AddCurve("acc_roll", list_acc_roll, Color.Red, SymbolType.None);

            list_acc_pitch = new RollingPointPairList(300);
            curve_acc_pitch = myPane.AddCurve("acc_pitch", list_acc_pitch, Color.Green, SymbolType.None);

            list_acc_z = new RollingPointPairList(300);
            curve_acc_z = myPane.AddCurve("acc_z", list_acc_z, Color.Blue, SymbolType.None);

            list_gyro_roll = new RollingPointPairList(300);
            curve_gyro_roll = myPane.AddCurve("gyro_roll", list_gyro_roll, Color.Khaki, SymbolType.None);

            list_gyro_pitch = new RollingPointPairList(300);
            curve_gyro_pitch = myPane.AddCurve("gyro_pitch", list_gyro_pitch, Color.Cyan, SymbolType.None);

            list_gyro_yaw = new RollingPointPairList(300);
            curve_gyro_yaw = myPane.AddCurve("gyro_yaw", list_gyro_yaw, Color.Magenta, SymbolType.None);

            list_mag_roll = new RollingPointPairList(300);
            curve_mag_roll = myPane.AddCurve("mag_roll", list_mag_roll, Color.CadetBlue, SymbolType.None);

            list_mag_pitch = new RollingPointPairList(300);
            curve_mag_pitch = myPane.AddCurve("mag_pitch", list_mag_pitch, Color.MediumPurple, SymbolType.None);

            list_mag_yaw = new RollingPointPairList(300);
            curve_mag_yaw = myPane.AddCurve("mag_yaw", list_mag_yaw, Color.DarkGoldenrod, SymbolType.None);

            list_alt = new RollingPointPairList(300);
            curve_alt = myPane.AddCurve("alt", list_alt, Color.White, SymbolType.None);

            list_head = new RollingPointPairList(300);
            curve_head = myPane.AddCurve("head", list_head, Color.Orange, SymbolType.None);

            list_dbg1 = new RollingPointPairList(300);
            curve_dbg1 = myPane.AddCurve("dbg1", list_dbg1, Color.PaleTurquoise, SymbolType.None);

            list_dbg2 = new RollingPointPairList(300);
            curve_dbg2 = myPane.AddCurve("dbg2", list_dbg2, Color.PaleTurquoise, SymbolType.None);

            list_dbg3 = new RollingPointPairList(300);
            curve_dbg3 = myPane.AddCurve("dbg3", list_dbg3, Color.PaleTurquoise, SymbolType.None);

            list_dbg4 = new RollingPointPairList(300);
            curve_dbg4 = myPane.AddCurve("dbg4", list_dbg4, Color.PaleTurquoise, SymbolType.None);

            // Show the x axis grid
            myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MajorGrid.IsVisible = true;

            myPane.XAxis.Scale.IsVisible = false;

            // Make the Y axis scale red
            myPane.YAxis.Scale.FontSpec.FontColor = Color.White;
            myPane.YAxis.Title.FontSpec.FontColor = Color.White;
            // turn off the opposite tics so the Y tics don't show up on the Y2 axis
            myPane.YAxis.MajorTic.IsOpposite = false;
            myPane.YAxis.MinorTic.IsOpposite = false;
            // Don't display the Y zero line
            myPane.YAxis.MajorGrid.IsZeroLine = true;
            // Align the Y axis labels so they are flush to the axis
            myPane.YAxis.Scale.Align = AlignP.Inside;
            myPane.YAxis.Scale.IsVisible = false;
            // Manually set the axis range
            myPane.YAxis.Scale.Min = -150;
            myPane.YAxis.Scale.Max = 150;

            myPane.Chart.Fill = new Fill(Color.DimGray, Color.DarkGray, 45.0f);
            myPane.Fill = new Fill(Color.DimGray, Color.DimGray, 45.0f);
            myPane.Legend.IsVisible = false;
            myPane.XAxis.Scale.IsVisible = false;
            myPane.YAxis.Scale.IsVisible = true;

            myPane.XAxis.Scale.MagAuto = true;
            myPane.YAxis.Scale.MagAuto = false;

            zgMonitor.IsEnableHPan = true;
            zgMonitor.IsEnableHZoom = true;

            foreach (ZedGraph.LineItem li in myPane.CurveList)
            {
                li.Line.Width = 1;
            }


            myPane.YAxis.Title.FontSpec.FontColor = Color.White;
            myPane.XAxis.Title.FontSpec.FontColor = Color.White;

            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 300;
            myPane.XAxis.Type = AxisType.Linear;
            
            
            
            zgMonitor.ScrollGrace = 0;
            xScale = zgMonitor.GraphPane.XAxis.Scale;
            zgMonitor.AxisChange();

            pictureBox2.BorderStyle = BorderStyle.None;

            //Init video capture dev
            try
            {
                // enumerate video devices
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

                if (videoDevices.Count == 0)
                    throw new ApplicationException();

                // add all devices to combo
                foreach (FilterInfo device in videoDevices)
                {
                    dropdown_devices.Items.Add(device.Name);
                }
            }
            catch (ApplicationException)
            {
                dropdown_devices.Items.Add("No local capture devices");
                dropdown_devices.Enabled = false;
                b_video_connect.Enabled = false;
            }

            dropdown_devices.SelectedIndex = 0;
            cb_codec.SelectedIndex = 0;

            //Drawing stuff for OSD
            drawPen = new Pen(Color.White, 1);
            drawFont = new System.Drawing.Font(FontFamily.GenericMonospace, 16.0F);
            drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.White);

            System.Threading.Thread.Sleep(2000);
            splash.Close();



        } //End of mainGUI_load
コード例 #21
0
        private void _diskGraphInit(string name)
        {
            Color[] cColor = { Color.AliceBlue, Color.Cyan, Color.Gold };
            RollingPointPairList[] rpList = new RollingPointPairList[2];
            LineItem[] lCurve = new LineItem[3];
            diskGraphControl = new ZedGraphControl();
            GraphPane myPane = diskGraphControl.GraphPane;
            myPane.Chart.Fill.Type = FillType.None;
            myPane.Margin.All = 0;
            myPane.Margin.Top = 2f;
            myPane.Title.Text = "";
            myPane.XAxis.Title.Text = "";
            myPane.YAxis.Title.Text = "";
            myPane.Border.IsVisible = false;
            myPane.Legend.IsVisible = false;
            myPane.XAxis.Scale.IsVisible = false;
            myPane.YAxis.Scale.IsVisible = false;
            myPane.XAxis.IsVisible = false;
            myPane.YAxis.IsVisible = false;
            myPane.YAxis.Scale.Max = 104857600; //~100MBytes/sec
            myPane.YAxis.Scale.MaxAuto = false;
            myPane.YAxis.Scale.Min = 0;
            TextureBrush texBrush = new TextureBrush(Properties.Resources.cpuback);
            myPane.Fill = new Fill(texBrush, true);
            diskGraphControl.Size = new Size(110, 35);//.Dock = DockStyle.Fill;

            tSpan = Properties.Settings.Default.f2TimespanDiskUsage;
            int timer = Properties.Settings.Default.f2TimerDiskUsage, iPL = 1000/timer * tSpan;

            for (int i = 0; i < 2; i++)
            {
                rpList[i] = new RollingPointPairList(iPL);
                lCurve[i] = myPane.AddCurve(name + i.ToString(), rpList[i], cColor[i], SymbolType.None);
                lCurve[i].Line.Width = 0.01F;
                lCurve[i].Line.IsAntiAlias = true;
                lCurve[i].IsVisible = false;
            }
            diskGraphControl.AxisChange();
            diskGraphControl.Visible = false;
        }
コード例 #22
0
ファイル: CorvusM3.cs プロジェクト: changkyuya/corvusm3
        void setupGraph()
        {
            //
            // zedGraphControl1
            //  = new GraphPane();
            counter = 0;

            GraphPane myPane = zedGraphControl1.GraphPane;

            myPane.CurveList.Clear();
            myPane.Title.Text = "Debug Graph";
            myPane.XAxis.Title.Text = "Time";
            myPane.YAxis.Title.Text = "Debug Data";

            if (checkBox1.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 1", list, Color.Blue, SymbolType.None);
            }
            if (checkBox2.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 2", list, Color.Red, SymbolType.None);
            }
            if (checkBox3.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 3", list, Color.Green, SymbolType.None);
            }
            if (checkBox4.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 4", list, Color.Aqua, SymbolType.None);
            }
            if (checkBox5.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 5", list, Color.Orange, SymbolType.None);
            }
            if (checkBox6.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 6", list, Color.LightGreen, SymbolType.None);
            }
            if (checkBox7.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 7", list, Color.DarkBlue, SymbolType.None);
            }
            if (checkBox8.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 8", list, Color.DarkRed, SymbolType.None);
            }
            if (checkBox9.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 9", list, Color.DarkGreen, SymbolType.None);
            }
            if (checkBox10.Checked)
            {
                RollingPointPairList list = new RollingPointPairList(500);
                LineItem curve = myPane.AddCurve("DBG 10", list, Color.Chocolate, SymbolType.None);
            }

            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 100;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MajorStep = 5;

            // Scale the axes
            zedGraphControl1.AxisChange();
        }
コード例 #23
0
        private void InitGraph(string title, string xAxisTitle, string y1AxisTitle, string y2AxisTitle, TimeSeriesDataSource[] dataSourceArray)
        {
            _graphPane = zed.GraphPane;
            _graphPane.Title.Text = title;

			_graphPane.XAxis.Title.Text = xAxisTitle;
			_graphPane.XAxis.MajorGrid.IsVisible = true;

			_graphPane.YAxis.Title.Text = y1AxisTitle;
			_graphPane.YAxis.MajorGrid.IsVisible = true;

			_graphPane.Y2Axis.Title.Text = y2AxisTitle;
			_graphPane.Y2Axis.MajorGrid.IsVisible = false;

            // Create point-pair lists and bind them to the graph control.
            int sourceCount = dataSourceArray.Length;
            _pointPlotArray = new RollingPointPairList[sourceCount];
            for(int i=0; i<sourceCount; i++)
            {
                TimeSeriesDataSource ds = dataSourceArray[i];
                _pointPlotArray[i] = new RollingPointPairList(ds.HistoryLength);
                LineItem lineItem = _graphPane.AddCurve(ds.Name,  _pointPlotArray[i], ds.Color, SymbolType.None);
                lineItem.IsY2Axis = (ds.YAxis == 1);
            }
        }
コード例 #24
0
ファイル: FrmMain.cs プロジェクト: salih18200/orcs
        private void CreateGraph()
        {
            myPane = zedGraphControl1.GraphPane;
            myPane.Title.Text = "Dynamic Data Update\n" + "(MEMS Accelerometer)";
            myPane.XAxis.Title.Text = "Time, Seconds";
            myPane.YAxis.Title.Text = "MEMS, Value";

            // Save 1200 points.  At 50 ms sample rate, this is one minute
            // The RollingPointPairList is an efficient storage class that always
            // keeps a rolling set of point data without needing to shift any data values
            listX = new RollingPointPairList(1200);
            listY = new RollingPointPairList(1200);
            listXs = new RollingPointPairList(1200);
            listYs = new RollingPointPairList(1200);

            // Initially, a curve is added with no data points (list is empty)
            // Color is blue, and there will be no symbols
            curveX = myPane.AddCurve("MEMS X axis", listX, Color.Blue, SymbolType.Circle);
            curveY = myPane.AddCurve("MEMS Y axis", listY, Color.Red, SymbolType.Circle);
            curveXs = myPane.AddCurve("MEMS X trajectory axis", listXs, Color.Green, SymbolType.Triangle);
            curveYs = myPane.AddCurve("MEMS Y trajectory axis", listYs, Color.Pink, SymbolType.Triangle);
            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps

            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 50;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MajorStep = 5;

            // Scale the axes
            zedGraphControl1.AxisChange();
            zedGraphControl1.Invalidate();
        }
コード例 #25
0
ファイル: Form1.cs プロジェクト: Jungwon/ZedGraph
        private void CreateGraph_Junk4( ZedGraphControl z1 )
        {
            GraphPane myPane = z1.GraphPane;
            myPane.XAxis.Title.Text = "date time";
            myPane.YAxis.Title.Text = "Rate";
            Random rd = new Random( 1 );
            RollingPointPairList list = new RollingPointPairList( 1200 );
            DateTime mynow2 = DateTime.Now;

            list.Add( mynow2.ToOADate(), 15 );
            list.Add( mynow2.AddSeconds( 10 ).ToOADate(), 25 );
            LineItem myCurve = myPane.AddCurve( "Rate", list, Color.Green, SymbolType.None );

            myPane.Legend.IsVisible = false;
            myPane.Title.IsVisible = false;

            myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.XAxis.MajorGrid.Color = Color.Green;
            myPane.XAxis.MajorGrid.PenWidth = 1;

            myPane.XAxis.Scale.FontSpec.Angle = 65;

            myPane.YAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MajorGrid.Color = Color.Green;
            myPane.YAxis.MajorGrid.PenWidth = 1;

            myPane.YAxis.Scale.FontSpec.FontColor = Color.Red;
            myPane.YAxis.Title.FontSpec.FontColor = Color.Red;
            myPane.YAxis.MajorTic.IsOpposite = false;
            myPane.YAxis.MinorTic.IsOpposite = false;
            myPane.YAxis.MajorGrid.IsZeroLine = false;
            myPane.YAxis.Scale.Align = AlignP.Inside;
            myPane.YAxis.MajorGrid.IsVisible = true;

            myPane.Chart.Fill = new Fill( Color.Black );
            //timer1.Interval = 500;
            //timer1.Enabled = true;
            //timer1.Start();

            //double gMinTime = new XDate( mynow );
            //double gMaxTime = new XDate( mynow.AddSeconds( 30 ) );
            //double PerSecd = gMaxTime - gMinTime;

            DateTime mynow = DateTime.Now;
            myPane.XAxis.Type = AxisType.Date;
            myPane.XAxis.Scale.Format = "T";
            myPane.XAxis.Scale.MajorUnit = DateUnit.Second;
            myPane.XAxis.Scale.MinorUnit = DateUnit.Second;
            myPane.XAxis.Scale.Min = mynow.ToOADate();
            myPane.XAxis.Scale.Max = mynow.AddSeconds( 30 ).ToOADate();
            myPane.XAxis.Scale.MinorStep = 1;	// 1 second
            myPane.XAxis.Scale.MajorStep = 5;   // 5 seconds
            //mynow.AddMilliseconds( -mynow.Millisecond );
            mynow.AddSeconds( -5 );
            myPane.XAxis.Scale.BaseTic = mynow.ToOADate();

            z1.AxisChange();

            foreach ( GraphObj obj in myPane.GraphObjList )
            {
                if ( obj is TextObj )
                {
                    TextObj text = obj as TextObj;
                    text.FontSpec.Size = 12;
                    text.FontSpec.IsBold = true;
                }
            }
        }
コード例 #26
0
ファイル: MainForm.cs プロジェクト: taiit/Roater_TC4
        /// <summary>
        /// Init pid graph
        /// </summary>
        private void graph_load()
        {
            GraphPane myPane = zed.GraphPane;

            myPane.Title.IsVisible = false;
               // myPane.Title.Text = "MTC Logger";

            myPane.XAxis.Title.Text = "Thời Gian";
            myPane.XAxis.Title.FontSpec.Size = 12.0f;
            myPane.YAxis.Title.Text = "Nhiệt Độ";
            myPane.YAxis.Title.FontSpec.Size = 12.0f;
            RollingPointPairList list = new RollingPointPairList(maxPoint);

            LineItem curve = myPane.AddCurve("Nhiệt Độ", list, Color.Red, SymbolType.None);

            curve.Line.Width = 2;

            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 90;
            myPane.XAxis.Scale.MinorStep = 10;
            myPane.XAxis.Scale.MajorStep = 30;

            myPane.YAxis.Scale.Min = 0;
            myPane.YAxis.Scale.Max = 300;
            myPane.YAxis.Scale.MinorStep = 10;
            myPane.YAxis.Scale.MajorStep = 100;
        }
コード例 #27
0
ファイル: mainGUI.cs プロジェクト: cooldragon1/mw-wingui
        private void mainGUI_Load(object sender, EventArgs e)
        {
            //First step, check it gui_settings file is exists or not, if not then start settings wizard
            if (!File.Exists(sGuiSettingsFilename))
            {
                setup_wizard panelSetupWizard = new setup_wizard();
                panelSetupWizard.ShowDialog();

            }

            //Now there must be a valid settings file, so we can continue with normal execution

            splash_screen splash = new splash_screen();
            splash.sVersionLabel = sVersion;
            splash.Show();
            splash.Refresh();
            //Start with Settings file read, and parse exit if unsuccessfull
            gui_settings = new GUI_settings();
            if (!gui_settings.read_from_xml(sGuiSettingsFilename))
            {
                Environment.Exit(-1);
            }

            //fill out relevant variables
            cbGUISpeechEnabled.Checked = gui_settings.speech_enabled;
            sOptionsConfigFilename = sOptionsConfigFilename + ".xml";
            read_options_config();                  //read and parse optionsconfig.xml file. sets iCheckBoxItems
            iCheckBoxItems = 24;                    //Theoretical maximum

            splash.sStatus = "Building internal data structures...";
            splash.Refresh();

            mw_gui = new mw_data_gui(iPidItems, iCheckBoxItems, gui_settings.iSoftwareVersion);
            mw_params = new mw_settings(iPidItems, iCheckBoxItems, gui_settings.iSoftwareVersion);
            mission_step = new mission_step_structure();

            //Quick hack to get pid names to mw_params untill redo the structures
            for (int i = 0; i < iPidItems; i++)
            {
                mw_params.pidnames[i] = Pid[i].name;
            }

            splash.sFcVersionLabel = "MultiWii version " + sRelName;
            splash.sStatus = "Connecting to MAP server...";
            splash.Refresh();

            MainMap.Manager.Mode = AccessMode.ServerAndCache;
            if (!Stuff.PingNetwork("pingtest.com"))
            {
                MainMap.Manager.Mode = AccessMode.CacheOnly;
                MessageBox.Show("No internet connection available, going to CacheOnly mode.", "GMap.NET - Demo.WindowsForms", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }



            cbMapProviders.SelectedIndex = gui_settings.iMapProviderSelectedIndex;
            MainMap.MapProvider = mapProviders[gui_settings.iMapProviderSelectedIndex];
            MainMap.Zoom = 18;

            splash.sStatus = "Building up GUI elements...";
            splash.Refresh();

            bSerialBuffer = new byte[65];
            inBuf = new byte[300];   //init input buffer

            ToolTip toolTip1 = new ToolTip();
            toolTip1.AutoPopDelay = 5000;
            toolTip1.InitialDelay = 1000;
            toolTip1.ReshowDelay = 500;
            toolTip1.ShowAlways = true;

            //rcOptions1 = new byte[iCheckBoxItems];
            //rcOptions2 = new byte[iCheckBoxItems];

            //Fill out settings tab
            l_Capture_folder.Text = gui_settings.sCaptureFolder;
            l_LogFolder.Text = gui_settings.sLogFolder;
            l_Settings_folder.Text = gui_settings.sSettingsFolder;

            cb_Logging_enabled.Checked = gui_settings.bEnableLogging;

            //Set log enties checkboxes
            cb_Log1.Checked = gui_settings.logGraw;
            cb_Log2.Checked = gui_settings.logGatt;
            cb_Log3.Checked = gui_settings.logGmag;
            cb_Log4.Checked = gui_settings.logGrcc;
            cb_Log5.Checked = gui_settings.logGrcx;
            cb_Log6.Checked = gui_settings.logGmot;
            cb_Log7.Checked = gui_settings.logGsrv;
            cb_Log8.Checked = gui_settings.logGnav;
            cb_Log9.Checked = gui_settings.logGpar;
            cb_Log10.Checked = gui_settings.logGdbg;

            cbCellcount.SelectedIndex = gui_settings.cellcount - 1;
            cbGUISpeechEnabled.Checked = gui_settings.speech_enabled;
            cbSpeakAlt.Checked = gui_settings.announce_alt_enabled;
            cbSpeakBattery.Checked = gui_settings.announce_vbat_enabled;
            cbSpeakDist.Checked = gui_settings.announce_dist_enabled;
            comboSpeakInterval.SelectedIndex = gui_settings.announce_interval;

            b_save_gui_settings.BackColor = Color.Transparent;

            splash.sStatus = "Build PID structures...";
            splash.Refresh();


            //Build servo control arrays
            // It is a mess and not an elegant solution BUT WORKS
            servo_text = new System.Windows.Forms.Label[8];
            servo_text[0] = lSrvName1;
            servo_text[1] = lSrvName2;
            servo_text[2] = lSrvName3;
            servo_text[3] = lSrvName4;
            servo_text[4] = lSrvName5;
            servo_text[5] = lSrvName6;
            servo_text[6] = lSrvName7;
            servo_text[7] = lSrvName8;

            servo_reverse = new CheckBoxEx[8];
            servo_reverse[0] = cbSrvRev1;
            servo_reverse[1] = cbSrvRev2;
            servo_reverse[2] = cbSrvRev3;
            servo_reverse[3] = cbSrvRev4;
            servo_reverse[4] = cbSrvRev5;
            servo_reverse[5] = cbSrvRev6;
            servo_reverse[6] = cbSrvRev7;
            servo_reverse[7] = cbSrvRev8;

            servo_rate = new System.Windows.Forms.NumericUpDown[8];
            servo_rate[0] = nSrvRate1;
            servo_rate[1] = nSrvRate2;
            servo_rate[2] = nSrvRate3;
            servo_rate[3] = nSrvRate4;
            servo_rate[4] = nSrvRate5;
            servo_rate[5] = nSrvRate6;
            servo_rate[6] = nSrvRate7;
            servo_rate[7] = nSrvRate8;

            servo_min = new System.Windows.Forms.NumericUpDown[8];
            servo_min[0] = nSrvMin1;
            servo_min[1] = nSrvMin2;
            servo_min[2] = nSrvMin3;
            servo_min[3] = nSrvMin4;
            servo_min[4] = nSrvMin5;
            servo_min[5] = nSrvMin6;
            servo_min[6] = nSrvMin7;
            servo_min[7] = nSrvMin8;

            servo_mid = new System.Windows.Forms.NumericUpDown[8];
            servo_mid[0] = nSrvMid1;
            servo_mid[1] = nSrvMid2;
            servo_mid[2] = nSrvMid3;
            servo_mid[3] = nSrvMid4;
            servo_mid[4] = nSrvMid5;
            servo_mid[5] = nSrvMid6;
            servo_mid[6] = nSrvMid7;
            servo_mid[7] = nSrvMid8;

            servo_max = new System.Windows.Forms.NumericUpDown[8];
            servo_max[0] = nSrvMax1;
            servo_max[1] = nSrvMax2;
            servo_max[2] = nSrvMax3;
            servo_max[3] = nSrvMax4;
            servo_max[4] = nSrvMax5;
            servo_max[5] = nSrvMax6;
            servo_max[6] = nSrvMax7;
            servo_max[7] = nSrvMax8;


            //Build PID control structure based on the Pid structure.

            const int iLineSpace = 36;
            const int iRow1 = 30;
            const int iRow2 = 130;
            const int iRow3 = 230;
            const int iTopY = 25;
            Font fontField = new Font("Tahoma", 9, FontStyle.Bold);
            Size fieldSize = new Size(70, 25);

            for (int i = 0; i < iPidItems; i++)
            {
                Pid[i].pidLabel = new System.Windows.Forms.Label();
                Pid[i].pidLabel.Text = Pid[i].name;
                Pid[i].pidLabel.Location = new Point(iRow1, 10 + i * iLineSpace);
                Pid[i].pidLabel.Visible = true;
                Pid[i].pidLabel.AutoSize = true;
                Pid[i].pidLabel.ForeColor = Color.White;
                Pid[i].pidLabel.TextAlign = ContentAlignment.MiddleRight;
                toolTip1.SetToolTip(Pid[i].pidLabel, Pid[i].description);
                this.tabPagePID.Controls.Add(Pid[i].pidLabel);

                if (Pid[i].Pshown)
                {
                    Pid[i].Pfield = new System.Windows.Forms.NumericUpDown();
                    Pid[i].Pfield.ValueChanged += new EventHandler(pfield_valuechange);
                    Pid[i].Pfield.Location = new Point(iRow1, iTopY + i * iLineSpace);
                    Pid[i].Pfield.Size = fieldSize;
                    Pid[i].Pfield.Font = fontField;
                    Pid[i].Pfield.BorderStyle = BorderStyle.None;
                    Pid[i].Pfield.Maximum = Pid[i].Pmax;
                    Pid[i].Pfield.Minimum = Pid[i].Pmin;
                    Pid[i].Pfield.DecimalPlaces = decimals(Pid[i].Pprec);
                    Pid[i].Pfield.Increment = 1 / (decimal)Pid[i].Pprec;
                    this.tabPagePID.Controls.Add(Pid[i].Pfield);

                    Pid[i].Plabel = new System.Windows.Forms.Label();
                    Pid[i].Plabel.Text = "P";
                    Pid[i].Plabel.Font = fontField;
                    Pid[i].Plabel.ForeColor = Color.White;
                    Pid[i].Plabel.Location = new Point(iRow1 - 20, iTopY + i * iLineSpace);
                    this.tabPagePID.Controls.Add(Pid[i].Plabel);

                }
                if (Pid[i].Ishown)
                {
                    Pid[i].Ifield = new System.Windows.Forms.NumericUpDown();
                    Pid[i].Ifield.ValueChanged += new EventHandler(ifield_valuechange);
                    Pid[i].Ifield.Location = new Point(iRow2, iTopY + i * iLineSpace);
                    Pid[i].Ifield.Size = fieldSize;
                    Pid[i].Ifield.Font = fontField;
                    Pid[i].Ifield.BorderStyle = BorderStyle.None;
                    Pid[i].Ifield.Maximum = Pid[i].Imax;
                    Pid[i].Ifield.Minimum = Pid[i].Imin;
                    Pid[i].Ifield.DecimalPlaces = decimals(Pid[i].Iprec);
                    Pid[i].Ifield.Increment = 1 / (decimal)Pid[i].Iprec;
                    this.tabPagePID.Controls.Add(Pid[i].Ifield);

                    Pid[i].Ilabel = new System.Windows.Forms.Label();
                    Pid[i].Ilabel.Text = "I";
                    Pid[i].Ilabel.Font = fontField;
                    Pid[i].Ilabel.ForeColor = Color.White;
                    Pid[i].Ilabel.Location = new Point(iRow2 - 20, iTopY + i * iLineSpace);
                    this.tabPagePID.Controls.Add(Pid[i].Ilabel);



                }
                if (Pid[i].Dshown)
                {
                    Pid[i].Dfield = new System.Windows.Forms.NumericUpDown();
                    Pid[i].Dfield.ValueChanged += new EventHandler(dfield_valuechange);
                    Pid[i].Dfield.Location = new Point(iRow3, iTopY + i * iLineSpace);
                    Pid[i].Dfield.Size = fieldSize;
                    Pid[i].Dfield.Font = fontField;
                    Pid[i].Dfield.BorderStyle = BorderStyle.None;
                    Pid[i].Dfield.Maximum = Pid[i].Dmax;
                    Pid[i].Dfield.Minimum = Pid[i].Dmin;
                    Pid[i].Dfield.DecimalPlaces = decimals(Pid[i].Dprec);
                    Pid[i].Dfield.Increment = 1 / (decimal)Pid[i].Dprec;
                    this.tabPagePID.Controls.Add(Pid[i].Dfield);

                    Pid[i].Dlabel = new System.Windows.Forms.Label();
                    Pid[i].Dlabel.Text = "D";
                    Pid[i].Dlabel.Font = fontField;
                    Pid[i].Dlabel.ForeColor = Color.White;
                    Pid[i].Dlabel.Location = new Point(iRow3 - 20, iTopY + i * iLineSpace);
                    this.tabPagePID.Controls.Add(Pid[i].Dlabel);

                }


                //Set up stuff at the mission palane
                txtDefAlt.Text = iDefAlt.ToString();        //Set up default altitude
                txtGTCAlt.Text = iGTCAlt.ToString();        //Set up default Go to Click altitude


            }


            //Tooltips (needs improvement)

            toolTip1.SetToolTip(b_check_all_ACC, "Select all ACC values");
            toolTip1.SetToolTip(b_uncheck_all_ACC, "Deselect all ACC values");
            toolTip1.SetToolTip(lDefAlt, "Default waypoint altitude (in Above Ground Level where Home position Ground level is zero)");
            toolTip1.SetToolTip(txtDefAlt, "Default waypoint altitude (in Above Ground Level where Home position Ground level is zero)");






            this.Refresh();

            splash.sStatus = "Check serial ports...";
            splash.Refresh();



            serial_ports_enumerate();
            foreach (string speed in sSerialSpeeds)
            {
                cb_serial_speed.Items.Add(speed);
            }
            cb_serial_speed.SelectedItem = gui_settings.sPreferedSerialSpeed;

            if (cb_serial_port.Items.Count == 0)
            {
                b_connect.Enabled = false;          //Nos serial port, disable connect
            }

            //Init serial port object
            serialPort = new SerialPort();
            //Set up serial port parameters (at least the ones what we know upfront
            serialPort.DataBits = 8;
            serialPort.Parity = Parity.None;
            serialPort.StopBits = StopBits.One;
            serialPort.Handshake = Handshake.None;
            serialPort.DtrEnable = false;               //??

            serialPort.ReadBufferSize = 4096;            //4K byte of read buffer
            serialPort.ReadTimeout = 500;               // 500msec timeout;




            //Init Realtime Monitor panel controls
            foreach (string rate in sRefreshSpeeds)
            {
                cb_monitor_rate.Items.Add(rate);
            }
            cb_monitor_rate.SelectedIndex = 1;              //10Hz is the default

            splash.sStatus = "Setup Timers...";
            splash.Refresh();



            //Setup timers
            timer_realtime.Tick += new EventHandler(timer_realtime_Tick);
            timer_realtime.Interval = iRefreshIntervals[cb_monitor_rate.SelectedIndex];
            timer_realtime.Enabled = true;
            timer_realtime.Stop();


            splash.sStatus = "Setup zgMonitor control...";
            splash.Refresh();


            //Set up zgMonitor control for real time monitoring
            GraphPane myPane = zgMonitor.GraphPane;

            // Set the titles and axis labels
            myPane.Title.Text = "";
            myPane.XAxis.Title.Text = "";
            myPane.YAxis.Title.Text = "";

            //Set up pointlists and curves
            list_acc_roll = new RollingPointPairList(300);
            curve_acc_roll = myPane.AddCurve("acc_roll", list_acc_roll, Color.Red, SymbolType.None);

            list_acc_pitch = new RollingPointPairList(300);
            curve_acc_pitch = myPane.AddCurve("acc_pitch", list_acc_pitch, Color.Green, SymbolType.None);

            list_acc_z = new RollingPointPairList(300);
            curve_acc_z = myPane.AddCurve("acc_z", list_acc_z, Color.Blue, SymbolType.None);

            list_gyro_roll = new RollingPointPairList(300);
            curve_gyro_roll = myPane.AddCurve("gyro_roll", list_gyro_roll, Color.Khaki, SymbolType.None);

            list_gyro_pitch = new RollingPointPairList(300);
            curve_gyro_pitch = myPane.AddCurve("gyro_pitch", list_gyro_pitch, Color.Cyan, SymbolType.None);

            list_gyro_yaw = new RollingPointPairList(300);
            curve_gyro_yaw = myPane.AddCurve("gyro_yaw", list_gyro_yaw, Color.Magenta, SymbolType.None);

            list_mag_roll = new RollingPointPairList(300);
            curve_mag_roll = myPane.AddCurve("mag_roll", list_mag_roll, Color.CadetBlue, SymbolType.None);

            list_mag_pitch = new RollingPointPairList(300);
            curve_mag_pitch = myPane.AddCurve("mag_pitch", list_mag_pitch, Color.MediumPurple, SymbolType.None);

            list_mag_yaw = new RollingPointPairList(300);
            curve_mag_yaw = myPane.AddCurve("mag_yaw", list_mag_yaw, Color.DarkGoldenrod, SymbolType.None);

            list_alt = new RollingPointPairList(300);
            curve_alt = myPane.AddCurve("alt", list_alt, Color.White, SymbolType.None);

            list_head = new RollingPointPairList(300);
            curve_head = myPane.AddCurve("head", list_head, Color.Orange, SymbolType.None);

            list_dbg1 = new RollingPointPairList(300);
            curve_dbg1 = myPane.AddCurve("dbg1", list_dbg1, Color.PaleTurquoise, SymbolType.None);

            list_dbg2 = new RollingPointPairList(300);
            curve_dbg2 = myPane.AddCurve("dbg2", list_dbg2, Color.PaleTurquoise, SymbolType.None);

            list_dbg3 = new RollingPointPairList(300);
            curve_dbg3 = myPane.AddCurve("dbg3", list_dbg3, Color.PaleTurquoise, SymbolType.None);

            list_dbg4 = new RollingPointPairList(300);
            curve_dbg4 = myPane.AddCurve("dbg4", list_dbg4, Color.PaleTurquoise, SymbolType.None);

            // Show the x axis grid
            myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MajorGrid.IsVisible = true;
            myPane.XAxis.MajorGrid.Color = Color.DarkGray;
            myPane.YAxis.MajorGrid.Color = Color.DarkGray;


            myPane.XAxis.Scale.IsVisible = false;

            // Make the Y axis scale red
            myPane.YAxis.Scale.FontSpec.FontColor = Color.DarkGray;
            myPane.YAxis.Title.FontSpec.FontColor = Color.DarkGray;
            // turn off the opposite tics so the Y tics don't show up on the Y2 axis
            myPane.YAxis.MajorTic.IsOpposite = false;
            myPane.YAxis.MinorTic.IsOpposite = false;
            // Don't display the Y zero line
            myPane.YAxis.MajorGrid.IsZeroLine = true;
            // Align the Y axis labels so they are flush to the axis
            myPane.YAxis.Scale.Align = AlignP.Inside;
            myPane.YAxis.Color = Color.DarkGray;
            myPane.YAxis.Scale.IsVisible = false;
            // Manually set the axis range
            myPane.YAxis.Scale.Min = -300;
            myPane.YAxis.Scale.Max = 300;
            myPane.XAxis.Color = Color.DarkGray;

            myPane.Border.Color = Color.FromArgb(64, 64, 64);

            myPane.Chart.Fill = new Fill(Color.Black, Color.Black, 45.0f);
            myPane.Fill = new Fill(Color.FromArgb(64, 64, 64), Color.FromArgb(64, 64, 64), 45.0f);
            myPane.Legend.IsVisible = false;
            myPane.XAxis.Scale.IsVisible = false;
            myPane.YAxis.Scale.IsVisible = true;

            myPane.XAxis.Scale.MagAuto = true;
            myPane.YAxis.Scale.MagAuto = false;

            zgMonitor.IsEnableHPan = true;
            zgMonitor.IsEnableHZoom = true;

            foreach (ZedGraph.LineItem li in myPane.CurveList)
            {
                li.Line.Width = 1;
            }


            myPane.YAxis.Title.FontSpec.FontColor = Color.DarkGray;
            myPane.XAxis.Title.FontSpec.FontColor = Color.DarkGray;

            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 300;
            myPane.XAxis.Type = AxisType.Linear;



            zgMonitor.ScrollGrace = 0;
            xScale = zgMonitor.GraphPane.XAxis.Scale;
            zgMonitor.AxisChange();


            splash.sStatus = "Init video capture structures...";
            splash.Refresh();



            //Init video capture dev
            try
            {
                // enumerate video devices
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

                if (videoDevices.Count == 0)
                    throw new ApplicationException();

                // add all devices to combo
                foreach (FilterInfo device in videoDevices)
                {
                    dropdown_devices.Items.Add(device.Name);
                }
            }
            catch (ApplicationException)
            {
                dropdown_devices.Items.Add("No local capture devices");
                dropdown_devices.Enabled = false;
                b_video_connect.Enabled = false;
            }

            dropdown_devices.SelectedIndex = 0;
            cb_codec.SelectedIndex = 0;

            //Drawing stuff for OSD
            drawPen = new Pen(Color.White, 1);
            drawFont = new System.Drawing.Font(FontFamily.GenericMonospace, 16.0F);
            drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.White);


            //Disable buttons that are not working till connected
            b_reset.Enabled = false;
            b_cal_acc.Enabled = false;
            b_cal_mag.Enabled = false;
            b_read_settings.Enabled = false;
            b_write_settings.Enabled = false;
            b_write_to_file.Enabled = false;
            b_load_from_file.Enabled = false;
            btnDownLoadMission.Enabled = false;
            btnUploadMission.Enabled = false;



            //init instrument panels
            altitude_meter1.SetAlimeterParameters(0);
            vertical_speed_indicator1.SetVerticalSpeedIndicatorParameters(0);


            System.Threading.Thread.Sleep(2000);
            splash.Close();
            MainMap.Invalidate(false);

            int w = MainMap.Size.Width;
            MainMap.Width = w +1 ;
            MainMap.Width = w;
            MainMap.ShowCenter = false;


            mw_gui.max_wp_number = gui_settings.max_wp_number;
            mw_gui.wp_radius = gui_settings.wp_radius;

            //Welcome message from Anna
            if (gui_settings.speech_enabled)
            {
                speech = new SpeechSynthesizer();
                speech.Rate = -2;
                speech.SpeakAsync("Initialisation completed. Have a good flight!");
            }

        }
コード例 #28
0
        private void _cpuGraphInit()
        {
            Color[] cColor = { Color.AliceBlue, Color.Cyan, Color.LightBlue, Color.Aquamarine, Color.Orange, Color.Coral, Color.LightGoldenrodYellow, Color.Gold };
            RollingPointPairList[] rpList = new RollingPointPairList[iCores];
            LineItem[] lCurve = new LineItem[iCores];
            GraphPane myPane = cpuGraphControl.GraphPane;
            myPane.CurveList.Clear();
            myPane.Chart.Fill.Type = FillType.None;
            myPane.Margin.All = 0;
            myPane.Margin.Top = 2f;
            myPane.Title.Text = "";
            myPane.Border.IsVisible = false;
            myPane.Legend.IsVisible = false;
            myPane.XAxis.Title.Text = "";
            myPane.XAxis.Scale.Max = Properties.Settings.Default.f2TimspanCPU;
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.IsVisible = false;
            myPane.XAxis.IsVisible = false;
            myPane.YAxis.Scale.IsVisible = false;
            myPane.YAxis.Title.Text = "";
            myPane.YAxis.IsVisible = false;
            myPane.YAxis.Scale.Max = 105;
            myPane.YAxis.Scale.Min = 0;
            TextureBrush texBrush = new TextureBrush(Properties.Resources.cpuback);
            myPane.Fill = new Fill(texBrush, true);
            int tSpan = Properties.Settings.Default.f2TimspanCPU, timer = Properties.Settings.Default.f2TimerCPU, iPL = 1000 / timer * tSpan;

            cpuGraphControl.Size = new Size(110, 35);//.Dock = DockStyle.Fill;

            for (int i = 0; i < iCores; i++)
            {
                rpList[i] = new RollingPointPairList(iPL);
                lCurve[i] = myPane.AddCurve("core" + i.ToString(), rpList[i], cColor[i], SymbolType.None);
                //  lCurve[i].Line.IsSmooth = true;
                //  lCurve[i].Line.SmoothTension = 0.2F;
                lCurve[i].Line.Width = 0.01F;
                lCurve[i].Line.IsAntiAlias = true;
                lCurve[i].IsVisible = false;
            }
            cpuGraphControl.AxisChange();
            cpuGraphControl.Visible = false;
        }
コード例 #29
0
ファイル: Form1.cs プロジェクト: jasonedn/tester
        private void Startup()
        {
            try
            {
            //                myWinUsbDevice = new WinUsbDevice();
            //                InitializeDisplay();
                TCPQ = new AHPDataProcess();

                //===================== graph setting

                //zedGraphControl1.IsShowHScrollBar = true;
                //zedGraphControl1.IsEnableVPan = false;
                //zedGraphControl1.IsEnableVZoom = false;
                //zedGraphControl1.IsEnableWheelZoom = true;
                MasterPane masterPane = zgcDynamic.MasterPane;

                GraphPane myPane = zgcDynamic.GraphPane;
                myPane.Title.Text = "数据采集系统实时数据显示 (数据在25秒钟之后开始滚动显示)";
                myPane.XAxis.Title.Text = "时间,秒";
                myPane.YAxis.Title.Text = "实时输入电压值, 伏";

                // Save 1200 points.  At 50 ms sample rate, this is one minute
                // The RollingPointPairList is an efficient storage class that always
                // keeps a rolling set of point data without needing to shift any data values
                RollingPointPairList list = new RollingPointPairList(4800);

                // Initially, a curve is added with no data points (list is empty)
                // Color is blue, and there will be no symbols
                LineItem curve = myPane.AddCurve("电压,伏", list, Color.Blue, SymbolType.None);

                // Sample at 50ms intervals
                timer1.Interval = 100;
                timer1.Enabled = true;
                timer1.Start();

                // Just manually control the X axis range so it scrolls continuously
                // instead of discrete step-sized jumps
                myPane.XAxis.Scale.Min = 0;
                myPane.XAxis.Scale.Max = displayScale;
                myPane.XAxis.Scale.MinorStep = 1;
                myPane.XAxis.Scale.MajorStep = 5;

                // Set the initial viewed range

                // Scale the axes
                zgcDynamic.AxisChange();

                // Save the beginning time for reference
                tickStart = Environment.TickCount;

                //=========================== graph init
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #30
0
        private void InitializeTemperatureGraph()
        {
            tempPane = zgcTemperature.GraphPane;
            tempPane.Chart.Fill = new Fill(Color.AntiqueWhite, Color.Honeydew, -45F);
            tempPane.CurveList.Clear();
            tempPane.Title.Text = "Temperature Sensor";
            tempPane.XAxis.Title.Text = "Time (second)";
            tempPane.YAxis.Title.Text = "Temperature (°C)";
            tempPane.XAxis.MajorTic.IsOutside = false;
            tempPane.XAxis.MinorTic.IsOutside = false;
            tempPane.YAxis.MajorTic.IsOutside = false;
            tempPane.YAxis.MinorTic.IsOutside = false;
            tempPane.XAxis.MajorGrid.IsVisible = true;
            tempPane.YAxis.MajorGrid.IsVisible = true;
            tempPane.XAxis.MajorGrid.Color = Color.LightGray;
            tempPane.YAxis.MajorGrid.Color = Color.LightGray;
            //tempPane.XAxis.Scale.MajorStep = 1d;

            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps
            tempPane.XAxis.Scale.Min = 0;
            tempPane.XAxis.Scale.Max = 30;
            tempPane.XAxis.Scale.MinorStepAuto = true;
            tempPane.XAxis.Scale.MajorStepAuto = true;

            //tempPane.XAxis.Scale.MajorUnit = DateUnit.Minute;
            //tempPane.XAxis.Scale.MinorUnit = DateUnit.Second;
            //tempPane.XAxis.Scale.Format = "HH:mm:ss";
            //tempPane.XAxis.Type = AxisType.DateAsOrdinal;

            // Save 60000 points. At 50 ms sample rate. this is one minute
            // The RollingPointPairList is an efficint storage class the always
            // Keeps a rolling set of point data without needing to shif any data values
            RollingPointPairList list = new RollingPointPairList(60000);

            LineItem curve = tempPane.AddCurve("Temperature", list, pointColor, symbolType);
            curve.Symbol.Fill.Type = FillType.Solid;
            curve.Symbol.Size = pointWidth;
            curve.Line.Width = lineWidth;
            //curve.Line.IsSmooth = true;
            //curve.Line.SmoothTension = 0.3f;

            // Scale the axes
            zgcTemperature.AxisChange();

            // Save the beginning time for reference
            tickStart = Environment.TickCount;
        }
コード例 #31
0
        private void initiate_graphs()
        {
            GraphPane heartRatePane = zedGraphControl1.GraphPane;
            GraphPane temperaturePane = zedGraphControl2.GraphPane;
            GraphPane bloodpressurePane = zedGraphControl3.GraphPane;
            GraphPane respiratoryRatePane = zedGraphControl4.GraphPane;
            GraphPane spO2Pane = zedGraphControl5.GraphPane;

            // Save 1200 points.  At 50 ms sample rate, this is one minute
            // The RollingPointPairList is an efficient storage class that always
            // keeps a rolling set of point data without needing to shift any data values
            //RollingPointPairList list = new RollingPointPairList(2400);
              //  RollingPointPairList list = new RollingPointPairList(1200);
            list = new PointPairList();
            RollingPointPairList list2 = new RollingPointPairList(120);
            RollingPointPairList list3 = new RollingPointPairList(120);
            RollingPointPairList list4 = new RollingPointPairList(120);
            RollingPointPairList list5 = new RollingPointPairList(120);
            // Initially, a curve is added with no data points (list is empty)
            LineItem curve = heartRatePane.AddCurve("Heart Rate", list, Color.LightGreen, SymbolType.None);
            LineItem curve2 = temperaturePane.AddCurve("Temperature", list2, Color.White, SymbolType.None);
            LineItem curve3 = bloodpressurePane.AddCurve("Blood Pressure", list3, Color.Pink, SymbolType.None);
            LineItem curve4 = respiratoryRatePane.AddCurve("Respiratory Rate", list4, Color.Yellow, SymbolType.None);
            LineItem curve5 = spO2Pane.AddCurve("Spo2", list5, Color.Blue, SymbolType.None);

            curve.Line.IsSmooth = false;

            curve2.Line.IsSmooth = true;
            curve2.Line.SmoothTension = 0.5F;
            //curve2.Line.Width = 2;

            curve3.Line.IsSmooth = true;
            curve3.Line.SmoothTension = 0.5F;
            //curve3.Line.Width = 2;

            curve4.Line.IsSmooth = true;
            curve4.Line.SmoothTension = 0.5F;
            //curve4.Line.Width = 2;

            curve5.Line.IsSmooth = true;
            curve5.Line.SmoothTension = 0.5F;
            //curve5.Line.Width = 2;

            // Just manually control the X axis range so it scrolls continuously
            // instead of discrete step-sized jumps
            //Assuming XAxis.Scale.MinAuto, XAxis.Scale.MajorStepAuto, and XAxis.Scale.MaxAuto

            //heartRatePane.YAxis.Scale.Min = 0;
            heartRatePane.XAxis.Scale.Min = 0;
            heartRatePane.XAxis.Scale.Max = 10;
            //heartRatePane.XAxis.Scale.MinorStep = 1;
            //heartRatePane.XAxis.Scale.MajorStep = 10;
            //heartRatePane.YAxis.Scale.MajorStep = 1;
            heartRatePane.YAxis.Scale.MinAuto = true;
            heartRatePane.YAxis.Scale.MaxAuto = true;

            temperaturePane.YAxis.Scale.Min = 0;
            temperaturePane.XAxis.Scale.Min = 0;
            temperaturePane.XAxis.Scale.Max = 60;
            temperaturePane.XAxis.Scale.MinorStep = 1;
            temperaturePane.XAxis.Scale.MajorStep = 10;
            temperaturePane.YAxis.Scale.MajorStep = 1;
            temperaturePane.YAxis.Scale.MinAuto = true;
            temperaturePane.YAxis.Scale.MaxAuto = true;

            bloodpressurePane.YAxis.Scale.Min = 0;
            bloodpressurePane.XAxis.Scale.Min = 0;
            bloodpressurePane.XAxis.Scale.Max = 60;
            bloodpressurePane.XAxis.Scale.MinorStep = 1;
            bloodpressurePane.XAxis.Scale.MajorStep = 10;
            bloodpressurePane.YAxis.Scale.MinAuto = true;
            bloodpressurePane.YAxis.Scale.MaxAuto = true;

            respiratoryRatePane.YAxis.Scale.Min = 0;
            respiratoryRatePane.XAxis.Scale.Min = 0;
            respiratoryRatePane.XAxis.Scale.Max = 60;
            respiratoryRatePane.YAxis.Scale.MajorStep = 1;
            respiratoryRatePane.XAxis.Scale.MajorStep = 10;
            respiratoryRatePane.YAxis.Scale.MinAuto = true;
            respiratoryRatePane.YAxis.Scale.MaxAuto = true;

            spO2Pane.YAxis.Scale.Min = 0;
            spO2Pane.XAxis.Scale.Min = 0;
            spO2Pane.XAxis.Scale.Max = 60;
            //spO2Pane.XAxis.Scale.MinorStep = 1;
            spO2Pane.XAxis.Scale.MajorStep = 10;
            spO2Pane.YAxis.Scale.MajorStep = 1;
            spO2Pane.YAxis.Scale.MinAuto = true;
            spO2Pane.YAxis.Scale.MaxAuto = true;

            // Scale the axes
            zedGraphControl1.AxisChange();
            zedGraphControl2.AxisChange();
            zedGraphControl3.AxisChange();
            zedGraphControl4.AxisChange();
            zedGraphControl5.AxisChange();
        }