Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. public class Plotter
  2. {
  3. private PlotModel model;
  4. private DateTime startDate = DateTime.Now.AddDays(-10);
  5. private DateTime endDate = DateTime.Now;
  6.  
  7. private readonly List<OxyColor> colors = new List<OxyColor>
  8. {
  9. OxyColors.Green,
  10. OxyColors.IndianRed,
  11. OxyColors.Coral,
  12. OxyColors.Chartreuse,
  13. OxyColors.Azure
  14. };
  15.  
  16. private readonly List<MarkerType> markerTypes = new List<MarkerType>
  17. {
  18. MarkerType.Plus,
  19. MarkerType.Star,
  20. MarkerType.Diamond,
  21. MarkerType.Triangle,
  22. MarkerType.Cross
  23. };
  24.  
  25.  
  26.  
  27. public Plotter()
  28. {
  29. model = new PlotModel { Title = "DateTimeAxis" };
  30. }
  31.  
  32.  
  33. public PlotModel PrintChart()
  34. {
  35. var minValue = DateTimeAxis.ToDouble(startDate);
  36. var maxValue = DateTimeAxis.ToDouble(endDate);
  37. model.Axes.Add(new DateTimeAxis { Position = AxisPosition.Bottom, Minimum = minValue, Maximum = maxValue, StringFormat = "HH:mm" });
  38. return model;
  39. }
  40.  
  41. public void PrintChart()
  42. {
  43. Plotter pt = new Plotter();
  44. frGraph.Model = pt.PrintChart();
  45. }
  46.  
  47. private void startDrawing_Click(object sender, EventArgs e)
  48. {
  49. PrintChart();
  50. }
  51.  
  52. private void InitializeTimerForChart()
  53. {
  54. tickCount.Interval = References.TIMER_INTERVAL; // (1000 мс)
  55. this.tickCount.Tick += new System.EventHandler(this.tickCount_Tick);
  56. tickCount.Enabled = true;
  57. }
  58. private void tickCount_Tick(object sender, EventArgs e)
  59. {
  60. if (InvokeRequired)
  61. {
  62. Invoke((MethodInvoker)delegate ()
  63. {
  64. frGraph.Invalidate();//PrintChart();
  65. });
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement