private void UpdateData() { lock (this) { for (int i = 0; i < Count; i++) { _re[i] = 2.0 * Math.Sin(2 * Math.PI * i / 20) + 5.0 * Math.Sin(2 * Math.PI * i / 10) + 2.0 * _random.NextDouble(); _im[i] = IsFrequencyDomain ? 0.0 : i; } if (IsFrequencyDomain) { _transform.run(_re, _im); for (int i = 0; i < Count; i++) { double mag = Math.Sqrt(_re[i] * _re[i] + _im[i] * _im[i]); _re[i] = 20 * Math.Log10(mag / Count); _im[i] = i; } } DataSeries.SeriesName = YAxisTitle; DataSeries.Clear(); DataSeries.Append(_im, _re); } }
private void GeneratePlot() { var matchesInDateRange = MatchHistory.Where(m => Between(m, Settings.StartDate, Settings.EndDate)); var lineSeries = new LineSeries { Title = "SR", Values = new ChartValues <LiveCharts.Defaults.ObservableValue>( from r in matchesInDateRange select new LiveCharts.Defaults.ObservableValue(r.CR) ), LineSmoothness = 0, PointGeometry = DefaultGeometries.Circle, Fill = System.Windows.Media.Brushes.Transparent, DataLabels = false }; Brush weekendBrush = Brushes.DodgerBlue; lineSeries.Configuration = LiveCharts.Configurations.Mappers.Xy <LiveCharts.Defaults.ObservableValue>() .X((item, index) => index) .Y(item => item.Value) .Fill(ShouldBeWeekendColoured(weekendBrush)) .Stroke(ShouldBeWeekendColoured(weekendBrush)); var xLabels = from r in matchesInDateRange select r.Date.ToString("G"); Func <double, string> yFormatter = (i) => i.ToString(); Func <double, string> xFormatter = (i) => i.ToString("C"); if (DataSeries != null) { DataSeries.Clear(); } else { DataSeries = new SeriesCollection(); } DataSeries.Add(lineSeries); Labels = xLabels.ToArray(); YFormatter = yFormatter; XFormatter = xFormatter; YAxisStartValue = matchesInDateRange.FirstOrDefault()?.CR ?? 0; }
public void Reset() { lines.Clear(); }
public void Reset() { tapes.Clear(); }