public static void BuildChartRelFreqPoligonFreq(double[] Elements, Chart chart) { chart.Series.Clear(); chart.ChartAreas.Clear(); chart.ChartAreas.Add("ChartArea1"); chart.ChartAreas["ChartArea1"].AxisX.Interval = 1; chart.ChartAreas["ChartArea1"].AxisY.Interval = 1; chart.ChartAreas["ChartArea1"].AxisX.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle; chart.ChartAreas["ChartArea1"].AxisY.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle; chart.Series.Add("Poligon"); chart.Series["Poligon"].IsXValueIndexed = true; chart.Series["Poligon"].BorderWidth = 3; chart.Series["Poligon"].ChartType = SeriesChartType.Line; CRow Row = new CRow(new List <double>(Elements)); int length = Row.UniqLength(); for (int i = 0; i < length; ++i) { chart.Series["Poligon"].Points.AddXY(Row.Elements[i].numb, Row.Elements[i].rel_frequency); } }
public static void BuildChartAccumRelFreq(double[] Elements, Chart chart) { chart.Series.Clear(); chart.ChartAreas.Clear(); chart.ChartAreas.Add("ChartArea1"); chart.ChartAreas["ChartArea1"].AxisX.Interval = 1; chart.ChartAreas["ChartArea1"].AxisY.Interval = 5; chart.ChartAreas["ChartArea1"].AxisX.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle; chart.ChartAreas["ChartArea1"].AxisY.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle; chart.ChartAreas["ChartArea1"].AxisY.Interval = Math.Round(1 / (double)Elements.Length, 4); chart.ChartAreas["ChartArea1"].AxisX.ScaleView.Zoomable = true; chart.ChartAreas["ChartArea1"].CursorX.AutoScroll = true; chart.ChartAreas["ChartArea1"].CursorX.IsUserSelectionEnabled = true; // this.chart3.ChartAreas["ChartArea1"].AxisY.Maximum = this.MyRow.Length()+1; chart.Series.Add("Series"); chart.Series["Series"].IsXValueIndexed = true; chart.Series["Series"].BorderWidth = 3; chart.Series["Series"].ChartType = SeriesChartType.Spline; CRow Row = new CRow(new List <double>(Elements)); int length = Row.UniqLength(); for (int i = 0; i < length; ++i) { chart.Series["Series"].Points.AddXY(Row.Elements[i].numb, Row.Elements[i].acum_rel_freq); } }
public static void BuildChartEmpiricalFunk(double[] Elements, Chart chart) { CRow Row = new CRow(new List <double>(Elements)); int length = Row.UniqLength(); chart.Series.Clear(); chart.ChartAreas.Clear(); chart.ChartAreas.Add("ChartArea1"); chart.ChartAreas["ChartArea1"].AxisX.Interval = 1; chart.ChartAreas["ChartArea1"].AxisY.Interval = 5; chart.ChartAreas["ChartArea1"].AxisX.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle; chart.ChartAreas["ChartArea1"].AxisY.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle; chart.ChartAreas["ChartArea1"].AxisY.Interval = Math.Round(1 / (double)Elements.Length, 4); chart.ChartAreas["ChartArea1"].AxisX.ScaleView.Zoomable = true; chart.ChartAreas["ChartArea1"].CursorX.AutoScroll = true; chart.ChartAreas["ChartArea1"].CursorX.IsUserSelectionEnabled = true; chart.ChartAreas["ChartArea1"].AxisX.Minimum = Elements.Min() - 10; chart.ChartAreas["ChartArea1"].AxisX.Maximum = Elements[length - 1]; chart.Series.Add("Series"); chart.Series["Series"].IsXValueIndexed = true; chart.Series["Series"].BorderWidth = 3; chart.Series["Series"].ChartType = SeriesChartType.Spline; chart.Series["Series"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series["Series"].Color = System.Drawing.Color.DarkViolet; chart.Series["Series"].BorderWidth = 4; chart.Series["Series"].Points.AddXY(-10, 0); chart.Series["Series"].Points.AddXY(Row.Elements[0].numb, 0); for (int i = 1; i < length; ++i) { chart.Series.Add("Se" + i.ToString()); // this.chart5.Series["Se" + i.ToString()].IsXValueIndexed = true; chart.Series["Se" + i.ToString()].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series["Se" + i.ToString()].Color = System.Drawing.Color.DarkViolet; chart.Series["Se" + i.ToString()].BorderWidth = 4; chart.Series["Se" + i.ToString()].Points.AddXY(Row.Elements[i - 1].numb, Row.Elements[i].acum_rel_freq); chart.Series["Se" + i.ToString()].Points.AddXY(Row.Elements[i].numb, Row.Elements[i].acum_rel_freq); } }
public static void FillDSRGrid(double[] Elements, System.Windows.Forms.DataGridView Grid) { CRow Row = new CRow(new List <double>(Elements)); int Length = Row.UniqLength(); Grid.ColumnCount = 2 + Elements.Length; Grid.Rows.Clear(); string[] row = new string[Grid.ColumnCount]; row[0] = "x"; for (int i = 0; i < Length; ++i) { row[i + 1] = Row.Elements[i].numb.ToString(); } Grid.Rows.Add(row); row[0] = "m"; for (int i = 0; i < Length; ++i) { row[i + 1] = Row.Elements[i].frequency.ToString(); } Grid.Rows.Add(row); row[0] = "p*"; for (int i = 0; i < Length; ++i) { row[i + 1] = Math.Round(Row.Elements[i].rel_frequency, LabToolz.ROUND_DIGITS).ToString(); } Grid.Rows.Add(row); row[0] = "acum(m)"; for (int i = 0; i < Length; ++i) { row[i + 1] = Row.Elements[i].acum_freq.ToString(); } Grid.Rows.Add(row); row[0] = "acum(p*)"; for (int i = 0; i < Length; ++i) { row[i + 1] = Math.Round(Row.Elements[i].acum_rel_freq, LabToolz.ROUND_DIGITS).ToString(); } string[] row2 = { " " }; Grid.Rows.Add(row2); row[0] = "x - averstat(x)"; double sum = 0; double averstat = Statistic.GetAverStatic(Elements); for (int i = 0; i < Length; ++i) { sum += Row.Elements[i].numb - averstat; row[i + 1] = (Row.Elements[i].numb - averstat).ToString(); } row[Length + 1] = "SUM=" + sum; Grid.Rows.Add(row); row[0] = "(x - averstat(x))^2"; sum = 0; averstat = Statistic.GetAverStatic(Elements); for (int i = 0; i < Length; ++i) { sum += (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat); row[i + 1] = ((Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat)).ToString(); } row[Length + 1] = "SUM=" + sum; Grid.Rows.Add(row); row[0] = "(x - averstat(x))^3"; sum = 0; averstat = Statistic.GetAverStatic(Elements); for (int i = 0; i < Length; ++i) { sum += (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat); row[i + 1] = ((Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat)).ToString(); } row[Length + 1] = "SUM=" + sum; Grid.Rows.Add(row); row[0] = "(x - averstat(x))^4"; sum = 0; averstat = Statistic.GetAverStatic(Elements); for (int i = 0; i < Length; ++i) { sum += (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat); row[i + 1] = ((Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat)).ToString(); } row[Length + 1] = "SUM=" + sum; Grid.Rows.Add(row); Grid.Rows.Add(row2); row[0] = "x"; row[1] = "[-intf;" + Row.Elements[0].numb.ToString() + ")"; for (int i = 1; i < Length; ++i) { row[i + 1] = "[ " + Row.Elements[i - 1].numb.ToString() + ";" + Row.Elements[i].numb.ToString() + ")"; } row[Length + 1] = "[ " + Row.Elements[Length - 1].numb.ToString() + ";+ inf]"; Grid.Rows.Add(row); row[0] = "F*(x)"; row[1] = "0"; for (int i = 1; i < Length; ++i) { row[i + 1] = Math.Round(Row.Elements[i - 1].acum_rel_freq, LabToolz.ROUND_DIGITS).ToString(); } row[Length + 1] = "1"; Grid.Rows.Add(row); for (int i = 0; i < Grid.Columns.Count; ++i) { DataGridViewColumn column = Grid.Columns[i]; column.Width = 80; } }
public static double[] GetMod(double[] Elements) { CRow Row = new CRow(new List <double>(Elements)); return(Row.GetMod()); }