Esempio n. 1
0
        public Function_Smoothing()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            line1.Clear();
            line1.Add(new int[] { 4, 9, 5, 7, 2, 12, 15 });
            line1.RefreshSeries();
        }
Esempio n. 2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            //初始化下拉串口名称列表框
            string[] ports = SerialPort.GetPortNames();
            Array.Sort(ports);
            port.Items.AddRange(ports);
            port.SelectedIndex = port.Items.Count > 0 ? 0 : -1;

            //初始化SerialPort对象
            comm.NewLine   = "\r\n";
            comm.RtsEnable = true;

            //添加事件注册
            comm.DataReceived += comm_DataReceived;

            getFromXml();

            sendbutton.Enabled    = false;
            sendCmdButton.Enabled = false;
            disflag       = false;
            reChartUpdate = false;
            errorCount    = 0;

            timerDrawI = 0;

            tChart1.Chart.Header.Visible = false;
            tChart1.Chart.Legend.Visible = false;
            tChart1.Aspect.View3D        = false;
            tChart1.BackColor            = Color.White;



            red.Clear();
            blue.Clear();
            tChart1.Chart.Series.Clear();

            label1.ForeColor = Color.Black;
            tmr.Elapsed     += new System.Timers.ElapsedEventHandler(tmr_Elapsed);

            thread = new Thread(writeDataToFile);
            thread.Start();
        }
        public AxisFirstLastLabels()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            line1.Clear();
            line1.Add(123, "First");
            line1.Add(456, "Second");
            line1.Add(321, "Third");
            line1.Add(234, "Last");


            tChart1.Axes.Bottom.GetAxisDrawLabel += new Steema.TeeChart.GetAxisDrawLabelEventHandler(Bottom_GetAxisDrawLabel);
        }
Esempio n. 4
0
        private static void ReadIntoTChart(Series series1, Steema.TeeChart.Styles.Line tSeries)
        {
            tSeries.Clear();
            tSeries.XValues.DateTime = true;

            for (int i = 0; i < series1.Count; i++)
            {
                if (!series1[i].IsMissing)
                {
                    tSeries.Add(series1[i].DateTime, series1[i].Value);
                }
                //tSeries[tSeries.Count - 1].Label ="";
                //tSeries.Marks.Items[tSeries.Count - 1].Text = "\n";
                if (tSeries.Count > 0)
                {
                    tSeries.Marks.Items[tSeries.Count - 1].Visible = false;
                }
            }
        }
Esempio n. 5
0
        private static void ReadIntoTChart(Series series1, Steema.TeeChart.Styles.Line tSeries, bool rightAxis = false)
        {
            tSeries.Clear();
            tSeries.XValues.DateTime = true;

            for (int i = 0; i < series1.Count; i++)
            {
                if (!series1[i].IsMissing)
                {
                    tSeries.Add(series1[i].DateTime, series1[i].Value);
                }
                if (tSeries.Count > 0)
                {
                    tSeries.Marks.Items[tSeries.Count - 1].Visible = false;
                }
            }
            if (rightAxis)
            {
                tSeries.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Right;
            }
        }
Esempio n. 6
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            yhat = new double[points1.XValues.Count];
            line1.Clear();
            if (FitModel(points1, ref yhat, out coeffs, comboBox1.SelectedIndex))
            {
                line1.XValues.Count = points1.XValues.Count;
                line1.XValues.Value = points1.XValues.Value;
                line1.YValues.Count = points1.XValues.Count;
                line1.YValues.Value = yhat;
                switch (comboBox1.SelectedIndex)
                {
                case 0:
                    tChart1.Header.Text = "y=a*Exp(b*x)\r\na=" + coeffs[0].ToString("0.00") + "  b=" + coeffs[1].ToString("0.00"); break;

                case 1:
                    tChart1.Header.Text = "y=ax^b\r\na=" + coeffs[0].ToString("0.00") + "  b=" + coeffs[1].ToString("0.00"); break;

                case 2:
                    tChart1.Header.Text = "y=b*ln(x)+a\r\na=" + coeffs[0].ToString("0.00") + "  b=" + coeffs[1].ToString("0.00"); break;
                }
            }
            line1.Repaint();
        }
Esempio n. 7
0
        public Page1()
        {
            // NavigationPage.SetHasNavigationBar(this, false);

            dashBoard0 = new Chart();
            dashBoard0.Aspect.View3D = false;
            Steema.TeeChart.Styles.Bar  bar1  = new Steema.TeeChart.Styles.Bar();
            Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line();
            dashBoard0.Series.Add(bar1);
            dashBoard0.Series.Add(line1);
            //barline chart
            bar1.Clear();
            bar1.Add(20);
            bar1.Add(50);
            bar1.Add(10);
            bar1.Add(70);
            bar1.Add(46);
            bar1.Pen.Visible          = false;
            bar1.BarStyle             = Steema.TeeChart.Styles.BarStyles.RectGradient;
            bar1.Marks.Visible        = false;
            bar1.Gradient.StartColor  = Color.White;
            bar1.Gradient.EndColor    = Color.FromRgb(102, 205, 170);
            bar1.Marks.Visible        = true;
            bar1.Marks.Shadow.Visible = false;
            bar1.Marks.Color          = Color.White;
            bar1.Marks.Font.Size      = 10;
            bar1.Marks.Font.Color     = Color.FromRgb(102, 205, 170);
            bar1.Marks.Pen.Visible    = false;
            bar1.Marks.ArrowLength    = 5;
            bar1.Color = Color.White;

            line1.Clear();
            line1.Add(0, 45);
            line1.Add(0.444444444444444, 55);
            line1.Add(0.888888888888889, 75);
            line1.Add(1.33333333333333, 65);
            line1.Add(1.77777777777778, 45);
            line1.Add(2.22222222222222, 80);
            line1.Add(2.66666666666667, 85);
            line1.Add(3.11111111111111, 98);
            line1.Add(3.55555555555556, 75);
            line1.Add(4, 68);
            line1.Color = Color.FromRgb(255, 255, 240);

            line1.LinePen.Width = 3;
            line1.Smoothed      = true;

            dashBoard0.Panel.Color            = Color.FromRgb(102, 205, 170);
            dashBoard0.Panel.Gradient.Visible = false;
            dashBoard0.Walls.Back.Visible     = false;
            dashBoard0.Title.Text             = "Bars and Lines";
            dashBoard0.Title.Alignment        = TextAlignment.Start;
            dashBoard0.Title.Font.Size        = 12;
            dashBoard0.Title.Font.Color       = Color.White;
            //dashBoard0.Title.Font.Name = "";
            dashBoard0.Axes.Left.AxisPen.Visible     = false;
            dashBoard0.Axes.Bottom.AxisPen.Color     = Color.White;
            dashBoard0.Legend.Visible                = false;
            dashBoard0.Axes.Left.Grid.Color          = Color.White;
            dashBoard0.Axes.Left.Grid.Style          = Steema.TeeChart.Drawing.DashStyle.Dot;
            dashBoard0.Axes.Left.Labels.Font.Color   = Color.White;
            dashBoard0.Axes.Bottom.Labels.Font.Color = Color.White;
            dashBoard0.Axes.Left.Increment           = 25;

            DashView0 = new ChartView
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            DashView0.Model = dashBoard0;

            Content = new StackLayout
            {
                Children =
                {
                    DashView0
                }
            };
        }