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 DeviceChartViewModel : NotifyBase { public DeviceChartViewModel() { DataFeedback = new DataFeedback(); var mapper = Mappers.Xy() .X(model => model.DateTime.Ticks) .Y(model => model.Value); Charting.For(mapper); DataFeedback = Simens_PLC.GetInstance.dataFeedback; } private DataFeedback dataFeedback; public DataFeedback DataFeedback { get { return dataFeedback; } set { dataFeedback = value; OnPropertyChanged(); } } public Func 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 doubleFormatter { get; set; } = value => value.ToString("F2"); public double AxisStep { get; set; } = TimeSpan.FromSeconds(2).Ticks; public double AxisUnit { get; set; } = TimeSpan.TicksPerSecond; } }