示例#1
0
        public static PlotModel TimeSpanaxisPlotModel()
        {
            var start = new TimeSpan(0, 0, 0, 0);
            var end = new TimeSpan(0, 24, 0, 0);
            double increment = 3600;

            // Create a random data collection
            var r = new Random(7);
            var data = new Collection<TimeValue>();
            var current = start;
            while (current <= end)
            {
                data.Add(new TimeValue { Time = current, Value = r.NextDouble() });
                current = current.Add(new TimeSpan(0, 0, (int)increment));
            }

            var plotModel1 = new PlotModel { Title = "TimeSpan axis" };
            var timeSpanAxis1 = new TimeSpanAxis { Position = AxisPosition.Bottom, StringFormat = "h:mm" };
            plotModel1.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis { Position = AxisPosition.Left };
            plotModel1.Axes.Add(linearAxis1);
            var lineSeries1 = new LineSeries
            {
                Color = OxyColor.FromArgb(255, 78, 154, 6),
                MarkerFill = OxyColor.FromArgb(255, 78, 154, 6),
                MarkerStroke = OxyColors.ForestGreen,
                MarkerType = MarkerType.Plus,
                StrokeThickness = 1,
                DataFieldX = "Time",
                DataFieldY = "Value",
                ItemsSource = data
            };
            plotModel1.Series.Add(lineSeries1);
            return plotModel1;
        }
示例#2
0
        public static PlotModel MinuteData_TimeSpan()
        {
            var pm = new PlotModel {
                Title = "Minute Data (TimeSpanAxis)"
            };

            var timeSpanAxis1 = new TimeSpanAxis {
                Position = AxisPosition.Bottom, StringFormat = "hh:mm"
            };

            pm.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis {
                Position = AxisPosition.Left
            };

            pm.Axes.Add(linearAxis1);
            var candleStickSeries = new OldCandleStickSeries
            {
                CandleWidth         = 5,
                Color               = OxyColors.DarkGray,
                IncreasingFill      = OxyColors.DarkGreen,
                DecreasingFill      = OxyColors.Red,
                DataFieldX          = "QTime",
                DataFieldHigh       = "H",
                DataFieldLow        = "L",
                DataFieldOpen       = "O",
                DataFieldClose      = "C",
                TrackerFormatString = "High: {2:0.00}\nLow: {3:0.00}\nOpen: {4:0.00}\nClose: {5:0.00}",
                ItemsSource         = lst
            };

            pm.Series.Add(candleStickSeries);
            return(pm);
        }
示例#3
0
            public void TimeSpanAxis()
            {
                var s1 = new Axes.TimeSpanAxis();
                var s2 = new TimeSpanAxis();

                OxyAssert.PropertiesAreEqual(s1, s2);
            }
示例#4
0
        public void UpdateReportPlots()
        {
            double maxTime  = double.MinValue;
            double minTime  = double.MaxValue;
            double maxValue = double.MinValue;
            double minValue = double.MaxValue;

            var plotModel = new PlotModel();
            var plots     = Plots.Where(p => p.Selected);


            foreach (var _timePlot in plots)
            {
                var lineSeries = new LineSeries();
                var plotColor  = _timePlot.PointColor;
                lineSeries.Color           = OxyColor.FromArgb(plotColor.A, plotColor.R, plotColor.G, plotColor.B);
                lineSeries.MarkerFill      = OxyColor.FromArgb(plotColor.A, plotColor.R, plotColor.G, plotColor.B);
                lineSeries.MarkerType      = MarkerType.None;
                lineSeries.StrokeThickness = 1;
                lineSeries.DataFieldX      = "Time";
                lineSeries.DataFieldY      = "Value";

                var orderedPoints = _timePlot.PlotPoints
                                    .GroupBy(point => point.Time)
                                    .Select(group => group.First())
                                    .OrderBy(point => point.Time)
                                    .ToList();
                foreach (var _point in orderedPoints)
                {
                    var time  = _point.Time.TimeOfDay.TotalSeconds;
                    var value = Convert.ToDouble(_point.Value);
                    maxTime  = maxTime < time ? time : maxTime;
                    minTime  = time < minTime ? time : minTime;
                    maxValue = maxValue < value ? value : maxValue;
                    minValue = value < minValue ? value : minValue;

                    lineSeries.Points.Add(new DataPoint {
                        X = time, Y = value
                    });
                }
                plotModel.Series.Add(lineSeries);
            }

            var dateTimeAxis = new TimeSpanAxis(AxisPosition.Bottom, minTime, maxTime, "Time");

            dateTimeAxis.SetColors();
            dateTimeAxis.AbsoluteMaximum = maxTime;
            dateTimeAxis.AbsoluteMinimum = minTime;
            plotModel.Axes.Add(dateTimeAxis);

            var linearAxis = new LinearAxis(AxisPosition.Left, minValue, maxValue, "Value");

            linearAxis.SetColors();
            linearAxis.AbsoluteMaximum = maxValue;
            linearAxis.AbsoluteMinimum = minValue;
            plotModel.Axes.Add(linearAxis);

            plotModel.SetColors();
            ReportPlots = plotModel;
        }
        private PlotModel CreateDistanceTraveledModel(Track Track)
        {
            PlotModel PlotModel = new PlotModel
            {
                Title = "Afgelegde weg"
            };

            PlotModel.Axes.Add(new TimeSpanAxis
            {
                Position        = AxisPosition.Bottom,
                Title           = "Tijd (s)",
                AbsoluteMinimum = TimeSpanAxis.ToDouble(new TimeSpan()),
                AbsoluteMaximum = TimeSpanAxis.ToDouble(Track.GetTotalTimeSpan())
            });
            PlotModel.Axes.Add(new LinearAxis
            {
                Position        = AxisPosition.Left,
                Title           = "Afgelegde weg (m)",
                AbsoluteMinimum = 0,
                AbsoluteMaximum = Track.GetTotalRunningDistance()
            });

            PlotModel.Series.Add(new LineSeries
            {
                Title       = "Afgelegde weg",
                ItemsSource = Track.GetDistanceTraveledDataPoints()
            });

            return(PlotModel);
        }
示例#6
0
        public MainViewModel()
        {
            StartTime   = DateTime.Now;
            CurrentTime = StartTime;
            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromMilliseconds(1000);
            timer.Tick    += (sender, args) =>
            {
                if (Finish)
                {
                    return;
                }
                CurrentTime = DateTime.Now;
                var count = CorrectInputKeyboardSymbolModels.Count;
                if (count < 2)
                {
                    return;
                }
                for (int i = count - 1; i >= 0; i--)
                {
                    var span = CorrectInputKeyboardSymbolModels[count - 1].Time - CorrectInputKeyboardSymbolModels[i].Time;
                    if (span.TotalMilliseconds > 5000)
                    {
                        SpeedData.Add(new DataPoint(TimeSpanAxis.ToDouble(CurrentTime - StartTime), (count - 1 - i) / span.TotalMinutes));
                        while (SpeedData.Count > 60)
                        {
                            SpeedData.RemoveAt(0);
                        }
                        break;
                    }
                }
            };
            timer.Start();
        }
示例#7
0
        public void ShowByCandidates(VotingResults votingResults, Func <Vote, bool> filter)
        {
            lock (_plotModel.SyncRoot)
            {
                _xAxis.SetAxisMinMax(TimeSpanAxis.ToDouble(votingResults.StartTime), TimeSpanAxis.ToDouble(votingResults.EndTime));

                _plotModel.Series.Clear();

                var candidates = votingResults.Votes.Where(x => filter(x)).Select(x => x.CandidateId).Distinct();

                int max = 0;
                foreach (var candidate in candidates)
                {
                    LineSeries series = TotalCumulativeVotedByTimeUtils.CreateSeries(votingResults, x => filter(x) && (x.CandidateId == candidate), out int total);
                    if (total > max)
                    {
                        max = total;
                    }
                    series.Title = votingResults.Candidates[candidate].Name;
                    _plotModel.Series.Add(series);
                }
                _yAxis.SetAxisMax(max);
            }
            _plotModel.InvalidatePlot(true);
        }
示例#8
0
        private void CreateBarChart(PlotModel plotModel, Dictionary <DateTime, double> dataList)
        {
            // 각 포인트의 데이터를 model 에 add 합니다.
            // 여기서 PointAnnotation 는 각 포인트에 라벨을 표시하기 위함입니다.
            var Points = new List <DataPoint>();

            //int idx = 0;
            foreach (var i in dataList)
            {
                var pointAnnotation = new PointAnnotation();
                pointAnnotation.X = TimeSpanAxis.ToDouble(i.Key);
                pointAnnotation.Y = i.Value;
                // 실제 데이터 값을 포인트에 add 합니다.
                Points.Add(new DataPoint(TimeSpanAxis.ToDouble(i.Key), i.Value));

                // 해당 포인트에 대한 라벨표시값도 추가합니다.
                //pointAnnotation.TextVerticalAlignment = VerticalAlignment.Top;
                //pointAnnotation.TextHorizontalAlignment = HorizontalAlignment.Center;
                //pointAnnotation.Text = (i.Value).ToString("#.00");
                //plotModel.Annotations.Add(pointAnnotation);
            }

            // Line 차트를 그리기 위한 라인시리즈를 정의합니다.
            var s = new LineSeries();

            //s.LineStyle = LineStyle.Dot;

            // 각 포인트에 동그란 점으로 표시하게 합니다.
            s.MarkerType = MarkerType.Circle;
            // 정의한 포이트 데이터들을 라인시리즈의 소스로 적용합니다.
            s.ItemsSource = Points;
            // 차트에 적용할 model 에 추가합니다.
            plotModel.Series.Add(s);
        }
示例#9
0
        public PlotViewModel(IMainViewModel mainViewModel, IEnumerable <DataPoint> data)
        {
            PlotModel = new PlotModel();
            var series = new LineSeries {
                StrokeThickness = 1,
                MarkerStroke    = OxyColors.Blue,
                Color           = OxyColors.Red,
                ItemsSource     = data
            };

            PlotModel.Series.Add(series);
            PlotModel.Axes.Add(new DateTimeAxis {
                Position        = AxisPosition.Bottom,
                Minimum         = DateTimeAxis.ToDouble(DateTime.UtcNow),
                AbsoluteMinimum = DateTimeAxis.ToDouble(DateTime.UtcNow),
                Maximum         = DateTimeAxis.ToDouble(DateTime.UtcNow.AddMinutes(1)),
                Title           = "Time",
                TimeZone        = TimeZoneInfo.Local,
                MaximumRange    = TimeSpanAxis.ToDouble(TimeSpan.FromMinutes(5)),
                MinimumRange    = TimeSpanAxis.ToDouble(TimeSpan.FromSeconds(10))
            });
            PlotModel.Axes.Add(new LinearAxis {
                Position      = AxisPosition.Left,
                Minimum       = 0,
                Maximum       = 100,
                IsPanEnabled  = false,
                IsZoomEnabled = false
            });
        }
        private void AddPoint(double value, LineSeries serie)
        {
            serie.Points.RemoveAll(point => point.X < TimeSpanAxis.ToDouble(_stopwatch.Elapsed - _visibleTime));
            serie.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(_stopwatch.Elapsed), value));

            _timeAxis.Minimum = TimeSpanAxis.ToDouble(_stopwatch.Elapsed - _visibleTime);
            PlotModel.InvalidatePlot(true);
        }
        public void SupportMillisecondsInFormatStrings(string format, string expected)
        {
            var axis = new TimeSpanAxis {
                StringFormat = format
            };
            var formattedValue = axis.FormatValue(TimeSpanAxis.ToDouble(new System.TimeSpan(1, 1, 1, 2, 345)));

            Assert.That(formattedValue, Is.EqualTo(expected));
        }
        private void CreateBarChart(bool stacked, string title, Dictionary <DateTime, double> dataList)
        {
            // 차트에 바인딩될 데이터 Model 입니다.
            var model = new PlotModel
            {
                Title    = title,
                PlotType = PlotType.XY,
            };

            // x축은 시간이 보이도록 설정합니다.
            model.Axes.Add(new DateTimeAxis
            {
                Title        = "시간",
                Position     = AxisPosition.Bottom,
                StringFormat = "HH:mm:ss"
            });

            // Y 축은 값입니다.
            model.Axes.Add(new LinearAxis
            {
                Title    = "값",
                Position = AxisPosition.Left
            });

            // 각 포인트의 데이터를 model 에 add 합니다.
            // 여기서 PointAnnotation 는 각 포인트에 라벨을 표시하기 위함입니다.
            var Points = new List <DataPoint>();

            //int idx = 0;
            foreach (var i in dataList)
            {
                var pointAnnotation = new PointAnnotation();
                pointAnnotation.X = TimeSpanAxis.ToDouble(i.Key);
                pointAnnotation.Y = i.Value;
                pointAnnotation.TextVerticalAlignment   = VerticalAlignment.Top;
                pointAnnotation.TextHorizontalAlignment = HorizontalAlignment.Center;
                pointAnnotation.Text = (i.Value).ToString("0.00");
                // 실제 데이터 값을 포인트에 add 합니다.
                Points.Add(new DataPoint(TimeSpanAxis.ToDouble(i.Key), i.Value));
                // 해당 포인트에 대한 라벨표시값도 추가합니다.
                model.Annotations.Add(pointAnnotation);
            }

            // Line 차트를 그리기 위한 라인시리즈를 정의합니다.
            var s = new LineSeries();

            // 각 포인트에 동그란 점으로 표시하게 합니다.
            s.MarkerType = MarkerType.Circle;
            // 정의한 포이트 데이터들을 라인시리즈의 소스로 적용합니다.
            s.ItemsSource = Points;
            // 차트에 적용할 model 에 추가합니다.
            model.Series.Add(s);

            // 위에서 정의한 model 을 차트에 적용합니다.
            PlotChart.Model = model;
        }
示例#13
0
        private void LoadDate(object sender, DoWorkEventArgs e)
        {
            var queryDict = SQLServer.MSSelectDataDictionary(@"SELECT 
            SUBSTRING(a.OrderDateTime, 12, 5) as TimeOrdered,
            Count(a.OrderDateTime) as Orders
            FROM(SELECT Max(OrderDateTime) as OrderDateTime FROM whldata.newsales_raw GROUP BY OrderID) as a
                GROUP BY SUBSTRING(a.OrderDateTime, 12, 5)
            Order By SUBSTRING(a.OrderDateTime, 12, 5) asc");

            var plotArea = new PlotModel();

            var listOfPlots
                = new List <DataPoint>();
            var bottomAxis = new TimeSpanAxis
            {
                Position     = AxisPosition.Bottom,
                Title        = "Time",
                StringFormat = "hh:mm"
            };
            var leftAxis = new LinearAxis();

            leftAxis.Position        = AxisPosition.Left;
            leftAxis.Minimum         = 0;
            leftAxis.AbsoluteMinimum = 0;
            leftAxis.Title           = "Sales";
            plotArea.Axes.Add(leftAxis);
            plotArea.Axes.Add(bottomAxis);
            foreach (var result in queryDict)
            {
                var time   = 0.0;
                var orders = 0.0;
                try
                {
                    time   = TimeSpan.Parse(result["TimeOrdered"].ToString()).TotalSeconds;
                    orders = Convert.ToDouble(result["Orders"]);
                }
                catch (FormatException formatEx)
                {
                    Console.WriteLine(formatEx);
                }

                var pointOfData = new DataPoint(time, orders);
                listOfPlots.Add(pointOfData);
            }
            var orderSeries = new LineSeries();

            orderSeries.Points.AddRange(listOfPlots);
            orderSeries.CanTrackerInterpolatePoints = false;
            plotArea.Series.Add(orderSeries);
            PlotGlobal = plotArea;
        }
示例#14
0
 public double XFormat(double value)
 {
     if (_plotType == ShowDataType.PulseHeight ||
         _plotType == ShowDataType.PulseIntegral ||
         _plotType == ShowDataType.SinglesLow ||
         _plotType == ShowDataType.SinglesHigh)
     {
         return(value);
     }
     else
     {
         return(TimeSpanAxis.ToDouble(TimeSpan.FromHours(value)));
     }
 }
 public TransactionPerBlockTimelineModelDrawer()
 {
     _plotModel = new PlotModel();
     _xAxis     = new TimeSpanAxis()
     {
         Position           = AxisPosition.Bottom,
         Key                = XAxisKey,
         MinorGridlineStyle = LineStyle.Dash,
         MajorGridlineStyle = LineStyle.Solid,
         MinorStep          = TimeSpanAxis.ToDouble(TimeSpan.FromHours(1)),
         Title              = "Time"
     };
     _plotModel.Axes.Add(_xAxis);
 }
示例#16
0
        public static PlotModel Default()
        {
            var model = new PlotModel {
                Title = "TimeSpanAxis"
            };

            model.Axes.Add(new TimeSpanAxis {
                Position = AxisPosition.Bottom, Maximum = TimeSpanAxis.ToDouble(TimeSpan.FromMinutes(15))
            });
            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left
            });
            return(model);
        }
示例#17
0
        public void ShowLinearIntepolatedBlockGraphItems(bool setMinTime, BlockGraphItem <TimeSpan>[] array)
        {
            lock (_plotModel.SyncRoot)
            {
                ConfigureAxes(setMinTime, array);

                var series = PrepareSeries();
                for (int i = 0; i < array.Length; i++)
                {
                    series.Points.Add(new DataPoint(array[i].BlockNumber, TimeSpanAxis.ToDouble(array[i].Data)));
                }
            }
            _plotModel.InvalidatePlot(true);
        }
示例#18
0
        public static IEnumerable <LineSeries> SeriesCtor(IEnumerable <TimeTracker> trackers)
        {
            foreach (TimeTracker tracker in trackers)
            {
                LineSeries series = SeriesFromTracker(tracker);
                foreach (KeyValuePair <TimeSpan, int> pair in tracker)
                {
                    series.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(pair.Key), pair.Value));
                }

                yield return(series);
            }
            yield break;
        }
示例#19
0
        public void Show(VotingResults votingResults, Func <Vote, bool> filter)
        {
            lock (_plotModel.SyncRoot)
            {
                _xAxis.SetAxisMinMax(TimeSpanAxis.ToDouble(votingResults.StartTime), TimeSpanAxis.ToDouble(votingResults.EndTime));

                _plotModel.Series.Clear();

                LineSeries series = TotalCumulativeVotedByTimeUtils.CreateSeries(votingResults, filter, out var max);
                series.Title = "Всего проголосовало";
                _yAxis.SetAxisMax(max);
                _plotModel.Series.Add(series);
            }
            _plotModel.InvalidatePlot(true);
        }
示例#20
0
        public void ShowBlockStartTime(VotingResults votingResults)
        {
            lock (_plotModel.SyncRoot)
            {
                var xAxis = _plotModel.Axes.Where(x => x.Key == XAxisKey).Single();
                xAxis.SetMinMaxBlocksToXAxis(votingResults);

                var series = PrepareSeries();

                BlockTimeVisualHelper.LoadBlockTimesToSeries(votingResults, null, series);
                var yAxis = _plotModel.Axes.Where(x => x.Key == "y_axis").Single();
                yAxis.SetAxisMax(TimeSpanAxis.ToDouble(votingResults.Votes.Select(x => x.Time).Max()));
            }
            _plotModel.InvalidatePlot(true);
        }
示例#21
0
        private PlotModel CreateSpeedModel(Track Track)
        {
            PlotModel PlotModel = new PlotModel
            {
                Title = "Snelheid"
            };

            PlotModel.Axes.Add(new TimeSpanAxis
            {
                Position        = AxisPosition.Bottom,
                Title           = "Tijd (s)",
                AbsoluteMinimum = TimeSpanAxis.ToDouble(new TimeSpan()),
                AbsoluteMaximum = TimeSpanAxis.ToDouble(Track.GetTotalTimeSpan())
            });
            PlotModel.Axes.Add(new LinearAxis
            {
                Position        = AxisPosition.Left,
                Title           = "Snelheid (m/s)",
                AbsoluteMinimum = 0,
                AbsoluteMaximum = Track.GetMaxSpeed()
            });

            PlotModel.Series.Add(new LineSeries
            {
                Title       = "Snelheid",
                ItemsSource = Track.GetSpeedDataPoints(),
            });

            int i = 1;

            foreach (List <DataPoint> ldp in Track.GetSegmentAvarageSpeedDataPoints())
            {
                PlotModel.Series.Add(new LineSeries
                {
                    Title       = $"Gemiddelde snelheid in segment {i}",
                    ItemsSource = ldp
                });
                i++;
            }

            PlotModel.Series.Add(new LineSeries
            {
                Title       = "Gemiddelde snelheid",
                ItemsSource = Track.GetAvergageSpeedDataPoints()
            });

            return(PlotModel);
        }
示例#22
0
        public static PlotModel TimeSpanaxisPlotModel()
        {
            var    start     = new TimeSpan(0, 0, 0, 0);
            var    end       = new TimeSpan(0, 24, 0, 0);
            double increment = 3600;

            // Create a random data collection
            var r       = new Random(7);
            var data    = new Collection <TimeValue>();
            var current = start;

            while (current <= end)
            {
                data.Add(new TimeValue {
                    Time = current, Value = r.NextDouble()
                });
                current = current.Add(new TimeSpan(0, 0, (int)increment));
            }

            var plotModel1 = new PlotModel {
                Title = "TimeSpan axis"
            };
            var timeSpanAxis1 = new TimeSpanAxis {
                Position = AxisPosition.Bottom, StringFormat = "h:mm"
            };

            plotModel1.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis {
                Position = AxisPosition.Left
            };

            plotModel1.Axes.Add(linearAxis1);
            var lineSeries1 = new LineSeries
            {
                Color           = OxyColor.FromArgb(255, 78, 154, 6),
                MarkerFill      = OxyColor.FromArgb(255, 78, 154, 6),
                MarkerStroke    = OxyColors.ForestGreen,
                MarkerType      = MarkerType.Plus,
                StrokeThickness = 1,
                DataFieldX      = "Time",
                DataFieldY      = "Value",
                ItemsSource     = data
            };

            plotModel1.Series.Add(lineSeries1);
            return(plotModel1);
        }
示例#23
0
 public TotalCumulativeVotedByTime()
 {
     _plotModel = new PlotModel();
     _xAxis     = new TimeSpanAxis()
     {
         Position = AxisPosition.Bottom,
         Key      = "x_axis"
     };
     _plotModel.Axes.Add(_xAxis);
     _yAxis = new LinearAxis()
     {
         Position        = AxisPosition.Left,
         Key             = "y_axis",
         AbsoluteMinimum = 0,
     };
     _plotModel.Axes.Add(_yAxis);
 }
示例#24
0
        private void SetUpGraphOfCorrelated()
        {
            plotModelCurrentCorrelation = new PlotModel();
            plotModelCurrentCorrelation.TitleFontSize = 11;
            TimeSpanAxis timeAxis = new TimeSpanAxis()
            {
                MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Position = AxisPosition.Bottom, TitleFontSize = 10, IsZoomEnabled = false
            };

            plotModelCurrentCorrelation.Axes.Add(timeAxis);
            LinearAxis valueAxis = new LinearAxis()
            {
                MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Position = AxisPosition.Left, IsZoomEnabled = false
            };

            plotModelCurrentCorrelation.Axes.Add(valueAxis);
        }
示例#25
0
        public void AddCustomData(string title, IEnumerable <TimeGraphItem <int> > data)
        {
            lock (_plotModel.SyncRoot)
            {
                LineSeries series = new LineSeries()
                {
                    CanTrackerInterpolatePoints = false,
                    Title = title
                };

                foreach (var item in data)
                {
                    series.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(item.Time), item.Data));
                }

                _plotModel.Series.Add(series);
            }
            _plotModel.InvalidatePlot(true);
        }
示例#26
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var plotModel     = new OxyPlot.PlotModel();
            var timeSpanAxis1 = new TimeSpanAxis();

            timeSpanAxis1.Title    = "Time";
            timeSpanAxis1.Position = AxisPosition.Bottom;
            plotModel.Axes.Add(timeSpanAxis1);
            var timeSpanAxis2 = new MsecTimeSpanAxis();

            timeSpanAxis2.Title              = "Offset";
            timeSpanAxis2.StringFormat       = "m:ss:msec";
            timeSpanAxis2.MajorGridlineStyle = LineStyle.Automatic;
            timeSpanAxis2.MinorGridlineStyle = LineStyle.Automatic;
            plotModel.Axes.Add(timeSpanAxis2);
            FillGraph(plotModel);
            plotModel.IsLegendVisible = false;
            plotter.Model             = plotModel;
        }
示例#27
0
        public static PlotModel SunriseandsunsetinOslo()
        {
            int year = DateTime.Now.Year;

#if SILVERLIGHT || PCL
            var sunData = CreateSunData(year, 59.91, 10.75);
#else
            var sunData = CreateSunData(year, 59.91, 10.75, TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"));
#endif
            var plotModel1 = new PlotModel();
            plotModel1.Title = "Sunrise and sunset in Oslo";

#if SILVERLIGHT
            plotModel1.Subtitle = "UTC time";
#endif

            var dateTimeAxis1 = new DateTimeAxis
            {
                CalendarWeekRule   = CalendarWeekRule.FirstFourDayWeek,
                FirstDayOfWeek     = DayOfWeek.Monday,
                IntervalType       = DateTimeIntervalType.Months,
                MajorGridlineStyle = LineStyle.Solid,
                Position           = AxisPosition.Bottom,
                StringFormat       = "MMM"
            };
            plotModel1.Axes.Add(dateTimeAxis1);
            var timeSpanAxis1 = new TimeSpanAxis {
                MajorGridlineStyle = LineStyle.Solid, Maximum = 86400, Minimum = 0, StringFormat = "h:mm"
            };
            plotModel1.Axes.Add(timeSpanAxis1);
            var areaSeries1 = new AreaSeries
            {
                ItemsSource = sunData,
                DataFieldX  = "Day",
                DataFieldY  = "Sunrise",
                DataFieldX2 = "Day",
                DataFieldY2 = "Sunset",
                Fill        = OxyColor.FromArgb(128, 255, 255, 0),
                Color       = OxyColors.Black
            };
            plotModel1.Series.Add(areaSeries1);
            return(plotModel1);
        }
示例#28
0
        public static PlotModel SunriseandsunsetinOslo()
        {
            int year = DateTime.Now.Year;

            // Convert UTC time to Western European Time (WET)
            Func <DateTime, DateTime> utcToLocalTime = utc => utc.AddHours(IsDaylightSaving(utc) ? 2 : 1);

            var sunData = CreateSunData(year, 59.91, 10.75, utcToLocalTime);

            var plotModel1 = new PlotModel {
                Title = "Sunrise and sunset in Oslo", Subtitle = "UTC time"
            };

            var dateTimeAxis1 = new DateTimeAxis
            {
                CalendarWeekRule   = CalendarWeekRule.FirstFourDayWeek,
                FirstDayOfWeek     = DayOfWeek.Monday,
                IntervalType       = DateTimeIntervalType.Months,
                MajorGridlineStyle = LineStyle.Solid,
                Position           = AxisPosition.Bottom,
                StringFormat       = "MMM"
            };

            plotModel1.Axes.Add(dateTimeAxis1);
            var timeSpanAxis1 = new TimeSpanAxis {
                MajorGridlineStyle = LineStyle.Solid, Maximum = 86400, Minimum = 0, StringFormat = "h:mm"
            };

            plotModel1.Axes.Add(timeSpanAxis1);
            var areaSeries1 = new AreaSeries
            {
                ItemsSource = sunData,
                DataFieldX  = "Day",
                DataFieldY  = "Sunrise",
                DataFieldX2 = "Day",
                DataFieldY2 = "Sunset",
                Fill        = OxyColor.FromArgb(128, 255, 255, 0),
                Color       = OxyColors.Black
            };

            plotModel1.Series.Add(areaSeries1);
            return(plotModel1);
        }
示例#29
0
        public static void DrawAnomalyZones(this IPlotModelDrawer @this, IEnumerable <AnomalyZoneDefinition> anomalyZones)
        {
            OxyColor[] anomalyZoneColors = new OxyColor[]
            {
                // каждый охотник желает знать где сидит фазан
                OxyColor.FromAColor(100, OxyColors.Red),
                OxyColor.FromAColor(100, OxyColors.Orange),
                OxyColor.FromAColor(100, OxyColors.Yellow),
                OxyColor.FromAColor(100, OxyColors.Violet)
            };
            int counter = 0;

            lock (@this.PlotModel.SyncRoot)
            {
                foreach (var anomalyZone in anomalyZones)
                {
                    var color = anomalyZoneColors[counter % anomalyZoneColors.Length];

                    var timeAxisKey = @this.GetTimeAxisKey();
                    if (timeAxisKey != null)
                    {
                        double start    = TimeSpanAxis.ToDouble(anomalyZone.StartTime);
                        double end      = TimeSpanAxis.ToDouble(anomalyZone.EndTime);
                        var    timeAxis = @this.PlotModel.GetAxis(timeAxisKey);

                        var annotation = CreateAnomalyZoneForAxis(timeAxis, start, end, anomalyZone.Name);
                        annotation.Fill = color;
                        @this.PlotModel.Annotations.Add(annotation);
                    }
                    var blockNumberAxisKey = @this.GetBlockNumberAxisKey();
                    if (blockNumberAxisKey != null)
                    {
                        var blockNumberAxis = @this.PlotModel.GetAxis(blockNumberAxisKey);
                        var annotation      = CreateAnomalyZoneForAxis(blockNumberAxis, anomalyZone.StartBlock, anomalyZone.EndBlock, anomalyZone.Name);
                        annotation.Fill = color;
                        @this.PlotModel.Annotations.Add(annotation);
                    }
                    counter++;
                }
            }
            @this.PlotModel.InvalidatePlot(false);
        }
示例#30
0
        public void TimeSpanAxis()
        {
            if (XAxis != null)
            {
                Axes.Remove(XAxis);
            }

            XAxis = new TimeSpanAxis
            {
                Position           = AxisPosition.Bottom,
                IsZoomEnabled      = true,
                IsPanEnabled       = true,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Solid,
                MajorGridlineColor = OxyColor.FromAColor(40, OxyColors.DarkBlue),
                MinorGridlineColor = OxyColor.FromAColor(20, OxyColors.DarkBlue),
                AxislineStyle      = LineStyle.Solid
            };
            Axes.Add(XAxis);
        }
示例#31
0
        public void Show(RemoteVotingStatistics statistics)
        {
            lock (_plotModel.SyncRoot)
            {
                _plotModel.Series.Clear();

                var series1 = new LineSeries()
                {
                    CanTrackerInterpolatePoints = false,
                    Title = "Перешло на страницу голосования"
                };
                var series2 = new LineSeries()
                {
                    CanTrackerInterpolatePoints = false,
                    Title = "Правильно ввели регистрационную СМС"
                };
                var series3 = new LineSeries()
                {
                    CanTrackerInterpolatePoints = false,
                    Title = "Выдано бюллететеней"
                };
                var series4 = new LineSeries()
                {
                    CanTrackerInterpolatePoints = false,
                    Title = "Проголосовало"
                };
                _plotModel.Series.Add(series1);
                _plotModel.Series.Add(series2);
                _plotModel.Series.Add(series3);
                _plotModel.Series.Add(series4);
                foreach (var item in statistics.Statistics)
                {
                    series1.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(item.Time), item.ComeToRegistrationPage));
                    series2.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(item.Time), item.ValidatedBySms));
                    series3.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(item.Time), item.Registered));
                    series4.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(item.Time), item.Voted));
                }
                _xAxis.SetAxisMinMax(statistics.StartTime, statistics.EndTime);
            }
            _plotModel.InvalidatePlot(true);
        }
示例#32
0
 public void TimeSpanAxis()
 {
     var s1 = new OxyPlot.Axes.TimeSpanAxis();
     var s2 = new TimeSpanAxis();
     OxyAssert.PropertiesAreEqual(s1, s2);
 }
示例#33
0
 public void SupportMillisecondsInFormatStrings(string format, string expected)
 {
     var axis = new TimeSpanAxis { StringFormat = format };
     var formattedValue = axis.FormatValue(TimeSpanAxis.ToDouble(new System.TimeSpan(1, 1, 1, 2, 345)));
     Assert.That(formattedValue, Is.EqualTo(expected));
 }
        public static PlotModel MinuteData_TimeSpan()
        {
            var pm = new PlotModel { Title = "Minute Data (TimeSpanAxis)" };

            var timeSpanAxis1 = new TimeSpanAxis { Position = AxisPosition.Bottom, StringFormat = "hh:mm" };
            pm.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis { Position = AxisPosition.Left };
            pm.Axes.Add(linearAxis1);
            var candleStickSeries = new OldCandleStickSeries
            {
                CandleWidth = 5,
                Color = OxyColors.DarkGray,
                IncreasingFill = OxyColors.DarkGreen,
                DecreasingFill = OxyColors.Red,
                DataFieldX = "QTime",
                DataFieldHigh = "H",
                DataFieldLow = "L",
                DataFieldOpen = "O",
                DataFieldClose = "C",
                TrackerFormatString = "High: {2:0.00}\nLow: {3:0.00}\nOpen: {4:0.00}\nClose: {5:0.00}",
                ItemsSource = lst
            };
            pm.Series.Add(candleStickSeries);
            return pm;
        }
        public static PlotModel SunriseandsunsetinOslo()
        {
            int year = DateTime.Now.Year;
#if PCL
            var sunData = CreateSunData(year, 59.91, 10.75);
#else
            var sunData = CreateSunData(year, 59.91, 10.75, TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"));
#endif
            var plotModel1 = new PlotModel("Sunrise and sunset in Oslo", "UTC time");

            var dateTimeAxis1 = new DateTimeAxis
                {
                    CalendarWeekRule = CalendarWeekRule.FirstFourDayWeek,
                    FirstDayOfWeek = DayOfWeek.Monday,
                    IntervalType = DateTimeIntervalType.Months,
                    MajorGridlineStyle = LineStyle.Solid,
                    Position = AxisPosition.Bottom,
                    StringFormat = "MMM"
                };
            plotModel1.Axes.Add(dateTimeAxis1);
            var timeSpanAxis1 = new TimeSpanAxis { MajorGridlineStyle = LineStyle.Solid, Maximum = 86400, Minimum = 0, StringFormat = "h:mm" };
            plotModel1.Axes.Add(timeSpanAxis1);
            var areaSeries1 = new AreaSeries
                {
                    ItemsSource = sunData,
                    DataFieldX = "Day",
                    DataFieldY = "Sunrise",
                    DataFieldX2 = "Day",
                    DataFieldY2 = "Sunset",
                    Fill = OxyColor.FromArgb(128, 255, 255, 0),
                    Color = OxyColors.Black
                };
            plotModel1.Series.Add(areaSeries1);
            return plotModel1;
        }
示例#36
0
        public static PlotModel SunriseandsunsetinOslo()
        {
            int year = DateTime.Now.Year;

            // Convert UTC time to Western European Time (WET)
            Func<DateTime, DateTime> utcToLocalTime = utc => utc.AddHours(IsDaylightSaving(utc) ? 2 : 1);

            var sunData = CreateSunData(year, 59.91, 10.75, utcToLocalTime);

            var plotModel1 = new PlotModel { Title = "Sunrise and sunset in Oslo", Subtitle = "UTC time" };

            var dateTimeAxis1 = new DateTimeAxis
                {
                    CalendarWeekRule = CalendarWeekRule.FirstFourDayWeek,
                    FirstDayOfWeek = DayOfWeek.Monday,
                    IntervalType = DateTimeIntervalType.Months,
                    MajorGridlineStyle = LineStyle.Solid,
                    Position = AxisPosition.Bottom,
                    StringFormat = "MMM"
                };
            plotModel1.Axes.Add(dateTimeAxis1);
            var timeSpanAxis1 = new TimeSpanAxis { MajorGridlineStyle = LineStyle.Solid, Maximum = 86400, Minimum = 0, StringFormat = "h:mm" };
            plotModel1.Axes.Add(timeSpanAxis1);
            var areaSeries1 = new AreaSeries
                {
                    ItemsSource = sunData,
                    DataFieldX = "Day",
                    DataFieldY = "Sunrise",
                    DataFieldX2 = "Day",
                    DataFieldY2 = "Sunset",
                    Fill = OxyColor.FromArgb(128, 255, 255, 0),
                    Color = OxyColors.Black
                };
            plotModel1.Series.Add(areaSeries1);
            return plotModel1;
        }