|
- using BPASmartClient.Academy._50L;
- using BPASmartClient.Academy.Model;
- using LiveCharts;
- using LiveCharts.Configurations;
- using LiveCharts.Wpf;
- using OxyPlot.Axes;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.Academy.ViewModel
- {
- public class DeviceChart50LViewModel : NotifyBase
- {
- private volatile static DeviceChart50LViewModel _Instance;
- public static DeviceChart50LViewModel GetInstance => _Instance ?? (_Instance = new DeviceChart50LViewModel());
- private DeviceChart50LViewModel()
- {
- DataFeedback = new DataFeedBack_50();
- var mapper = Mappers.Xy<DataValue>()
- .X(model => model.DateTime.Ticks)
- .Y(model => model.Value);
- Charting.For<DataValue>(mapper);
- DataFeedback = SqliteOperate.GetInstance.DataFeedBacks;
- }
-
-
- private DataFeedBack_50 dataFeedback;
- public DataFeedBack_50 DataFeedback { get { return dataFeedback; } set { dataFeedback = value; OnPropertyChanged(); } }
- public Func<double, string> DateTimeFormatter { get; set; } = value => value > 0 ? new DateTime((long)value).ToString("HH:mm:ss") : new DateTime((long)DateTime.Now.Ticks).ToString("HH:mm:ss");
-
- public Func<double, string> doubleFormatter { get; set; } = value => value.ToString("F2");
-
-
-
- public double AxisStep { get; set; } = TimeSpan.FromSeconds(2).Ticks;
- public double AxisUnit { get; set; } = TimeSpan.TicksPerSecond;
- }
- }
|