Exemplo n.º 1
0
 public ChartVM()
 {
     this.DisplayName = "Chart";
     _ChartSeries = new ChartSeries("Readings");
     LoadReadings();
     _RollingSeries = new RollingSeries(_ChartSeries, 1000, 60);
     _Series.Add(_RollingSeries.Rolled);
     MainVM.Instance.MainModel.Log.CollectionChanged += Log_CollectionChanged;
 }
 public void AddLiveDataTest1()
 {
     ChartSeries source = CreateSeries(0);
     int max = 10;
     int step = 4;
     RollingSeries target = new RollingSeries(source, max, step);
     source.AddPoint(42, 9);
     Assert.AreEqual(1, target.Rolled.Points.Count);
     Assert.AreEqual(42, target.Rolled.Points[0].Key);
 }
 public void AddLiveDataTest2()
 {
     ChartSeries source = CreateSeries(0);
     int max = 10;
     int step = 4;
     RollingSeries target = new RollingSeries(source, max, step);
     source.Points.SuspendCollectionChangeNotification();
     for (int i = 0; i < 5; i++)
     {
         source.AddPoint(i, i);
     }
     source.Points.NotifyChanges();
     Assert.AreEqual(5, target.Rolled.Points.Count);
     Assert.AreEqual(2, target.Rolled.Points[2].Key);
 }
 public void RollingSeriesConstructorTest3()
 {
     ChartSeries source = CreateSeries(5);
     int max = 10;
     int step = 4;
     RollingSeries target = new RollingSeries(source, max, step);
     Assert.AreEqual(5, target.Rolled.Points.Count);
     Assert.AreEqual(0, target.Rolled.Points[0].Key);
     Assert.AreEqual(4, target.Rolled.Points[4].Key);
 }
 public void EventsTest1()
 {
     ChartSeries source = CreateSeries(0);
     int max = 10;
     int step = 4;
     RollingSeries target = new RollingSeries(source, max, step);
     bool _IsCalled = false;
     target.Rolled.Points.CollectionChanged+=new System.Collections.Specialized.NotifyCollectionChangedEventHandler((object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)=>_IsCalled=true);
     source.AddPoint(42, 9);
     Assert.IsTrue(_IsCalled);
 }