public RoomLineGraphInfo(ActiveDevice device, bool startTimer = true) : base(device) { GraphLineModel = ViewResolvingPlotModel.CreateDefault(); Setting = device.DeviceSetting; if (startTimer) { _timer = new Timer(_timer_Tick, null, new TimeSpan(0, 10, 0), new TimeSpan(0, 10, 0)); } }
public MultiRoomLineGraphInfo(ActiveDevice device, bool startTimer = true) : base(device) { GraphLineModelForDefault = ViewResolvingPlotModel.CreateDefault(); GraphLineModelForMiddle = ViewResolvingPlotModel.CreateDefault(); GraphLineModelForProcessForNord = ViewResolvingPlotModel.CreateDefault(); GraphLineModelForProcess = ViewResolvingPlotModel.CreateDefault(); if (startTimer) { _timer = new Timer(_timer_Tick, null, new TimeSpan(0, 10, 0), new TimeSpan(0, 10, 0)); } }
public static ViewResolvingPlotModel CreateDefault(double min = 0, double max = 70) { var model = new ViewResolvingPlotModel(); SetUpModel(model, min, max); var lineSeries = CreateLineSeries(); model.Series.Add(lineSeries.First()); model.Series.Add(lineSeries.Last()); return(model); }
private static void SetUpModel(ViewResolvingPlotModel model, double min, double max) { model.IsLegendVisible = false; model.LegendTitle = "Данные"; model.LegendOrientation = LegendOrientation.Horizontal; model.LegendPlacement = LegendPlacement.Outside; model.LegendPosition = LegendPosition.TopRight; model.LegendBackground = OxyColor.FromAColor(200, OxyColors.White); model.LegendBorder = OxyColors.Black; var dt = DateTime.Now; var dateAxis = new DateTimeAxis() { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, IntervalLength = 200, Position = AxisPosition.Bottom, Title = "Время", MajorStep = 1.0 / 24, StringFormat = "HH:mm", Minimum = DateTimeAxis.ToDouble(dt), Maximum = DateTimeAxis.ToDouble(dt.AddHours(6)), IntervalType = DateTimeIntervalType.Hours, }; model.Axes.Add(dateAxis); var valueAxis = new LinearAxis() { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Title = "Значение", Position = AxisPosition.Left, MinorStep = 0.5, MajorStep = 0.2, MinimumMinorStep = 0.5, MinimumMajorStep = 3, IntervalLength = 100, AbsoluteMaximum = max, AbsoluteMinimum = min, }; model.Axes.Add(valueAxis); }