Exemplo n.º 1
0
        private void button_draw_Click(object sender, EventArgs e)
        {
            Series Series = new System.Windows.Forms.DataVisualization.Charting.Series();

            Series seriesX = new Series(this.bindingSource_prns.Current.ToString());

            seriesX.ChartType   = SeriesChartType.Line;// SeriesChartType.Point;
            seriesX.YValueType  = ChartValueType.Double;
            seriesX.XValueType  = ChartValueType.DateTime;
            seriesX.MarkerSize  = 3;
            seriesX.BorderWidth = 2;
            seriesX.ToolTip     = "#SERIESNAME: #VALX, #VALY";

            var data = this.bindingSource1.DataSource as List <FcbValue>;

            if (data == null)
            {
                return;
            }
            foreach (var item in data)
            {
                seriesX.Points.AddXY(item.Time.DateTime, item.Value);
            }

            var form = new Geo.Winform.CommonChartForm(seriesX);

            form.Text = this.bindingSource_prns.Current.ToString() + "_FCB_of_" + Path.GetFileName(this.fileOpenControl1.FilePath);
            form.Show();
        }
Exemplo n.º 2
0
        public void DrawDifferLine(List <NamedXyzEnu> differs)
        {
            if (differs == null || differs.Count == 0)
            {
                return;
            }
            int index = 0;
            //E
            Series seriesE = new Series("E");

            seriesE.ChartType = SeriesChartType.Column;

            foreach (var item in differs.ToArray())
            {
                index++;
                seriesE.Points.Add(new DataPoint(index, item.E));
            }
            //N
            index = 0;
            Series seriesN = new Series("N");

            seriesN.ChartType = SeriesChartType.Column;
            foreach (var item in differs.ToArray())
            {
                index++;
                seriesN.Points.Add(new DataPoint(index, item.N));
            }
            //U
            index = 0;
            Series seriesU = new Series("U");

            seriesU.ChartType = SeriesChartType.Column;
            foreach (var item in differs.ToArray())
            {
                index++;
                seriesU.Points.Add(new DataPoint(index, item.U));
            }
            //Len
            index = 0;
            Series seriesLen = new Series("Len");

            seriesLen.ChartType = SeriesChartType.Line;
            foreach (var item in differs.ToArray())
            {
                index++;
                seriesLen.Points.Add(new DataPoint(index, item.Len));
            }

            Geo.Winform.CommonChartForm form = new Geo.Winform.CommonChartForm(seriesE, seriesN, seriesU, seriesLen);
            form.Text = "Residual Bias Count " + differs.Count;
            form.Show();
        }
Exemplo n.º 3
0
        private void button_drawTableView_Click(object sender, EventArgs e)
        {
            //var tables = objectTableControl1.DataGridView.DataSource as DataTable;
            //if (tables == null) { return; }
            if (TableObjectStorage == null)
            {
                Geo.Utils.FormUtil.ShowOkMessageBox("数据表为空!"); return;
            }
            var chartForm = new Geo.Winform.CommonChartForm(TableObjectStorage, System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point);

            chartForm.Text = "" + this.bindingSource_sat.Current;
            chartForm.Show();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 显示图片。
        /// </summary>
        /// <param name="table"></param>
        /// <param name="dic"></param>
        /// <param name="maxVal"></param>
        /// <param name="minVal"></param>
        private void ShowCharForm(ObjectTableStorage table, Dictionary <string, Series> dic, double maxVal, double minVal)
        {
            List <Series> list = new List <Series>(dic.Values);
            var           form = new Geo.Winform.CommonChartForm(list.ToArray());

            SetYSpan(maxVal, minVal, form);

            form.Text = table.Name + " 列×行: " + list.Count + "×" + table.RowCount;
            if (IsMaxChartWindow)
            {
                form.WindowState = FormWindowState.Maximized;
            }
            form.Show();
        }
Exemplo n.º 5
0
        public void DrawDifferLine(List <NamedXyz> differs)
        {
            if (differs == null || differs.Count == 0)
            {
                return;
            }
            int index = 0;
            //X
            Series seriesX = new Series("X");

            seriesX.ChartType = SeriesChartType.Column;

            foreach (var item in differs.ToArray())
            {
                index++;
                seriesX.Points.Add(new DataPoint(index, item.Value.X));
            }
            //Y
            index = 0;
            Series seriesY = new Series("Y");

            seriesY.ChartType = SeriesChartType.Column;
            foreach (var item in differs.ToArray())
            {
                index++;
                seriesY.Points.Add(new DataPoint(index, item.Value.Y));
            }
            //Z
            index = 0;
            Series seriesZ = new Series("Z");

            seriesZ.ChartType = SeriesChartType.Column;
            foreach (var item in differs.ToArray())
            {
                index++;
                seriesZ.Points.Add(new DataPoint(index, item.Value.Z));
            }

            Geo.Winform.CommonChartForm form = new Geo.Winform.CommonChartForm(seriesX, seriesY, seriesZ);
            form.Text = "XYZ Error";
            form.Show();
        }
Exemplo n.º 6
0
        private void button_draw_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.HasIndexColumn)
                {
                    List <double[]>             doubles    = Utils.DoubleUtil.ParseTable(this.InputLines);
                    List <double[]>             outdoubles = Utils.DoubleUtil.ParseTable(this.OutputLines);
                    Dictionary <Double, Double> dic        = DoubleUtil.ToDic(doubles);
                    var inputs  = DoubleUtil.ToDic(doubles);
                    var outputs = DoubleUtil.ToDic(outdoubles);


                    List <Dictionary <Double, Double> > lists = new List <Dictionary <double, double> >();

                    List <string> names = new List <string>();
                    if (inputs != null && inputs.Count > 0)
                    {
                        lists.Add(inputs);
                        names.Add("Input");
                    }
                    if (outputs != null && outputs.Count > 0)
                    {
                        lists.Add(outputs);
                        names.Add("Output");
                    }

                    if (lists.Count > 0)
                    {
                        var form = new Geo.Winform.CommonChartForm(lists, names);
                        form.Text = "Data";
                        form.Show();
                    }
                }
                else
                {
                    var inputs  = (Utils.DoubleUtil.ParseLines(this.InputLines));
                    var outputs = (Utils.DoubleUtil.ParseLines(this.OutputLines));
                    List <IEnumerable <Double> > lists = new List <IEnumerable <double> >();
                    List <string> names = new List <string>();
                    if (inputs != null && inputs.Length > 0)
                    {
                        lists.Add(inputs);
                        names.Add("Input");
                    }
                    if (outputs != null && outputs.Length > 0)
                    {
                        lists.Add(outputs);
                        names.Add("Output");
                    }

                    if (lists.Count > 0)
                    {
                        var form = new Geo.Winform.CommonChartForm(lists, names);
                        form.Text = "Data";
                        form.Show();
                    }
                }
            }
            catch (Exception ex) { Geo.Utils.FormUtil.ShowErrorMessageBox("绘图发生错误!" + ex.Message); }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 绘制数据表。
        /// </summary>
        /// <param name="DataGridView"></param>
        /// <param name="indexName"></param>
        /// <param name="chartName"></param>
        public static void SelectColsAndDraw(DataGridView DataGridView, string indexName, string chartName)
        {
            //检查是否选中列
            if (DataGridView.SelectedRows == null || DataGridView.SelectedRows.Count < 1)
            {
                MessageBox.Show("请选择要绘制的行!");
                return;
            }
            //选择需要打印的列。
            List <string> titleList = new List <string>();

            foreach (DataGridViewColumn col in DataGridView.Columns)
            {
                if (col.HeaderText == indexName)
                {
                    continue;
                }
                titleList.Add(col.HeaderText);
            }
            //弹窗选择
            var list = Geo.Utils.FormUtil.OpenFormSelectTitles(titleList);

            if (list.Count < 1)
            {
                return;
            }

            list.Insert(0, indexName);
            //着手打印了
            ObjectTableStorage tb = new ObjectTableStorage();
            int i = 0;

            foreach (DataGridViewRow row in DataGridView.SelectedRows)
            {
                tb.NewRow();
                foreach (var title in list)
                {
                    var val = row.Cells[title].Value;
                    if (title.Equals(indexName))
                    {
                        DateTime time;
                        double   dIndex = 0;
                        if (DateTime.TryParse(val.ToString(), out time))
                        {
                            tb.AddItem(title, time);
                        }
                        else if (Double.TryParse(val.ToString(), out dIndex))
                        {
                            tb.AddItem(title, dIndex);
                        }
                        else
                        {
                            tb.AddItem(title, i);
                        }
                    }
                    else if (Geo.Utils.ObjectUtil.IsNumerial(val))
                    {
                        tb.AddItem(title, double.Parse(val.ToString()));
                    }
                    else
                    {
                        double dval = 0;
                        if (double.TryParse(val.ToString(), out dval))
                        {
                            tb.AddItem(title, dval);
                        }
                    }
                }
                i++;
            }
            var chartForm = new Geo.Winform.CommonChartForm(tb);

            chartForm.Text = "" + chartName;
            chartForm.Show();
        }
Exemplo n.º 8
0
        /// <summary>
        /// 如果非
        /// </summary>
        /// <param name="_results"></param>
        public void DrawParamRmsLine()
        {
            if (Adjustments == null || Adjustments.Count == 0)
            {
                return;
            }

            Vector vector = CenterVector;

            int start = StartIndex;
            int end   = EndIndex;

            int resultIndex = 0;
            //X
            var names = Adjustments[0].ParamNames;

            if (ParamNames != null)
            {
                names = ParamNames;
            }

            Dictionary <string, Series> dic = new Dictionary <string, Series>();
            int i = 0;

            foreach (var name in names)
            {
                i++;
                if (i > ParamCount)
                {
                    break;
                }

                Series seriesX = new Series(name);
                seriesX.ChartType = SeriesChartType.Point;

                dic[name] = seriesX;
            }


            foreach (var result in Adjustments.ToArray())//避免集合修改无法遍历
            {
                resultIndex++;

                //起始
                if (resultIndex > start)
                {
                    var est        = result.Get(AdjustVectorType);//.Estimated;
                    int paramIndex = StartParamIndex;
                    foreach (var kv in dic)
                    {
                        if (paramIndex >= EndParamIndex)
                        {
                            break;
                        }

                        var name         = kv.Key;
                        var indexOfParam = result.ParamNames.IndexOf(name);
                        if (indexOfParam != -1)
                        {
                            var qrt = est.InverseWeight[indexOfParam, indexOfParam];
                            kv.Value.Points.Add(new DataPoint(resultIndex, Math.Sqrt(qrt)));
                        }
                        paramIndex++;
                    }
                }

                //截止
                if (resultIndex > end)
                {
                    break;
                }
            }
            List <Series> list = new List <Series>(dic.Values);

            Geo.Winform.CommonChartForm form = new Geo.Winform.CommonChartForm(list.ToArray());
            form.Text = "Estimated Rms Of First " + list.Count + " Params";
            form.Show();
        }
Exemplo n.º 9
0
        /// <summary>
        /// 绘制估计值
        /// </summary>
        public void DrawParamLines()
        {
            if (Adjustments == null || Adjustments.Count == 0)
            {
                return;
            }

            Vector vector = CenterVector;

            int start = StartIndex;
            int end   = EndIndex;

            int resultIndex = 0;


            //X
            var names = Adjustments[0].ParamNames;

            if (ParamNames != null)
            {
                names = ParamNames;
            }

            Dictionary <string, Series> dic = new Dictionary <string, Series>();
            int i = 0;

            foreach (var name in names)
            {
                i++;
                if (i > ParamCount)
                {
                    break;
                }

                Series seriesX = new Series(name);
                seriesX.ChartType = SeriesChartType.Point;
                dic[name]         = seriesX;
            }

            foreach (var result in Adjustments)//避免集合修改无法遍历
            {
                resultIndex++;

                //起始
                if (resultIndex > start)
                {
                    int paramIndex = StartParamIndex;
                    foreach (var kv in dic)
                    {
                        if (paramIndex >= EndParamIndex)
                        {
                            break;
                        }

                        var name = kv.Key;
                        if (result.ParamNames.Contains(name))
                        {
                            kv.Value.Points.Add(new DataPoint(resultIndex, result[name] - vector[paramIndex]));
                        }
                        paramIndex++;
                    }
                }

                //截止
                if (resultIndex > end)
                {
                    break;
                }
            }
            List <Series> list = new List <Series>(dic.Values);

            Geo.Winform.CommonChartForm form = new Geo.Winform.CommonChartForm(list.ToArray());
            form.Text = "Estimated Values Of First " + list.Count + " Params";
            form.Show();
        }