终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 rivejä
1.5 KiB

  1. using BPASmartClient.Academy._50L;
  2. using BPASmartClient.Academy.Model;
  3. using LiveCharts;
  4. using LiveCharts.Configurations;
  5. using LiveCharts.Wpf;
  6. using OxyPlot.Axes;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace BPASmartClient.Academy.ViewModel
  13. {
  14. public class DeviceChart50LViewModel : NotifyBase
  15. {
  16. private volatile static DeviceChart50LViewModel _Instance;
  17. public static DeviceChart50LViewModel GetInstance => _Instance ?? (_Instance = new DeviceChart50LViewModel());
  18. private DeviceChart50LViewModel()
  19. {
  20. DataFeedback = new DataFeedBack_50();
  21. var mapper = Mappers.Xy<DataValue>()
  22. .X(model => model.DateTime.Ticks)
  23. .Y(model => model.Value);
  24. Charting.For<DataValue>(mapper);
  25. DataFeedback = SqliteOperate.GetInstance.DataFeedBacks;
  26. }
  27. private DataFeedBack_50 dataFeedback;
  28. public DataFeedBack_50 DataFeedback { get { return dataFeedback; } set { dataFeedback = value; OnPropertyChanged(); } }
  29. 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");
  30. public Func<double, string> doubleFormatter { get; set; } = value => value.ToString("F2");
  31. public double AxisStep { get; set; } = TimeSpan.FromSeconds(2).Ticks;
  32. public double AxisUnit { get; set; } = TimeSpan.TicksPerSecond;
  33. }
  34. }