private void AddToChart(string name, StackPanel legend, ChartControl chart, PowerSpectra sp, Color color) { if (sp != null) { var e = new LineChartElement { Color = color }; for (int i = 0; i < sp.Mag2.Length; i++) { e.Points.Add(new Point(sp.F[i], sp.Mag2[i])); } chart.ChartElements.Add(e); var t = new TextBlock { Text = name, FontWeight = FontWeights.Bold, FontSize = 16, Margin = new Thickness(0, 0, 6, 0), Foreground = new SolidColorBrush(color) }; legend.Children.Add(t); } chart.Canvas.Refresh(); RefreshBorders(chart); }
private void AddToChart(string name, StackPanel legend, ChartControl chart, TimeSeriesDouble ts, Color color) { if (ts != null) { var e = new LineChartElement { Color = color }; for (int i = 0; i < ts.Data.Count; i++) { e.Points.Add(new Point(i / ts.SampleRate / 3600.0, ts.Data[i])); } chart.ChartElements.Add(e); var t = new TextBlock(); t.Text = name; t.FontWeight = FontWeights.Bold; t.FontSize = 16; t.Margin = new Thickness(0, 0, 6, 0); t.Foreground = new SolidColorBrush(color); legend.Children.Add(t); } chart.Canvas.Refresh(); RefreshBorders(chart); }