Beispiel #1
0
        private void DrawExtrapolation()
        {
            if (PointsXY.Count == 5)
            {
                if (ApproxChart.Series.FindByName("Extrapolation") != null)
                {
                    ApproxChart.Series.Remove(ApproxChart.Series.FindByName("Extrapolation"));
                }
                Series series = new Series("Extrapolation");
                series.ChartType = SeriesChartType.Point;
                series.ChartArea = "Approximation functions";
                if (CheckBLagrange.Checked)
                {
                    Lagrange lagrange = new Lagrange(sortPointList(PointsXY));

                    series.Points.AddXY(0, lagrange.getResult(0));
                    series.Points.AddXY(6, lagrange.getResult(6));
                }
                if (CheckBLS.Checked)
                {
                    LeastSquares leastSquares = new LeastSquares(sortPointList(PointsXY));
                    series.Points.AddXY(0, leastSquares.getResult(0));
                    series.Points.AddXY(6, leastSquares.getResult(6));
                }
                ApproxChart.Series.Add(series);
            }
        }
Beispiel #2
0
 private void DrawFunction()
 {
     if (buildFunction)
     {
         if (CheckBLagrange.Checked && PointsXY.Count == 5)
         {
             Lagrange lagrange = new Lagrange(sortPointList(PointsXY));
             if (ApproxChart.Series.FindByName("Lagrange") != null)
             {
                 ApproxChart.Series.Remove(ApproxChart.Series.FindByName("Lagrange"));
             }
             Series series = new Series("Lagrange");
             series.ChartType = SeriesChartType.Line;
             series.ChartArea = "Approximation functions";
             for (double x = 0; x < ApproxChart.ChartAreas[0].AxisX.Maximum; x += 0.01)
             {
                 series.Points.AddXY(x, lagrange.getResult(x));
             }
             ApproxChart.Series.Add(series);
         }
         if (CheckBLS.Checked && PointsXY.Count == 5)
         {
             LeastSquares leastSquares = new LeastSquares(sortPointList(PointsXY));
             if (ApproxChart.Series.FindByName("LeastSquares") != null)
             {
                 ApproxChart.Series.Remove(ApproxChart.Series.FindByName("LeastSquares"));
             }
             Series series = new Series("LeastSquares");
             series.ChartType = SeriesChartType.Line;
             series.ChartArea = "Approximation functions";
             for (double x = 0; x < ApproxChart.ChartAreas[0].AxisX.Maximum; x += 0.01)
             {
                 series.Points.AddXY(x, leastSquares.getResult(x));
             }
             ApproxChart.Series.Add(series);
         }
         DrawExtrapolation();
     }
 }