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

            // create the plot
            Plot plot = new ScatterPlot(examplePlotView, new List <Datum> {
                new Datum(0, 1), new Datum(2, 3)
            });

            string exportPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "testPdfExport.pdf");

            plot.ExportToPdf(exportPath);
            Assert.That(File.Exists(exportPath));

            File.Delete(exportPath);
        }
예제 #2
0
        public static void TestTextAnnotation()
        {
            // the PlotView is a WPF control that's created in the .xaml code
            OxyPlot.Wpf.PlotView examplePlotView = new OxyPlot.Wpf.PlotView();

            // create the plot
            Plot plot = new ScatterPlot(examplePlotView, new List <Datum> {
                new Datum(0, 1), new Datum(2, 3)
            });

            plot.AddTextAnnotationToPlotArea("PEPTIDESEQUENCE", 100, -10, OxyColors.Blue);

            Assert.That(plot.Model.Annotations.Count == 1);
            Assert.That(((PlotTextAnnotation)plot.Model.Annotations[0]).Text == "PEPTIDESEQUENCE");
            Assert.That(((PlotTextAnnotation)plot.Model.Annotations[0]).TextColor == OxyColors.Blue);

            string exportPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "testTextAnnotatedPdfExport.pdf");

            plot.ExportToPdf(exportPath);
            Assert.That(File.Exists(exportPath));

            File.Delete(exportPath);
        }