Пример #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            PointPairList list = new PointPairList();
            GraphPane myPane = zedGraphControl1.GraphPane;
            //GraphPane myPane = zedGraphControl1.GraphPane;
            LineItem myCurve;
            //zgl.GraphPane.CurveList.Remove(my);
            list.Clear();
            this.zedGraphControl1.GraphPane.CurveList.Clear();//折线图清空
            this.zedGraphControl1.GraphPane.GraphObjList.Clear();
            this.zedGraphControl1.AxisChange();
            this.zedGraphControl1.Refresh();

              if ( comboBox12.SelectedItem != null && comboBox13.SelectedItem != null && comboBox5.SelectedItem != null && comboBox6.SelectedItem != null && comboBox7.SelectedItem != null&& comboBox8.SelectedItem != null)
            {
            string date_begin = dateTimePicker1.Text.ToString();
            date_begin += " " + comboBox5.Text.ToString() + ":" + comboBox7.Text.ToString();
            date_begin += ":00";
            string date_over = dateTimePicker2.Text.ToString();
            date_over += " " + comboBox6.Text.ToString() + ":" + comboBox8.Text.ToString();
            date_over += ":00";
            DateTime d_begin = DateTime.Parse(date_begin);
            DateTime d_over = DateTime.Parse(date_over);

            string sql4data = "SELECT * FROM 锚杆锚索传感器信息表 WHERE ([锚杆锚索观测时间] Between  #" + d_begin + "# And #" + d_over + "#) and [锚杆锚索传感器编号]='" + comboBox13.Text.ToString() + "'order by 锚杆锚索观测时间";
            OleDbDataReader dr1 = db.Query_reader(sql4data);

            if (dr1.HasRows) //判断记录集是否包含一行或多行
            {

                while (dr1.Read())
                {

                    double y = double.Parse((dr1["锚杆锚索data"]).ToString());   //取得字段的值

                    DateTime dt = (DateTime)dr1["锚杆锚索观测时间"];

                    double x = (double)new XDate(dt);
                    list.Add(x, y);

                }

            }
            else MessageBox.Show("无数据");
            dr1.Close();

            string mycurve =comboBox12.Text.ToString() + "分站" + comboBox13.Text.ToString();
            myCurve = zedGraphControl1.GraphPane.AddCurve(mycurve, list, Color.DarkGreen, SymbolType.None);

            this.zedGraphControl1.AxisChange();
            this.zedGraphControl1.Refresh();
            }
              else
              {
                  MessageBox.Show("请填写完整!!");

              }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            PointPairList list = new PointPairList();
            GraphPane myPane = zedGraphControl1.GraphPane;
            //GraphPane myPane = zedGraphControl1.GraphPane;
            LineItem myCurve;
            //zgl.GraphPane.CurveList.Remove(my);
            list.Clear();
            this.zedGraphControl1.GraphPane.CurveList.Clear();//折线图清空
            this.zedGraphControl1.GraphPane.GraphObjList.Clear();
            this.zedGraphControl1.AxisChange();
            this.zedGraphControl1.Refresh();

            if (comboBox3.SelectedItem != null )
            {
                string sql4data = "SELECT * FROM 钻孔应力传感器信息表 WHERE DateDiff('m',钻孔应力观测时间,'" + DateTime.Now + "')<1 and [钻孔应力传感器编号]='" + comboBox3.Text.ToString() + "'order by 钻孔应力观测时间";
                OleDbDataReader dr1 = db.Query_reader(sql4data);

                if (dr1.HasRows) //判断记录集是否包含一行或多行
                {

                    while (dr1.Read())
                    {

                        double y = double.Parse((dr1["钻孔应力data"]).ToString());   //取得字段的值

                        DateTime dt = (DateTime)dr1["钻孔应力观测时间"];

                        double x = (double)new XDate(dt);
                        list.Add(x, y);

                    }

                }
                else MessageBox.Show("无数据");
                dr1.Close();

                string mycurve = comboBox2.Text.ToString() + "分站" + comboBox3.Text.ToString();
                myCurve = zedGraphControl1.GraphPane.AddCurve(mycurve, list, Color.DarkGreen, SymbolType.None);

                this.zedGraphControl1.AxisChange();
                this.zedGraphControl1.Refresh();
            }
            else
            {
                MessageBox.Show("请选择一个传感器!!");

            }
        }
        private void fillDistances(List<BIO.Framework.Core.Evaluation.Results.Result> results, ref PointPairList data, bool genuine)
        {
            data.Clear();
            //int templateNumber = 0;
            foreach (BIO.Framework.Core.Evaluation.Results.Result r in results) {

                bool isGenuine = r.isGenuine();
                if ((genuine && isGenuine) || (!genuine && !isGenuine)) {
                    MatchingScore ms = r.getMatchingScore(this.getMethod());

                    //distances.Add(value.Value.getValue(evaluator));
                    if (!ms.IsValid) {
                        continue;
                    }
                    int tn = 0;
                    string key = r.TemplateRecord.BiometricID.PersonID;
                    if (templateNumbers.ContainsKey(key)) {
                        tn = templateNumbers[key];
                    } else {
                        templateNumbers.Add(key, this.maxTemplateNumber++);
                        tn = templateNumbers[key];
                    }

                    PointPair p = new PointPair(tn, ms.Score);
                    p.Tag = r;
                    data.Add(p);
                }
            }
        }
        private void CreateGraph(ZedGraphControl zgc)
        {
            // get a reference to the GraphPane
            GraphPane myPane = zgc.GraphPane;
            temp t = new temp();
            List<double> dd = new List<double>();
            dd = t.sentiment(textBox2 .Text .Trim ());

            double v1 = dd[0];
            double v2 = dd[1];
            double v3 = dd[2];

            // Set the Titles
            myPane.Title.Text = "Sentiment Variation";
            myPane.XAxis.Title.Text = "Tweet";
            myPane.YAxis.Title.Text = "Variations";

            // Make up some data arrays based on the Sine function
            double x, y1, y2,y3;
            PointPairList list1 = new PointPairList();
            PointPairList list2 = new PointPairList();
            PointPairList list3 = new PointPairList();

            list1.Clear();
            list2.Clear();
            list3.Clear();
            Random r = new Random();
            int n1 = r.Next(1, 2);

            Random r1 = new Random();
            int n11 = r1.Next(1, 2);

            Random r2= new Random();
            int n12 = r2.Next(2, 3);

            for (int i = 0; i < 36; i++)
            {
                x = (double)i + 5;
                y1 = n1 + (double)i * v1;
                y2 = n11 * (1.5 + (double)i * v2);
                y3 = n12 + Math.Sin(i * v3);
                list1.Add(x, y1);
                list2.Add(x, y2);
                list3.Add(x, y3);
            }

            // Generate a red curve with diamond
            // symbols, and "Porsche" in the legend
            LineItem myCurve = myPane.AddCurve("Positive",
                  list1, Color.Red, SymbolType.Diamond);

            // Generate a blue curve with circle
            // symbols, and "Piper" in the legend
            LineItem myCurve2 = myPane.AddCurve("Negative",
                  list2, Color.Blue, SymbolType.Circle);

            LineItem myCurve3 = myPane.AddCurve("Neutral",
                 list3, Color.Green, SymbolType.Circle);

            // Tell ZedGraph to refigure the
            // axes since the data have changed
            zgc.AxisChange();
        }
Пример #5
0
        private void button7_Click(object sender, EventArgs e)
        {
            PointPairList list1 = new PointPairList();
            PointPairList list2 = new PointPairList();
            GraphPane myPane = zedGraphControl1.GraphPane;
            //GraphPane myPane = zedGraphControl1.GraphPane;
            LineItem myCurve1, myCurve2;
            //zgl.GraphPane.CurveList.Remove(my);
            list1.Clear();
            list2.Clear();
            this.zedGraphControl1.GraphPane.CurveList.Clear();//折线图清空
            this.zedGraphControl1.GraphPane.GraphObjList.Clear();
            this.zedGraphControl1.AxisChange();
            this.zedGraphControl1.Refresh();
            //comboBox1.SelectedItem != null &&
            if ( comboBox2.SelectedItem != null && comboBox3.SelectedItem != null  && comboBox5.SelectedItem != null && comboBox6.SelectedItem != null)
            {

                string date_begin = dateTimePicker1.Text.ToString();
                date_begin += " " + comboBox5.Text.ToString() + ":" + comboBox7.Text.ToString();
                date_begin += ":00";
                string date_over = dateTimePicker2.Text.ToString();
                date_over += " " + comboBox6.Text.ToString() + ":" + comboBox8.Text.ToString();
                date_over += ":00";
                DateTime d_begin = DateTime.Parse(date_begin);
                DateTime d_over = DateTime.Parse(date_over);

                //查询特定传感器下特定通道某时间段内数据
                string sql4data = "SELECT * FROM 顶板离层传感器信息表 WHERE ([顶板离层观测时间] Between  #" + d_begin + "# And #" + d_over + "#) and [顶板离层传感器编号]='" + comboBox3.Text.ToString() + "' ORDER BY 顶板离层观测时间";
                OleDbDataReader dr1 = db.Query_reader(sql4data);

                if (dr1.HasRows) //判断记录集是否包含一行或多行
                {

                    while (dr1.Read())
                    {

                        double y1 = double.Parse(dr1["离层data1"].ToString());   //取得字段的值
                        double y2 = double.Parse(dr1["离层data2"].ToString());
                        DateTime dt = (DateTime)dr1["顶板离层观测时间"];
                        // double x = (double)new XDate(dt);
                        double x = (double)new XDate(dt);
                        list1.Add(x, y1);
                        list2.Add(x, y2);

                    }

                }
                else MessageBox.Show("无数据");
                dr1.Close();

                //comboBox1.Text.ToString() + "工作面" +
                string mycurve1 =  comboBox2.Text.ToString() + "分站" + comboBox3.Text.ToString()+"通道1";
                string mycurve2 =  comboBox2.Text.ToString() + "分站" + comboBox3.Text.ToString()+"通道2";
                //修改曲线颜色
                myCurve1 = zedGraphControl1.GraphPane.AddCurve(mycurve1, list1, Color.Red, SymbolType.None);
                myCurve2 = zedGraphControl1.GraphPane.AddCurve(mycurve2, list2, Color.Blue, SymbolType.None);
                //填充曲线颜色
                myCurve1.Line.Fill = new Fill(Color.White, Color.White, 45F);
                myCurve2.Line.Fill = new Fill(Color.White, Color.Blue, 45F);
                this.zedGraphControl1.AxisChange();
                this.zedGraphControl1.Refresh();

                //  MessageBox.Show(datanum);

            }
            else
            {
                MessageBox.Show("请填写完整!!");

            }
        }
Пример #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            PointPairList list = new PointPairList();
               PointPairList list2 = new PointPairList();
               GraphPane myPane = zedGraphControl1.GraphPane;
               LineItem myCurve;
               list.Clear();
               this.zedGraphControl1.GraphPane.CurveList.Clear();//折线图清空
               this.zedGraphControl1.GraphPane.GraphObjList.Clear();
               this.zedGraphControl1.AxisChange();
               this.zedGraphControl1.Refresh();

               if (comboBox2.SelectedItem != null)
               {
               try
               {
                   string sql4data = "SELECT distinct 支柱压力观测时间,avg([顶板通道data1])as data1,avg([顶板通道data2])as data2,avg([顶板通道data3])as data3 FROM 支柱压力传感器信息表 WHERE DateDiff('m',支柱压力观测时间,'" + DateTime.Now + "')<1 and [支柱压力传感器编号] in (SELECT 传感器编号 FROM 传感器信息表 WHERE 监测分站编号='" + comboBox2.Text.ToString() + "' and 传感器分类='支柱压力传感器') GROUP BY 支柱压力观测时间";
                   OleDbDataReader dr1 = db.Query_reader(sql4data);

                   if (dr1.HasRows) //判断记录集是否包含一行或多行
                   {

                       while (dr1.Read())
                       {
                           double y1 = (double)dr1["data1"];   //取得字段的值
                           double y2 = (double)dr1["data2"];
                           double y3 = (double)dr1["data3"];
                           double y = double.Parse(((y1 + y2 + y3) / 3).ToString());
                           y = Math.Round(y, 2);
                           DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                           double x = (double)new XDate(dt);
                           list.Add(x, y);
                       }
                   }
                   else MessageBox.Show("无数据");
                   dr1.Close();

                   string mycurve = comboBox2.Text.ToString() + "分站";
                   myCurve = zedGraphControl1.GraphPane.AddCurve(mycurve, list, Color.DarkGreen, SymbolType.None);

                   this.zedGraphControl1.AxisChange();
                   this.zedGraphControl1.Refresh();

               }
               catch
               {
               }
               }
               else
               MessageBox.Show("请选择一个监测分站!");
        }
Пример #7
0
        private void button7_Click(object sender, EventArgs e)
        {
            PointPairList list = new PointPairList();
            PointPairList list2 = new PointPairList();
            GraphPane myPane = zedGraphControl1.GraphPane;
            LineItem myCurve;
            list.Clear();
            this.zedGraphControl1.GraphPane.CurveList.Clear();//折线图清空
            this.zedGraphControl1.GraphPane.GraphObjList.Clear();
            this.zedGraphControl1.AxisChange();
            this.zedGraphControl1.Refresh();

            if (comboBox2.SelectedItem != null && comboBox5.SelectedItem != null && comboBox6.SelectedItem != null && comboBox7.SelectedItem != null && comboBox8.SelectedItem != null)
            {

                string date_begin = dateTimePicker1.Text.ToString();
                date_begin += " " + comboBox5.Text.ToString() + ":" + comboBox7.Text.ToString();
                date_begin += ":00";
                string date_over = dateTimePicker2.Text.ToString();
                date_over += " " + comboBox6.Text.ToString() + ":" + comboBox8.Text.ToString();
                date_over += ":00";
                DateTime d_begin = DateTime.Parse(date_begin);
                DateTime d_over = DateTime.Parse(date_over);

                //查询某一分站下所有支柱压力传感器的观测数据的平均值,用于计算平均阻力
                string sql4data = "SELECT distinct 支柱压力观测时间,avg([顶板通道data1])as data1,avg([顶板通道data2])as data2,avg([顶板通道data3])as data3 FROM 支柱压力传感器信息表 WHERE ([支柱压力观测时间] Between  #" + d_begin + "# And #" + d_over + "#) and [支柱压力传感器编号] in (SELECT 传感器编号 FROM 传感器信息表 WHERE 监测分站编号='" + comboBox2.Text.ToString() + "' and 传感器分类='支柱压力传感器' and zz_IsOK='111') GROUP BY 支柱压力观测时间";
                OleDbDataReader dr1 = db.Query_reader(sql4data);

                if (dr1.HasRows) //判断记录集是否包含一行或多行
                {

                    while (dr1.Read())
                    {
                        double y1 = (double)dr1["data1"];   //取得字段的值
                        double y2 = (double)dr1["data2"];
                        double y3 = (double)dr1["data3"];
                        double y = double.Parse(((y1 + y2 + y3) / 3).ToString());
                              y = Math.Round(y, 2);
                        DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                        double x = (double)new XDate(dt);
                        list.Add(x, y);
                    }
                }
                else MessageBox.Show("无数据");
                dr1.Close();

                string mycurve =  comboBox2.Text.ToString() + "分站";
                myCurve = zedGraphControl1.GraphPane.AddCurve(mycurve, list, Color.DarkGreen, SymbolType.None);

                this.zedGraphControl1.AxisChange();
                this.zedGraphControl1.Refresh();

            }
            else MessageBox.Show("请填写完整!!");
        }
Пример #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            PointPairList list = new PointPairList();
            GraphPane myPane = zedGraphControl1.GraphPane;
            //GraphPane myPane = zedGraphControl1.GraphPane;
            LineItem myCurve;
            //zgl.GraphPane.CurveList.Remove(my);
            list.Clear();
            this.zedGraphControl1.GraphPane.CurveList.Clear();//折线图清空
            this.zedGraphControl1.GraphPane.GraphObjList.Clear();
            this.zedGraphControl1.AxisChange();
            this.zedGraphControl1.Refresh();

            // zedGraphControl1.GraphPane.Fill=new Color;

            if (comboBox3.SelectedItem != null && comboBox4.SelectedItem != null )
            {

                string sql4conorder = "select 接线次序 from 传感器信息表 where 传感器编号= '" + comboBox3.Text.ToString() + "'";
                string data_num = (string)db.QueryScalar(sql4conorder);

                // string sss = "前悬梁前柱后柱";
                int i = data_num.IndexOf(comboBox4.Text.ToString());
                string datanum = null;

                //通过接线次序判断数据通道号
                if (i < 0)
                {
                    datanum = null;

                }
                else if (i == 0)
                {
                    datanum = "顶板通道data1";
                }
                else if (i > 0 && i <= 3)
                {
                    datanum = "顶板通道data2";
                }
                else if (i >= 4)
                {
                    datanum = "顶板通道data3";
                }

                //查询特定传感器下特定通道某时间段内数据
                string sql4data = "SELECT * FROM 支柱压力传感器信息表 WHERE DateDiff('m',支柱压力观测时间,'" + DateTime.Now + "')<1 and [支柱压力传感器编号]='" + comboBox3.Text.ToString() + "' ORDER BY 支柱压力观测时间";
                OleDbDataReader dr1 = db.Query_reader(sql4data);

                if (dr1.HasRows) //判断记录集是否包含一行或多行
                {

                    while (dr1.Read())
                    {

                        double y = double.Parse(dr1[datanum].ToString());   //取得字段的值
                        // float y = ddd;
                        DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                        // double x = (double)new XDate(dt);
                        double x = (double)new XDate(dt);
                        list.Add(x, y);

                    }

                }
                else MessageBox.Show("无数据");
                dr1.Close();

                string mycurve = comboBox2.Text.ToString() + "分站" + comboBox3.Text.ToString() + comboBox4.Text.ToString();
                myCurve = zedGraphControl1.GraphPane.AddCurve(mycurve, list, Color.DarkGreen, SymbolType.None);

                this.zedGraphControl1.AxisChange();
                this.zedGraphControl1.Refresh();

                //  MessageBox.Show(datanum);

            }
            else
            {
                MessageBox.Show("请选择传感器和接线次序!!");

            }
        }
Пример #9
0
        /*
        private void CalculateGreyLevelHistogramShape(FREE_IMAGE_COLOR_CHANNEL ficc, PointPairList list, double max_intensity)
        {
            TileView viewer = this.mosaicWindow.TileView;

            List<Tile> tiles = MosaicWindow.MosaicInfo.Items;

            if (tiles == null)
                return;

            int[] hist = null;
            int[] total_hist = new int[256];

            if (viewer.CacheImageAvailiable)
            {
                viewer.CacheImage.GetHistogram(ficc, out total_hist);
            }
            else
            {
                foreach (Tile tile in tiles)
                {
                    tile.Thumbnail.GetHistogram(ficc, out hist);

                    for (int i = 0; i < 256; i++)
                    {
                        total_hist[i] = hist[i];
                    }
                }
            }

            int hist_peak_intensity = 0;

            for (int i = 0; i < 256; i++)
            {
                if (total_hist[i] > hist_peak_intensity)
                    hist_peak_intensity = total_hist[i];
            }

            double x=0.0, y;

            list.Clear();

            for (int i = 0; i < 256; i++)
            {
                x = (double)(i * max_intensity / 256.0);
                y = ((double)total_hist[i] / hist_peak_intensity * 256.0);
                list.Add(x, y);
            }
        }
        */
        public void DisplayPlot(double min, double max, PointPairList list)
        {
            double range;

            if (min == 0.0 && max == 0.0)
            {
                min = this.min;
                max = this.max;
            }

            if ((range = (max - min)) <= 0)
                return;

            double scale = 255.0 / range;

            list.Clear();

            int int_range = (int)Math.Ceiling(range);

            for (int i = 0; i <= int_range; i++)
            {
                list.Add((double)i + min, (scale * i));
            }
        }
Пример #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            PointPairList list = new PointPairList();
            GraphPane myPane = zedGraphControl1.GraphPane;
            //GraphPane myPane = zedGraphControl1.GraphPane;
            LineItem myCurve;
            //zgl.GraphPane.CurveList.Remove(my);
            list.Clear();
            this.zedGraphControl1.GraphPane.CurveList.Clear();//折线图清空
            this.zedGraphControl1.GraphPane.GraphObjList.Clear();
            this.zedGraphControl1.AxisChange();
            this.zedGraphControl1.Refresh();

            if (comboBox3.SelectedItem != null )
            {

                //"SELECT distinct 支柱压力观测时间,avg([顶板通道data1])as data1,avg([顶板通道data2])as data2,avg([顶板通道data3])as data3 FROM 支柱压力传感器信息表 WHERE ([支柱压力观测时间] Between  #" + d_begin + "# And #" + d_over + "#) and [支柱压力传感器编号] in (select distinct 传感器编号 from 传感器信息表 where  传感器安装位置='" + comboBox3.Text.ToString() + "') GROUP BY 支柱压力观测时间";
                string sql3data = "SELECT distinct 支柱压力观测时间,avg([顶板通道data1])as data1,avg([顶板通道data2])as data2,avg([顶板通道data3])as data3 FROM 支柱压力传感器信息表 WHERE DateDiff('m',支柱压力观测时间,'" + DateTime.Now + "')<1 and [支柱压力传感器编号] in (select distinct 传感器编号 from 传感器信息表 where  传感器安装位置='" + comboBox3.Text.ToString() + "') GROUP BY 支柱压力观测时间";
                OleDbDataReader dr1 = db.Query_reader(sql3data);

                if (dr1.HasRows) //判断记录集是否包含一行或多行
                {

                    while (dr1.Read())
                    {

                        double y1 = (double)dr1["data1"];   //取得字段的值
                        double y2 = (double)dr1["data2"];
                        double y3 = (double)dr1["data3"];
                        if (y1 != 0 && y2 != 0 && y3 != 0)    //根据通讯协议再来判断。
                        {
                            double y = double.Parse(((y1 + y2 + y3) / 3).ToString());
                            y = Math.Round(y, 2);
                            DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                            double x = (double)new XDate(dt);
                            list.Add(x, y);
                        }
                        else if (y1 != 0.00 && y2 != 0.00 && y3 == 0.00)
                        {
                            double y =  double.Parse(((y1 + y2 + y3) / 2).ToString());
                            y = Math.Round(y, 2);
                            DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                            double x = (double)new XDate(dt);
                            list.Add(x, y);
                        }
                        else if (y1 != 0.00 && y2 == 0.00 && y3 != 0.00)
                        {
                            double y = double.Parse(((y1 + y2 + y3) / 2).ToString());
                            y = Math.Round(y, 2);
                            DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                            double x = (double)new XDate(dt);
                            list.Add(x, y);
                        }
                        else if (y1 == 0.00 && y2 != 0.00 && y3 != 0.00)
                        {
                            double y = double.Parse(((y1 + y2 + y3) / 2).ToString());
                            y = Math.Round(y, 2);
                            DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                            double x = (double)new XDate(dt);
                            list.Add(x, y);
                        }
                        else if (y1 == 0.00 && y2 == 0.00 && y3 == 0.00)
                        {
                            double y = double.Parse((0).ToString());
                            DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                            double x = (double)new XDate(dt);
                            list.Add(x, y);
                        }
                        else
                        {
                            double y = double.Parse(((y1 + y2 + y3).ToString()));
                            y = Math.Round(y, 2);
                            DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                            double x = (double)new XDate(dt);
                            list.Add(x, y);
                        }

                        //float y = (y1 + y2 + y3) / 3;
                        //DateTime dt = (DateTime)dr1["支柱压力观测时间"];
                        //float x = (float)new XDate(dt);
                        //list.Add(x, y);

                    }

                }
                else MessageBox.Show("无数据");
                dr1.Close();

                string mycurve = comboBox2.Text.ToString() + "分站" + comboBox3.Text.ToString();
                myCurve = zedGraphControl1.GraphPane.AddCurve(mycurve, list, Color.DarkGreen, SymbolType.None);

                this.zedGraphControl1.AxisChange();
                this.zedGraphControl1.Refresh();

            }
            else
            {
                MessageBox.Show("请填写完整!!");

            }
        }
Пример #11
0
        private void GraphPowerForm_Load(object sender, EventArgs e)
        {
            while(flagReload==false);
            typeLocText.Text = dataOpen[10].TypeLoc;
            numberLocText.Text = dataOpen[10].NumberLoc;

            GraphPane pane = zedGraphPower.GraphPane;
            pane.Title.Text = "Тепловозная характеристика";
            pane.XAxis.Title.Text = "Позиция КМ";
            pane.YAxis.Title.Text = "Мощность, кВт";
            PointPairList listUp = new PointPairList();
            PointPairList listDown = new PointPairList();
            PointPairList listCurrent = new PointPairList();

            //zedGraphPower.
            listCurrent.Clear();

            XmlDocument doc = new XmlDocument();
            try
            {
                doc.Load(@".\rangePower.xml");
            }
            catch
            {
                MessageBox.Show("Файл отсутсвует!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }

            XmlNodeList type = doc.GetElementsByTagName("name_loc");
            XmlNodeList countPoz = doc.GetElementsByTagName("count_poz");
            XmlNodeList powerMin = doc.GetElementsByTagName("power_min");
            XmlNodeList powerMax = doc.GetElementsByTagName("power_max");
            XmlNodeList powerPoz = doc.GetElementsByTagName("poz");
            int offset =0;
            bool flagPresensePoint = false;
            for (int j = 0; j != type.Count; j++)
            {
                if (type[j].InnerText == dataOpen[10].TypeLoc)
                {
                    flagPresensePoint = true;
                    for (int i = 0; i != Convert.ToInt32(countPoz[j].InnerText)+1; i++)
                    {
                    listUp.Add(Convert.ToInt32(powerPoz[i+offset].InnerText), Convert.ToInt32(powerMax[i+offset].InnerText));
                    listDown.Add(Convert.ToInt32(powerPoz[i+offset].InnerText), Convert.ToInt32(powerMin[i+offset].InnerText));
                    if ((dataOpen[i].PowerDGU > 0) && (dataOpen[i].PozDGU>0))
                            listCurrent.Add(dataOpen[i].PozDGU,dataOpen[i].PowerDGU);
                    }
                }
                offset = offset + Convert.ToInt32(countPoz[j].InnerText)+1;
            }

            if (flagPresensePoint == false)
            {
                for (int j = 0; j != 8; j++)
                {
                    listCurrent.Add(dataOpen[j].PozDGU, dataOpen[j].Power);
                }
                MessageBox.Show("Локомотив отсутсвует в справочнике!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }

            LineItem myCurve1 = pane.AddCurve("Верхняя норма", listUp, Color.Black, SymbolType.None);
            LineItem myCurve2 = pane.AddCurve("Нижняя норма", listDown, Color.Black, SymbolType.None);
            LineItem myCurve3 = pane.AddCurve("Текущее значение", listCurrent, Color.Red, SymbolType.None);
            myCurve3.Line.Width = 4;
            zedGraphPower.AxisChange();

            // Обновляем график
            zedGraphPower.Invalidate();

            Clipboard.Clear();
            zedGraphPower.Copy(false);
            Image pic;
            pic = Clipboard.GetImage();
            pic.Save(@".\powerGraph.jpg");
        }
Пример #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            section = new List<Section>();

            Function = ((ComboBoxItem)comboBox1.SelectedItem).GetFunction();

            double xmin = Convert.ToDouble(textBox5.Text);
            double xmax = Convert.ToDouble(textBox6.Text);
            Mu = Convert.ToDouble(textBox7.Text);

              GraphPane pane = zedGraphControl1.GraphPane;
              GraphPane pane2 = zedGraphControl2.GraphPane;
              pane2.CurveList.Clear();
              zedGraphControl2.ZoomOutAll(pane2);
              zedGraphControl1.ZoomOutAll(pane);
              pane.CurveList.Clear();
              richTextBox1.Text = "";

                PointPairList list = new PointPairList();
                PointPairList list_aprox = new PointPairList();

                list = FunctionUtil.GetPointPairsInRange(xmin, xmax, Function);

                PointPairList list_1 = new PointPairList();
                PointPairList aprox = new PointPairList();

                    Compute(xmin, xmax);
                    for (int i = 0; i < section.Count; i++)
                    {
                        for (double x = section[i].LeftPoint; x <= section[i].RightPoint; x += 0.001)
                        {

                            double fx = AproximFunc(x, section[i].Coef);

                            aprox.Add(x, fx);

                        }

                        richTextBox1.Text += "Ланка # " + (i + 1) + "\n\nxL= " + section[i].LeftPoint
                            +"\nxR= " + section[i].RightPoint + "\nMu= "
                            + section[i].Mu + "\n\n" + "Коефіцієнти\n\n";
                        for (int ii = 0; ii < section[i].Coef.Length; ii++)
                        {
                            richTextBox1.Text += "a["+ii+"]= "+section[i].Coef[ii]+"\n";

                        }
                        richTextBox1.Text += "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"+"\n\n";

                    }

                LineItem myCurve = pane.AddCurve(Function.Text, list, Color.Blue, SymbolType.None);
                LineItem myCurve2 = pane.AddCurve("aprox", aprox, Color.Red, SymbolType.None);

                pane.XAxis.MajorGrid.IsVisible = true;
                pane.YAxis.MajorGrid.IsVisible = true;

                zedGraphControl1.AxisChange();

                zedGraphControl1.Invalidate();
                list_1.Clear();

                foreach (Section sec in section)
                {
                    double[] coef = exp(Function, sec.LeftPoint, sec.RightPoint);

                    for (double x = sec.LeftPoint; x <= sec.RightPoint; x += 0.001)
                    {

                        double fx = Math.Abs(Function.Val(x) - AproximFunc(x, coef));

                        list_1.Add(x, fx);

                    }
                }

                LineItem newCurves = pane2.AddCurve("Ro", list_1, Color.Blue, SymbolType.None);
                list_1 = new PointPairList();
                list_1.Add(xmin,Mu);
                list_1.Add(xmax,Mu);
                newCurves = pane2.AddCurve("Mu", list_1, Color.Red, SymbolType.None);

                pane2.XAxis.MajorGrid.IsVisible = true;
                pane2.YAxis.MajorGrid.IsVisible = true;
                pane2.YAxis.Scale.Max = 2 * Mu;
                pane2.YAxis.Scale.Min = 0;
                pane2.XAxis.Scale.Max = xmax;
                pane2.XAxis.Scale.Min = xmin;

                zedGraphControl2.AxisChange();

                zedGraphControl2.Invalidate();
        }
        public List<PointPairList> rectasEjeReal()
        {
            rectasEje = new List<PointPairList>();
            PointPairList semiRecta = new PointPairList();

            if ((n + m) % 2 != 0)                   //Si el numero de ceros y polos es Impar la ultima raiz va hacia el infinito
            {
                for (int i = 0; i < pYcOrdenados[0].Length-1; i += 2)      //Se los agrupa en pares y se crean rectas
                {
                    semiRecta.Clear();
                    for (double d = pYcOrdenados[0][i]; d >= pYcOrdenados[0][i + 1]; d -= pasoX)
                    {
                        PointPair pto = new PointPair(d, 0);
                        pto.Z = calculaK(pto);
                        semiRecta.Add(pto);
                    }
                    rectasEje.Add(semiRecta.Clone());
                }
                //Esta raiz queda sola y va hacia el infinito
                semiRecta.Clear();
                for (double d = pYcOrdenados[0][pYcOrdenados[0].Length-1]; d >= this.InicioEjeX; d-= pasoX)
                {
                    PointPair pto = new PointPair(d, 0);
                    pto.Z = calculaK(pto);
                    semiRecta.Add(pto);
                }
                rectasEje.Add(semiRecta.Clone());
            }
            else
            {
                for (int i = 0; i < pYcOrdenados[0].Length; i += 2)      //Se los agrupa en pares y se crean rectas
                {
                    semiRecta.Clear();
                    for (double d = pYcOrdenados[0][i]; d >= pYcOrdenados[0][i + 1]; d -= pasoX)
                    {
                        PointPair pto = new PointPair(d, 0);
                        pto.Z = calculaK(pto);
                        semiRecta.Add(pto);
                    }
                    rectasEje.Add(semiRecta.Clone());
                }

            }

            return rectasEje;
        }
Пример #14
0
		public void DrawMelFiltersBank(string fileName) {
			GraphPane myPane = new GraphPane( new RectangleF( 0, 0, 1200, 600 ),
			                                 "Mel Filter Bank", "X Title", "Y Title" );

			Random random = new Random();
			
			PointPairList ppl = new PointPairList();
			double[] filterSpectrum;
			foreach(var filter in filters) {
				ppl.Clear();
				if (filter.IsEnabled()) {
					filterSpectrum = filter.GetFilterSpectrum();
					for (int i = 0; i < 200; i++) {
						ppl.Add(i, filterSpectrum[i]);
					}
					Color color = Color.FromArgb(random.Next(0, 255), random.Next(0,255),random.Next(0,255));
					LineItem myCurve = myPane.AddCurve("", ppl.Clone(), color, SymbolType.None );
				}
			}

			Bitmap bm = new Bitmap( 1, 1 );
			using ( Graphics g = Graphics.FromImage( bm ) )
				myPane.AxisChange( g );
			
			myPane.GetImage().Save(fileName, ImageFormat.Png);
		}
Пример #15
0
        private void CreateGraph_BarJunk2( ZedGraphControl z1 )
        {
            GraphPane myPane = z1.GraphPane;
            myPane.CurveList.Clear();
            PointPairList list = new PointPairList();

            list.Clear();
            list.Add( 4, 0 );
            list.Add( -2, 1 );
            list.Add( 5, 2 );
            list.Add( 3, 3 );
            string[] labels = { "bar one", "bar two", "bar three", "bar four" };
            myPane.YAxis.Scale.TextLabels = labels;
            myPane.YAxis.Type = AxisType.Text;

            //myPane.YAxis.Cross = 0.0;
            myPane.XAxis.MajorGrid.IsZeroLine = true;

            BarItem myCurve2 = myPane.AddBar( "curve 2", list, Color.Red );
            myCurve2.Bar.Fill = new Fill( Color.Red, Color.White, Color.Red, 90 );

            // Set BarBase to the YAxis for horizontal bars
            myPane.BarSettings.Base = BarBase.Y;

            z1.AxisChange();
            z1.Refresh();
        }
Пример #16
0
		public void DrawMatrixGraph(string fileName) {
			
			GraphPane myPane;
			RectangleF rect = new RectangleF( 0, 0, 1200, 600 );
			
			PointPairList ppl = new PointPairList();
			if (columns == 1) {
				myPane = new GraphPane( rect, "Matrix", "Rows", "Value" );
				for(int i = 0; i < rows; i++) {
					ppl.Add(i, d[i,0]);
				}
				LineItem myCurve = myPane.AddCurve("", ppl.Clone(), Color.Black, SymbolType.None);
			} else if (rows == 1) {
				myPane = new GraphPane( rect, "Matrix", "Columns", "Value" );
				for(int i = 0; i < columns; i++) {
					ppl.Add(i, d[0,i]);
				}
				LineItem myCurve = myPane.AddCurve("", ppl.Clone(), Color.Black, SymbolType.None);
			} else if (columns > rows) {
				myPane = new GraphPane( rect, "Matrix", "Columns", "Value" );
				for(int i = 0; i < rows; i++)
				{
					ppl.Clear();
					for(int j = 0; j < columns; j++)
					{
						ppl.Add(j, d[i,j]);
					}
					Color color = ColorUtils.MatlabGraphColor(i);
					LineItem myCurve = myPane.AddCurve("", ppl.Clone(), color, SymbolType.None);
				}
			} else { // (columns < rows)
				myPane = new GraphPane( rect, "Matrix", "Rows", "Value" );
				for(int j = 0; j < columns; j++)
				{
					ppl.Clear();
					for(int i = 0; i < rows; i++)
					{
						ppl.Add(i, d[i,j]);
					}
					Color color = ColorUtils.MatlabGraphColor(j);
					LineItem myCurve = myPane.AddCurve("", ppl.Clone(), color, SymbolType.None);
				}
			}

			Bitmap bm = new Bitmap( 1, 1 );
			using ( Graphics g = Graphics.FromImage( bm ) )
				myPane.AxisChange( g );
			
			myPane.GetImage().Save(fileName, ImageFormat.Png);
		}
Пример #17
0
		/// <summary>
		/// Draw the matrix as a image graph
		/// Imitating Matlabs plot(M), where M is the matrix
		/// </summary>
		/// <param name="fileName">filename</param>
		public void DrawMatrixGraph(string fileName, bool forceUseRows=false) {
			
			GraphPane myPane;
			var rect = new RectangleF( 0, 0, 1200, 600 );
			
			var ppl = new PointPairList();
			if (columnCount == 1) {
				myPane = new GraphPane( rect, "Matrix", "Rows", "Value" );
				for(int i = 0; i < rowCount; i++) {
					ppl.Add(i, matrixData[i][0]);
				}
				LineItem myCurve = myPane.AddCurve("", ppl.Clone(), Color.Black, SymbolType.None);
			} else if (rowCount == 1) {
				myPane = new GraphPane( rect, "Matrix", "Columns", "Value" );
				for(int i = 0; i < columnCount; i++) {
					ppl.Add(i, matrixData[0][i]);
				}
				LineItem myCurve = myPane.AddCurve("", ppl.Clone(), Color.Black, SymbolType.None);
			} else if (!forceUseRows && columnCount > rowCount) {
				myPane = new GraphPane( rect, "Matrix", "Columns", "Value" );
				for(int i = 0; i < rowCount; i++)
				{
					ppl.Clear();
					for(int j = 0; j < columnCount; j++)
					{
						ppl.Add(j, matrixData[i][j]);
					}
					Color color = ColorUtils.MatlabGraphColor(i);
					LineItem myCurve = myPane.AddCurve("", ppl.Clone(), color, SymbolType.None);
				}
			} else { // (columns < rows)
				myPane = new GraphPane( rect, "Matrix", "Rows", "Value" );
				for(int j = 0; j < columnCount; j++)
				{
					ppl.Clear();
					for(int i = 0; i < rowCount; i++)
					{
						ppl.Add(i, matrixData[i][j]);
					}
					Color color = ColorUtils.MatlabGraphColor(j);
					LineItem myCurve = myPane.AddCurve("", ppl.Clone(), color, SymbolType.None);
				}
			}

			var bm = new Bitmap( 1, 1 );
			using ( Graphics g = Graphics.FromImage( bm ) ) {
				myPane.AxisChange( g );
			}
			
			myPane.GetImage().Save(fileName, ImageFormat.Png);
		}