private void avgBox_CheckedChanged(object sender, EventArgs e) { if (avgBox.Checked) { Calculations calculations = new Calculations(); float avg = calculations.AVG(measurements); float[] avgs = new float[measurements.Count]; for (int i = 0; i < measurements.Count; i++) { avgs[i] = avg; } cartesianChart1.Series.Add(new LineSeries { Title = $"Średnia: {avg}", Values = new ChartValues <float>(avgs) }); } else { cartesianChart1.Series.Clear(); float[] values = new float[measurements.Count]; for (int i = 0; i < measurements.Count; i++) { values[i] = measurements[i].GetValue(); } int j = 1; foreach (float value in values) { cartesianChart1.Series.Add(new LineSeries { Title = $"Pomiar {j} {value}", Values = new ChartValues <float>(values) }); j++; } } }
private async Task Calculating() { float avg = calculations.AVG(content); }