Exemplo n.º 1
0
 private void LoadReadings()
 {
     foreach (var item in MainVM.Instance.MainModel.Log)
     {
         _ChartSeries.AddPoint(count++, item.Temperature);
     }
 }
Exemplo n.º 2
0
        public void LineChartControlSeriesTest4()
        {
            LineChartControl target = new LineChartControl();
            ObservableCollection <ChartSeries> coll = new ObservableCollection <ChartSeries>();
            ChartSeries cs = new ChartSeries("La Palma");

            coll.Add(cs);
            cs.AddPoint(0.644, 2);
            cs.AddPoint(2, 4);
            cs.AddPoint(5, 10);
            cs.AddPoint(20, 42);
            target.Series = coll;
            Assert.AreEqual(4, target.Chart.Series["La Palma"].Points.Count);
            Assert.AreEqual(0.644, target.Chart.Series["La Palma"].Points[0].XValue);
            Assert.AreEqual(42, target.Chart.Series["La Palma"].Points[3].YValues[0]);
            target.Dispose();
        }
Exemplo n.º 3
0
        public void LineChartControlSeriesTest5()
        {
            LineChartControl target = new LineChartControl();
            ObservableCollection <ChartSeries> coll = new ObservableCollection <ChartSeries>();
            ChartSeries cs = new ChartSeries("La Palma");

            cs.AddPoint(555, 888);
            coll.Add(cs);
            cs = new ChartSeries("Lanzarote");
            cs.AddPoint(18, 4);
            cs.AddPoint(19, 3);
            coll.Add(cs);
            target.Series = coll;
            Assert.AreEqual(1, target.Chart.Series["La Palma"].Points.Count);
            Assert.AreEqual(2, target.Chart.Series["Lanzarote"].Points.Count);
            Assert.AreEqual(555, target.Chart.Series["La Palma"].Points[0].XValue);
            Assert.AreEqual(18, target.Chart.Series["Lanzarote"].Points[0].XValue);
            target.Dispose();
        }
Exemplo n.º 4
0
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        ChartSeries CreateSeries(int count)
        {
            ChartSeries series = new ChartSeries("Test");

            for (int i = 0; i < count; i++)
            {
                series.AddPoint(i, i);
            }
            return(series);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        public void AddLiveDataTest3()
        {
            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 < max; i++)
            {
                source.AddPoint(i, i);
            }
            source.Points.NotifyChanges();
            Assert.AreEqual(6, target.Rolled.Points.Count);
            Assert.AreEqual(4, target.Rolled.Points[0].Key);
        }
Exemplo n.º 8
0
        public void LineChartControlBindingTest7()
        {
            LineChartControl target = new LineChartControl();
            ObservableCollection <ChartSeries> coll = new ObservableCollection <ChartSeries>();

            target.Series = coll;
            ChartSeries cs = new ChartSeries("Benidorm");

            coll.Add(cs);
            for (int i = 0; i < 100; i++)
            {
                cs.AddPoint(i, i * 2);
            }
            Assert.AreEqual(100, target.Chart.Series["Benidorm"].Points.Count);
            cs.Points.Clear();
            Assert.AreEqual(0, target.Chart.Series["Benidorm"].Points.Count);
            target.Dispose();
        }