public StatisticalAnalysisComp(GraphMetaData[] metaData)
        {
            InitializeComponent();
            this.m_metaData = metaData;

            lblAverage1.Visible = false;
            lblAverage2.Visible = false;
            lblAverage3.Visible = false;
            lblAverage4.Visible = false;
            lblSD1.Visible = false;
            lblSD2.Visible = false;
            lblSD3.Visible = false;
            lblSD4.Visible = false;

            txtAverag1.Visible = false;
            txtAverage2.Visible = false;
            txtAverage3.Visible = false;
            txtAverage4.Visible = false;
            txtSD1.Visible = false;
            txtSD2.Visible = false;
            txtSD3.Visible = false;
            txtSD4.Visible = false;

            PerformComparison();
        }
 private void showMetaData(GraphMetaData[] metaData)
 {
     if (metaData[0] != null)
     {
         lblAverage1.Visible = true;
         lblSD1.Visible = true;
         txtSD1.Visible = true;
         txtAverag1.Visible = true;
         txtAverag1.Text = metaData[0].Average.ToString();
         txtSD1.Text = metaData[0].StandardDeviation.ToString();
     }
     if (metaData[1] != null)
     {
         lblAverage2.Visible = true;
         lblSD2.Visible = true;
         txtSD2.Visible = true;
         txtAverage2.Visible = true;
         txtAverage2.Text = metaData[1].Average.ToString();
         txtSD2.Text = metaData[1].StandardDeviation.ToString();
     }
     if (metaData[2] != null)
     {
         lblAverage3.Visible = true;
         lblSD3.Visible = true;
         txtSD3.Visible = true;
         txtAverage3.Visible = true;
         txtAverage3.Text = metaData[2].Average.ToString();
         txtSD3.Text = metaData[2].StandardDeviation.ToString();
     }
     if (metaData[3] != null)
     {
         lblAverage4.Visible = true;
         lblSD4.Visible = true;
         txtSD4.Visible = true;
         txtAverage4.Visible = true;
         txtAverage4.Text = metaData[3].Average.ToString();
         txtSD4.Text = metaData[3].StandardDeviation.ToString();
     }
 }
Exemplo n.º 3
0
        private void printChart(InputData[] data, int lambda, string[] dataDescriptions)
        {
            DataTable table1, table2, table3, table4;


            this.Text = "Lambda" + lambda + " comparison";
            if (data.Length >= 1)
            {
                if (data[0] != null && activeLines[0])
                {
                    table1 = data[0].getLagrangeDatatable();
                    double[] array = new double[table1.Rows.Count];
                    this.chartLambda.Series.Add(dataDescriptions[0]).ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                    this.chartLambda.Series[dataDescriptions[0]].Color         = Color.Blue;
                    for (int i = 0; i < table1.Rows.Count; i++)
                    {
                        if (table1.Rows.Count > lambda)
                        {
                            this.chartLambda.Series[dataDescriptions[0]].Points.AddXY(i, table1.Rows[lambda][i]);
                            array[i] = (double)table1.Rows[lambda][i];
                        }
                    }
                    metaData[0] = new GraphMetaData
                    {
                        Average           = array.Average(),
                        StandardDeviation = getStandardDeviation(array.ToList <double>())
                    };
                }
            }
            if (data.Length >= 2)
            {
                if (data[1] != null && activeLines[1])
                {
                    table2 = data[1].getLagrangeDatatable();
                    double[] array = new double[table2.Rows.Count];
                    this.chartLambda.Series.Add(dataDescriptions[1]).ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                    this.chartLambda.Series[dataDescriptions[1]].Color         = Color.Red;
                    for (int i = 0; i < table2.Rows.Count; i++)
                    {
                        if (table2.Rows.Count > lambda)
                        {
                            this.chartLambda.Series[dataDescriptions[1]].Points.AddXY(i, table2.Rows[lambda][i]);
                            array[i] = (double)table2.Rows[lambda][i];
                        }
                    }
                    metaData[1] = new GraphMetaData
                    {
                        Average           = array.Average(),
                        StandardDeviation = getStandardDeviation(array.ToList <double>())
                    };
                }
            }
            if (data.Length >= 3)
            {
                if (data[2] != null && activeLines[2])
                {
                    table3 = data[2].getLagrangeDatatable();
                    double[] array = new double[table3.Rows.Count];
                    this.chartLambda.Series.Add(dataDescriptions[2]).ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                    this.chartLambda.Series[dataDescriptions[2]].Color         = Color.Green;
                    for (int i = 0; i < table3.Rows.Count; i++)
                    {
                        if (table3.Rows.Count > lambda)
                        {
                            this.chartLambda.Series[dataDescriptions[2]].Points.AddXY(i, table3.Rows[lambda][i]);
                            array[i] = (double)table3.Rows[lambda][i];
                        }
                    }
                    metaData[2] = new GraphMetaData
                    {
                        Average           = array.Average(),
                        StandardDeviation = getStandardDeviation(array.ToList <double>())
                    };
                }
            }
            if (data.Length >= 4)
            {
                if (data[3] != null && activeLines[3])
                {
                    table4 = data[3].getLagrangeDatatable();
                    double[] array = new double[table4.Rows.Count];
                    this.chartLambda.Series.Add(dataDescriptions[3]).ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                    this.chartLambda.Series[dataDescriptions[3]].Color         = Color.Orange;
                    for (int i = 0; i < table4.Rows.Count; i++)
                    {
                        if (table4.Rows.Count > lambda)
                        {
                            this.chartLambda.Series[dataDescriptions[3]].Points.AddXY(i, table4.Rows[lambda][i]);
                            array[i] = (double)table4.Rows[lambda][i];
                        }
                    }
                    metaData[3] = new GraphMetaData
                    {
                        Average           = array.Average(),
                        StandardDeviation = getStandardDeviation(array.ToList <double>())
                    };
                }
            }
        }
        private void printChart(InputData[] data, int lambda, string[] dataDescriptions)
        {

            DataTable table1, table2, table3, table4;


            this.Text = "Lambda" + lambda + " comparison";
            if (data.Length >= 1)
            {
                if (data[0] != null && activeLines[0])
                {
                    
                    table1 = data[0].getLagrangeDatatable();
                    double[] array = new double[table1.Rows.Count]; 
                    this.chartLambda.Series.Add(dataDescriptions[0]).ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                    this.chartLambda.Series[dataDescriptions[0]].Color = Color.Blue;
                    for (int i = 0; i < table1.Rows.Count; i++)
                    {
                        if (table1.Rows.Count > lambda)
                        {
                            this.chartLambda.Series[dataDescriptions[0]].Points.AddXY(i, table1.Rows[lambda][i]);
                            array[i] = (double)table1.Rows[lambda][i];
                        }
                    }
                    metaData[0] = new GraphMetaData 
                    {
                        Average = array.Average(),
                        StandardDeviation = getStandardDeviation(array.ToList<double>())
                    };
                }
                
            }
            if (data.Length >= 2)
            {
                if (data[1] != null && activeLines[1])
                {
                    
                    table2 = data[1].getLagrangeDatatable();
                    double[] array = new double[table2.Rows.Count]; 
                    this.chartLambda.Series.Add(dataDescriptions[1]).ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                    this.chartLambda.Series[dataDescriptions[1]].Color = Color.Red;
                    for (int i = 0; i < table2.Rows.Count; i++)
                    {
                        if (table2.Rows.Count > lambda)
                        {
                            this.chartLambda.Series[dataDescriptions[1]].Points.AddXY(i, table2.Rows[lambda][i]);
                            array[i] = (double)table2.Rows[lambda][i];
                        }
                    }
                    metaData[1] = new GraphMetaData 
                    {
                        Average = array.Average(),
                        StandardDeviation = getStandardDeviation(array.ToList<double>())
                    };
                }
            }
            if (data.Length >= 3)
            {
                if (data[2] != null && activeLines[2])
                {
                     
                    table3 = data[2].getLagrangeDatatable();
                    double[] array = new double[table3.Rows.Count];
                    this.chartLambda.Series.Add(dataDescriptions[2]).ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                    this.chartLambda.Series[dataDescriptions[2]].Color = Color.Green;
                    for (int i = 0; i < table3.Rows.Count; i++)
                    {
                        if (table3.Rows.Count > lambda)
                        {
                            this.chartLambda.Series[dataDescriptions[2]].Points.AddXY(i, table3.Rows[lambda][i]);
                            array[i] = (double)table3.Rows[lambda][i];
                        }
                    }
                    metaData[2] = new GraphMetaData 
                    {
                        Average = array.Average(),
                        StandardDeviation = getStandardDeviation(array.ToList<double>())
                    };
                }
            }
            if (data.Length >= 4)
            {
                if (data[3] != null && activeLines[3])
                {
                    table4 = data[3].getLagrangeDatatable();
                    double[] array = new double[table4.Rows.Count];
                    this.chartLambda.Series.Add(dataDescriptions[3]).ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                    this.chartLambda.Series[dataDescriptions[3]].Color = Color.Orange;
                    for (int i = 0; i < table4.Rows.Count; i++)
                    {
                        if (table4.Rows.Count > lambda)
                        {
                            this.chartLambda.Series[dataDescriptions[3]].Points.AddXY(i, table4.Rows[lambda][i]);
                            array[i] = (double)table4.Rows[lambda][i];
                        }
                    }
                    metaData[3] = new GraphMetaData 
                    {
                        Average = array.Average(),
                        StandardDeviation = getStandardDeviation(array.ToList<double>())
                    };
                }
            
            }
        }