private void cbRef_SelectionChangeCommitted(object sender, EventArgs e) { _refAngle = cbRef.SelectedItem.ToString(); foreach (var line in Lines) { if (line.Name.Contains("VA")) { VolChart.Series.Remove(line); } if (line.Name.Contains("IA")) { CurChart.Series.Remove(line); } } Lines.RemoveAll(item => (item.Name.Contains("IA") || item.Name.Contains("VA"))); foreach (var signal in _signals) { if (signal.SignalName.Contains("VA") || signal.SignalName.Contains("IA")) { signal.IsChecked = false; } } SetChartVisibility(); SetChartAreaYMaxMin(); VolChart.Update(); CurChart.Update(); dataGridView1.Refresh(); }
public void DeselectLines(string signalname) { try { if (Lines.Exists(x => (x.Name == signalname))) { Lines.Find(x => (x.Name == signalname)).Enabled = false; } SetChartVisibility(); SetChartAreaYMaxMin(); VolChart.Update(); CurChart.Update(); } catch (Exception ex) { Log4NetHelper.Instance.LogEntries(new LogEntry(DateTime.Now, "Error", ex.Message)); } }
public void AddLinesWithRef(string signalname, List <KeyValuePair <DateTime, double> > valuelist, List <KeyValuePair <DateTime, double> > reflist) { try { if (Lines.Exists(x => (x.Name == signalname))) { Lines.Find(x => (x.Name == signalname)).Enabled = true; } else { var line = new Series { Name = signalname, XValueType = ChartValueType.DateTime, ChartType = SeriesChartType.Line }; foreach (var value in valuelist) { if (line.Name.Contains(".VM")) { line.Points.AddXY(value.Key, value.Value * 1.732 / 1000); } else if (line.Name.Contains(".VA") || line.Name.Contains(".IA")) { line.Points.AddXY(value.Key, value.Value - reflist.Find(pair => pair.Key == value.Key).Value); } else { line.Points.AddXY(value.Key, value.Value); } } if (line.Name.Contains(".VM")) { line.ChartArea = "VMArea"; line.Legend = "VMLegend"; VolChart.Series.Add(line); } else if (line.Name.Contains(".VA")) { line.ChartArea = "VAArea"; line.Legend = "VALegend"; VolChart.Series.Add(line); } else if (line.Name.Contains(".IM")) { line.ChartArea = "IMArea"; line.Legend = "IMLegend"; CurChart.Series.Add(line); } else if (line.Name.Contains(".IA")) { line.ChartArea = "IAArea"; line.Legend = "IALegend"; CurChart.Series.Add(line); } Lines.Add(line); } SetChartVisibility(); SetChartAreaYMaxMin(); VolChart.Update(); CurChart.Update(); } catch (Exception ex) { Log4NetHelper.Instance.LogEntries(new LogEntry(DateTime.Now, "Error", ex.Message)); } }