终端一体化运控平台
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.
 
 
 

39 line
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. }