private void LoadData(object sender, EventArgs e) { Gradient gradient = new Gradient(9, 0.01, 2.0, 10, 1.5); chart1.Series["Series1"].ChartType = SeriesChartType.Spline; gradient.SetStartPoint(); double length = 0.0; int i = 0; do { length = gradient.GetNext(); chart1.Series["Series1"].Points.AddXY(i, length); i++; } while (length > epsilon && i < maxIteration); Console.WriteLine("\nIteration = " + (i - 1)); Console.WriteLine("Distance between atoms = " + gradient.GetPoint() + "\n"); chart1.ChartAreas[0].AxisX.Minimum = 0; chart1.ChartAreas[0].AxisY.Minimum = 0; chart1.Update(); }