终端一体化运控平台
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

39 righe
1.3 KiB

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