예제 #1
0
        public static void TestEmptyDataCharts()
        {
            // the PlotView is a WPF control that's created in the .xaml code
            OxyPlot.Wpf.PlotView examplePlotView = new OxyPlot.Wpf.PlotView();

            List <Datum> data = new List <Datum>();

            Plot plot = new ScatterPlot(examplePlotView, data);

            Assert.That(plot.Model.Series.Count == 0);

            plot = new LinePlot(examplePlotView, data);
            Assert.That(plot.Model.Series.Count == 0);

            plot = new BarPlot(examplePlotView, data);
            Assert.That(plot.Model.Series.Count == 0);

            plot = new HistogramPlot(examplePlotView, data, 10);
            Assert.That(plot.Model.Series.Count == 0);

            plot = new SpectrumPlot(examplePlotView, data);
            Assert.That(plot.Model.Series.Count == 0);
        }
예제 #2
0
        public static void TestSpectrumPlot()
        {
            // the PlotView is a WPF control that's created in the .xaml code
            OxyPlot.Wpf.PlotView examplePlotView = new OxyPlot.Wpf.PlotView();

            // just some example data to plot
            var datapoint1 = new Datum(0, 1);
            var datapoint2 = new Datum(2, 3);

            // create the plot
            Plot plot = new SpectrumPlot(examplePlotView, new List <Datum> {
                datapoint1, datapoint2
            }, lineColor: OxyColors.Blue);

            // check to make sure the data was plotted
            Assert.That(plot.Model.Series.Count == 2);
            var series = plot.Model.Series[0];

            var points = ((LineSeries)series).Points;

            Assert.That(points.Count == 2);
            Assert.That(points[0].X == 0);
            Assert.That(points[0].Y == 0);
            Assert.That(points[1].X == 0);
            Assert.That(points[1].Y == 1);

            series = plot.Model.Series[1];
            points = ((LineSeries)series).Points;
            Assert.That(points.Count == 2);
            Assert.That(points[0].X == 2);
            Assert.That(points[0].Y == 0);
            Assert.That(points[1].X == 2);
            Assert.That(points[1].Y == 3);

            Assert.That(((LineSeries)series).ActualColor == OxyColors.Blue);
        }