public void WriteStatistical(double[] dataAr, string rowName) { if (DataConvertationClass.IsUndefinedElement(dataAr)) { return; } double mid = Statistical.Middle(dataAr); double disp = Statistical.Dispersion(dataAr); double skewn = Statistical.Skewness(dataAr); double kurt = Statistical.Kurtosis(dataAr); double jb = Statistical.JB(dataAr, 0); richTextBox.SelectionFont = new Font("Arial", 12, FontStyle.Bold); richTextBox.SelectedText = "\nСтатистичні характеристики."; richTextBox.SelectionAlignment = HorizontalAlignment.Center; richTextBox.SelectionFont = new Font("Arial", 12, FontStyle.Bold); richTextBox.SelectedText = "\nРяд \"" + rowName + "\"."; richTextBox.SelectionAlignment = HorizontalAlignment.Center; richTextBox.SelectedText = "\n"; richTextBox.SelectionFont = new Font("Arial", 10); richTextBox.SelectionAlignment = HorizontalAlignment.Left; richTextBox.SelectionIndent = 15; richTextBox.SelectedText = "\nСереднє\t\t\t" + mid.ToString("F4") + "\v"; richTextBox.SelectedText = "\nДисперсія\t\t\t" + disp.ToString("F4") + "\v"; richTextBox.SelectedText = "\nКоофіцієнт асиметрії\t\t" + skewn.ToString("F4") + "\v"; richTextBox.SelectedText = "\nЕксцес\t\t\t" + kurt.ToString("F4") + "\v"; richTextBox.SelectedText = "\nЖака-Бера\t\t\t" + jb.ToString("F4") + "\v"; }
private void Draw() { if (DataConvertationClass.IsUndefinedElement(_dataAr)) { MessageBox.Show(Text + ". Існують не визначені елементи!"); return; } dataGridView1.ColumnCount = _degree + 2; dataGridView1.RowCount = 2; dataGridView1[0, 0].Value = "Автокореляції"; dataGridView1[0, 1].Value = "ЧАКФ"; double[] ACArray = Statistical.ACF(_dataAr, _degree); double[] PACArray = Statistical.PACF(_dataAr, _degree); double[] XList = new double[_degree + 1]; for (int i = 1; i < dataGridView1.ColumnCount; i++) { dataGridView1.Columns[i].Name = (i - 1).ToString(); dataGridView1[i, 0].Value = ACArray[i - 1].ToString("F6"); if (Math.Abs(ACArray[i - 1]) >= level) { dataGridView1[i, 0].Style.ForeColor = Color.Red; } else { dataGridView1[i, 0].Style.ForeColor = Color.Black; } dataGridView1[i, 1].Value = PACArray[i - 1].ToString("F6"); if (Math.Abs(PACArray[i - 1]) >= level) { dataGridView1[i, 1].Style.ForeColor = Color.Red; } else { dataGridView1[i, 1].Style.ForeColor = Color.Black; } XList[i - 1] = i - 1; } dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; ZedGraph.LineObj levelLine1 = new ZedGraph.LineObj(Color.Red, -1, level, _degree + 1, level); levelLine1.Line.Width = 2; ZedGraph.LineObj levelLine2 = new ZedGraph.LineObj(Color.Red, -1, -level, _degree + 1, -level); levelLine2.Line.Width = 2; ZedGraph.GraphPane ACpane = ACzedGraphControl.GraphPane; ACpane.CurveList.Clear(); ACpane.GraphObjList.Clear(); ACpane.Title.Text = "Автокореляція"; ACpane.XAxis.Title.IsVisible = false; ACpane.XAxis.MajorGrid.IsVisible = true; ACpane.XAxis.MajorGrid.DashOn = 1; ACpane.XAxis.MajorGrid.DashOff = 1; ACpane.XAxis.Scale.Min = 0; ACpane.XAxis.Scale.Max = ACArray.Length; ACpane.YAxis.Title.IsVisible = false; ACpane.YAxis.MajorGrid.IsVisible = true; ACpane.YAxis.MajorGrid.DashOn = 1; ACpane.YAxis.MajorGrid.DashOff = 1; ACpane.YAxis.Scale.Min = -2; ACpane.YAxis.Scale.Max = 2; ZedGraph.PointPairList ACList = new ZedGraph.PointPairList(XList, ACArray); ACpane.AddBar("", ACList, Color.BlanchedAlmond); ACpane.GraphObjList.Add(levelLine1); ACpane.GraphObjList.Add(levelLine2); ACzedGraphControl.Refresh(); ZedGraph.GraphPane PACpane = PACzedGraphControl.GraphPane; PACpane.CurveList.Clear(); PACpane.GraphObjList.Clear(); PACpane.Title.Text = "ЧАКФ"; PACpane.XAxis.Title.IsVisible = false; PACpane.XAxis.MajorGrid.IsVisible = true; PACpane.XAxis.MajorGrid.DashOn = 1; PACpane.XAxis.MajorGrid.DashOff = 1; PACpane.XAxis.Scale.Min = 0; PACpane.XAxis.Scale.Max = ACArray.Length; PACpane.YAxis.Title.IsVisible = false; PACpane.YAxis.MajorGrid.IsVisible = true; PACpane.YAxis.MajorGrid.DashOn = 1; PACpane.YAxis.MajorGrid.DashOff = 1; PACpane.YAxis.Scale.Min = -2; PACpane.YAxis.Scale.Max = 2; ZedGraph.PointPairList PACList = new ZedGraph.PointPairList(XList, PACArray); PACpane.AddBar("", PACList, Color.BlanchedAlmond); PACpane.GraphObjList.Add(levelLine1); PACpane.GraphObjList.Add(levelLine2); PACzedGraphControl.Refresh(); }