Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 private static Extent CreateExtentFor(XYAxisSeries chartData)
 {
     return(new Extent
            (
                chartData.MinX,
                chartData.MaxX,
                chartData.MinY,
                chartData.MaxY
            ));
 }
Ejemplo n.º 3
0
        public void AddSeries(XYAxisSeries series, IObservable <List <DataPoint> > points)
        {
            var record = new DownsamplerSeries(this, series, points);

            Series.Add(series, record);
        }
Ejemplo n.º 4
0
 protected void UpdateXySeries(XYAxisSeries series, IPointSeries points)
 {
     series.Title = points.Label;
 }
Ejemplo n.º 5
0
        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);
        }