There are two problems, please suggest what is wrong:
1) Need to draw two graphs of functions. The functions are drawn, but in the same colors, although I also set colors in the 'Series' section in the chart parameters and using separate methods.
2) When you click on the solveButton button, the first function is drawn first and only after the second one is pressed again.
Code:
private void button1_Click(object sender, EventArgs e) { int n = Convert.ToInt32(nBox.Text); // ΠΊΠΎΠ»-Π²ΠΎ ΡΠΎΡΠ΅ΠΊ(ΠΈΠΊΡΠΎΠ²) double[] xs = new double[n]; //ΠΈΠΊΡΡ double[] fxs = new double[n]; //Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΡΡΠ½ΠΊΡΠΈΠΈ Π² ΠΈΠΊΡΠ΅ double[] result = new double[n]; // Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΈΠ½ΡΠ΅ΡΠΏΠΎΠ»ΠΈΡΠΎΠ²Π°Π½Π½ΠΎΠΉ ΡΡΠ½ΠΊΡΠΈΠΈ for (int i = 0; i < n; i++) { xs[i] = (Math.PI / n) * (i + 1); fxs[i] = Function(xs[i]); result[i] = NDDP(xs[i], n, xs, fxs); chart1.Series["default"].Points.AddXY(xs[i], Function(xs[i])); chart1.Series["interpolated"].Points.AddXY(xs[i], result[i]); } }