public void updateChart(Data data) { if (updateCount == updateSet) { updateCheckState(); double minTime = ((double)data.getTime()[data.getTime().Count - 1]) - (double) timeSelection.Value*1000; int minTimeI = 0; for (int i = data.getTime().Count - 1; i >= 0; i--) if (data.getTime()[i] < minTime) { minTimeI = i; break; } for (int i = 0; i < checkState.Length; i++) { chart.Series[i].Points.Clear(); if (checkState[i]) { for (int j = minTimeI; j < data.getData()[i].Count; j++) { double time = ((double)data.getTime()[j]) / 1000; double y = (double)data.getData()[i][j]; chart.Series[i].Points.AddXY(time, y); } } } updateCount = 0; } else { updateCount++; } }
public iNterface() { plots = new List<Plot>(); data = new Data(); InitializeComponent(); }
private void clearData() { Console.WriteLine("Cleared Data"); data = new Data(); updatePlots(); updateDataCount(); }
public Plot(Data data) { string[] names = data.getNames(); InitializeComponent(); for (int i = 0; i < names.Length; i++) { System.Windows.Forms.DataVisualization.Charting.Series series = new System.Windows.Forms.DataVisualization.Charting.Series(); series.ChartArea = "Default"; series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.FastLine; series.Legend = "Default"; series.Name = names[i]; this.chart.Series.Add(series); } this.chartSelection.Items.AddRange((object[]) names); checkState = new bool[names.Length]; updateCheckState(); updateCount = 0; updateSet = 5; }