public DownsamplerSeries(PlotDownsampler owner, XYAxisSeries series, IObservable <List <DataPoint> > pointsSouce) { Series = series; PointsSouce = pointsSouce; Owner = owner; RawPoints = new List <DataPoint>(); pointsSouce.ObserveOnDispatcher().Subscribe(p => OnNewPoints(p)); }
private static Extent CreateExtentFor(XYAxisSeries chartData) { return(new Extent ( chartData.MinX, chartData.MaxX, chartData.MinY, chartData.MaxY )); }
public void AddSeries(XYAxisSeries series, IObservable <List <DataPoint> > points) { var record = new DownsamplerSeries(this, series, points); Series.Add(series, record); }
protected void UpdateXySeries(XYAxisSeries series, IPointSeries points) { series.Title = points.Label; }
public XYAxisSeries BuildXYSeries(PlotMetric metric, IList <Datapoint> dataPoints, XYAxisSeries series) { series.Title = metric.GetTitle(); DateTime startTime = dataPoints.Min(x => x.Timestamp).ToUniversalTime(); DateTime endTime = dataPoints.Max(x => x.Timestamp).ToUniversalTime(); IDictionary <DateTime, double> points = metric.GetIncrements(startTime, endTime).ToDictionary(x => x, y => double.NaN); foreach (var dataPoint in dataPoints) { DateTime timestamp = dataPoint.Timestamp.ToUniversalTime(); if (!points.ContainsKey(timestamp)) { throw new InvalidOperationException($"Generated time slice array doesn't contain {timestamp}"); } points[timestamp] = dataPoint.StatisticTypeValue(metric.StatisticType); } series.ItemsSource = points.Select(x => DateTimeAxis.CreateDataPoint(x.Key, x.Value)); return(series); }