protected override void Context()
        {
            base.Context();

            _pdfFileName = "ScatterPlots";
            _settings.DeleteWorkingDir = true;
            _settings.SaveArtifacts    = true;
            _figureCounter             = 0;

            var colors = new List <Color> {
                Color.Blue, Color.Red
            };

            _objectsToReport.Add(new Chapter("Scatter Plots"));

            var axisOptions = getAxisOptions();

            var plotOptions1 = getPlotOptions(Color.Blue.Name);
            var plotOptions2 = getPlotOptions(Color.Red.Name);

            var coordinatesMale = new List <Coordinate>
            {
                new Coordinate(0F, 5F),
                new Coordinate(2F, 15F),
                new Coordinate(4F, 8F),
                new Coordinate(7F, 4F),
                new Coordinate(12F, 24F)
            };
            var coordinatesFemale = new List <Coordinate>
            {
                new Coordinate(0F, 10F),
                new Coordinate(2F, 12F),
                new Coordinate(0F, 11F),
                new Coordinate(3F, 9F),
                new Coordinate(6F, 8F),
                new Coordinate(7F, 7F),
                new Coordinate(14F, 27F)
            };
            var boxplot1 = new Plot(coordinatesMale, plotOptions1)
            {
                LegendEntry = "Male"
            };
            var boxplot2 = new Plot(coordinatesFemale, plotOptions2)
            {
                LegendEntry = "Female"
            };
            var plotItem = new TeXReporting.Items.Plot(colors,
                                                       axisOptions,
                                                       new List <Plot> {
                boxplot1, boxplot2
            },
                                                       new Text("Test Figure"));

            _objectsToReport.Add(new Section("Simple Scatter Plot"));
            _objectsToReport.Add(plotItem);
            _figureCounter++;
        }
示例#2
0
        protected override void Context()
        {
            base.Context();

            _pdfFileName = "BoxPlots";
            _settings.DeleteWorkingDir = true;
            _settings.SaveArtifacts    = true;
            _figureCounter             = 0;

            var colors = new List <Color> {
                Color.Blue, Color.Red
            };

            _objectsToReport.Add(new Chapter("Box Plots"));

            var axisOptions = getAxisOptions();

            var plotOptions1 = getBoxWhiskerPlotOptions(15F, 20F, 25F, 30F, 35F, 1F, Color.Blue.Name);
            var plotOptions2 = getBoxWhiskerPlotOptions(26F, 31F, 34F, 41F, 44F, 1F, Color.Red.Name);
            var plotOptions3 = getBoxWhiskerPlotOptions(18F, 22F, 27F, 32F, 38F, 2F, Color.Blue.Name);
            var plotOptions4 = getBoxWhiskerPlotOptions(27F, 31F, 35F, 39F, 47F, 2F, Color.Red.Name);

            var coordinates = new List <Coordinate> {
                new Coordinate(0F, 5F)
            };
            var boxplot1 = new Plot(coordinates, plotOptions1)
            {
                LegendEntry = "Male"
            };
            var boxplot2 = new Plot(coordinates, plotOptions2)
            {
                LegendEntry = "Female"
            };
            var boxplot3 = new Plot(new List <Coordinate>(), plotOptions3);
            var boxplot4 = new Plot(new List <Coordinate>(), plotOptions4);
            var plotItem = new TeXReporting.Items.Plot(colors,
                                                       axisOptions,
                                                       new List <Plot> {
                boxplot1, boxplot2, boxplot3, boxplot4
            },
                                                       new Text("Test Figure"));

            _objectsToReport.Add(new Section("Simple Box Plot"));
            _objectsToReport.Add(plotItem);
            _figureCounter++;
        }
        private void PlotFigures(string chapterName, List <Coordinate> coordinates, Text chapterTitle = null)
        {
            if (chapterTitle == null)
            {
                chapterTitle = new Text(chapterName);
            }

            _objectsToReport.Add(new Chapter(chapterName, chapterTitle));

            var colors = new List <Color>()
            {
                Color.Blue, Color.Red
            };

            var axisOptions = new AxisOptions(NoConverter.Instance)
            {
                Title  = "Test Title",
                XLabel = "X Axis",
                YLabel = "Y Axis",
                YMode  = AxisOptions.AxisMode.log,
                LogTicksWithFixedPoint = true,
                XAxisPosition          = AxisOptions.AxisXLine.bottom,
                YAxisPosition          = AxisOptions.AxisYLine.left,
                LegendOptions          = new LegendOptions {
                    LegendPosition = LegendOptions.LegendPositions.NorthWest
                },
                YMajorGrid = true
            };

            var plotOptions1 = new PlotOptions
            {
                LineStyle       = PlotOptions.LineStyles.Solid,
                Marker          = PlotOptions.Markers.Triangle,
                Color           = Color.Blue.Name,
                ErrorBars       = true,
                ShadedErrorBars = true,
                Thickness       = PlotOptions.Thicknesses.UltraThick
            };
            var plot1 = new Plot(coordinates, plotOptions1)
            {
                LegendEntry = "legend entry 1"
            };
            var plotItem = new TeXReporting.Items.Plot(colors, axisOptions, new List <Plot> {
                plot1
            }, new Text("Test Figure"));

            var plotOptions2 = new PlotOptions
            {
                LineStyle     = PlotOptions.LineStyles.DashDotted,
                Marker        = PlotOptions.Markers.Circle,
                Color         = Color.Red.Name,
                ErrorBars     = true,
                ThicknessSize = Helper.Length(2, Helper.MeasurementUnits.pt),
                MarkSize      = Helper.Length(3, Helper.MeasurementUnits.pt),
                MarkColor     = Color.Blue.Name,
                MarkFillColor = String.Format("{0}!{1}", Color.Blue.Name, 20)
            };
            var plot2 = new Plot(coordinates, plotOptions2)
            {
                LegendEntry =
                    "0123456789 0123456789 0123456789 0123456789 0123456789 0123456789"
            };
            var plotItem2 = new TeXReporting.Items.Plot(colors, axisOptions, new List <Plot> {
                plot2
            }, new Text("Test Figure 2"));

            // Two Ordinates Plot
            var axisOptionsY1 = new AxisOptions(NoConverter.Instance)
            {
                EnlargeLimits   = true,
                Title           = "Test Title",
                XLabel          = "X Axis",
                YLabel          = "Y Axis",
                YMin            = 0,
                XTickMin        = 2F,
                XTickMax        = 3F,
                MinorXTickNum   = 1,
                MinorYTickNum   = 1,
                BackgroundColor = "blue!10",
                YMode           = AxisOptions.AxisMode.normal,
                XAxisPosition   = AxisOptions.AxisXLine.bottom,
                YAxisPosition   = AxisOptions.AxisYLine.left,
                YMajorGrid      = true
            };
            var axisOptionsY2 = new AxisOptions(DefaultConverter.Instance)
            {
                YLabel        = "Y2 Axis",
                YAxisPosition = AxisOptions.AxisYLine.right,
                YAxisArrow    = false,
                YScaledTicks  = false,
                YMode         = AxisOptions.AxisMode.log,
                LegendOptions =
                    new LegendOptions
                {
                    FontSize        = LegendOptions.FontSizes.scriptsize,
                    LegendAlignment = LegendOptions.LegendAlignments.left,
                    LegendPosition  = LegendOptions.LegendPositions.OuterNorthWest,
                    RoundedCorners  = true,
                    Columns         = 1,
                    //TextWidth = Helper.GetWidthInPercentageOfTextWidth(30)
                },
                XAxisPosition = AxisOptions.AxisXLine.none
            };
            var plotTwoOrdinates = new PlotTwoOrdinates(colors, axisOptionsY1, new List <Plot> {
                plot1
            },
                                                        axisOptionsY2, new List <Plot> {
                plot2
            },
                                                        new Text("Test Two Ordinates"));

            var axisOptionsY3 = new AxisOptions(DefaultConverter.Instance)
            {
                YLabel         = "Y3 Axis",
                YAxisPosition  = AxisOptions.AxisYLine.right,
                YAxisArrow     = false,
                YScaledTicks   = true,
                YMin           = 0,
                YDiscontinuity = AxisOptions.Discontinuities.parallel,
                YMode          = AxisOptions.AxisMode.normal,
                LegendOptions  =
                    new LegendOptions
                {
                    FontSize        = LegendOptions.FontSizes.scriptsize,
                    LegendAlignment = LegendOptions.LegendAlignments.left,
                    LegendPosition  = LegendOptions.LegendPositions.OuterNorthEast,
                    RoundedCorners  = true,
                    Columns         = 1,
                    //TextWidth = Helper.GetWidthInPercentageOfTextWidth(30)
                },
                XAxisPosition = AxisOptions.AxisXLine.none
            };

            var plot3 = new Plot(new List <Coordinate> {
                new Coordinate(2.5F, 5F)
            },
                                 new PlotOptions {
                Marker = PlotOptions.Markers.Triangle
            })
            {
                LegendEntry = "Points"
            };

            var plotThreeOrdinates = new PlotThreeOrdinates(colors, axisOptionsY1, new List <Plot> {
                plot1
            },
                                                            axisOptionsY2, new List <Plot> {
                plot2
            },
                                                            axisOptionsY3, new List <Plot> {
                plot3
            },
                                                            new Text("Test Three Ordinates"));


            _objectsToReport.Add(new Section("Simple Figure 1"));
            var axisOptionsNormal = new AxisOptions(NoConverter.Instance)
            {
                Title  = "Test Title",
                XLabel = "X Axis",
                YLabel = "Y Axis",
                YMode  = AxisOptions.AxisMode.normal,
                LogTicksWithFixedPoint = true,
                XAxisPosition          = AxisOptions.AxisXLine.bottom,
                YAxisPosition          = AxisOptions.AxisYLine.left,
                LegendOptions          = new LegendOptions {
                    LegendPosition = LegendOptions.LegendPositions.NorthWest
                },
                YMajorGrid = true
            };
            var plotItemNormal = new TeXReporting.Items.Plot(plotItem.Colors, axisOptionsNormal, plotItem.Plots, new Text("Test Figure with normal scaled Y-Axis"));

            _objectsToReport.Add(plotItemNormal);
            _figureCounter++;


            _objectsToReport.Add(new Section("Simple Figure 2"));
            _objectsToReport.Add(plotItem);
            _figureCounter++;

            _objectsToReport.Add(new Section("Simple Figure 3"));
            _objectsToReport.Add(plotItem2);
            _figureCounter++;

            _objectsToReport.Add(new Section("Two Ordinates Figure"));
            _objectsToReport.Add(plotTwoOrdinates);
            _figureCounter++;

            _objectsToReport.Add(new Section("Three Ordinates Figure"));
            _objectsToReport.Add(plotThreeOrdinates);
            _figureCounter++;
        }
        protected override void Context()
        {
            base.Context();

            _pdfFileName = "RangePlots";
            _settings.DeleteWorkingDir = true;
            _settings.SaveArtifacts    = true;
            _figureCounter             = 0;

            var colors = new List <Color> {
                Color.Blue, Color.Red
            };

            _objectsToReport.Add(new Chapter("Range Plots"));

            var axisOptions = getAxisOptions();

            var coordinatesMale = new List <Coordinate>
            {
                new Coordinate(0F, 5F)
                {
                    errY = 0.4F, errY2 = 0.5F
                },
                new Coordinate(2F, 15F)
                {
                    errY = 0.4F, errY2 = 0.1F
                },
                new Coordinate(4F, 8F)
                {
                    errY = 1.4F, errY2 = 1.5F
                },
                new Coordinate(7F, 4F)
                {
                    errY = 0.4F, errY2 = 0.2F
                },
                new Coordinate(12F, 24F)
                {
                    errY = 0.4F, errY2 = 0.5F
                }
            };
            var coordinatesFemale = new List <Coordinate>
            {
                new Coordinate(0F, 10F)
                {
                    errY = 0.4F, errY2 = 0.5F
                },
                new Coordinate(2F, 12F)
                {
                    errY = 1.4F, errY2 = 1.3F
                },
                new Coordinate(4F, 11F)
                {
                    errY = 2.4F, errY2 = 1.5F
                },
                new Coordinate(5F, 9F)
                {
                    errY = 0.8F, errY2 = 0.7F
                },
                new Coordinate(6F, 8F)
                {
                    errY = 0.4F, errY2 = 0.1F
                },
                new Coordinate(7F, 7F)
                {
                    errY = 0.4F, errY2 = 0.1F
                },
                new Coordinate(14F, 27F)
                {
                    errY = 3.4F, errY2 = 2.5F
                }
            };
            var plotRangeMale = new Plot(coordinatesMale, getPlotOptions(Color.Blue.Name, true, false));
            var plotMale      = new Plot(coordinatesMale, getPlotOptions(Color.Blue.Name, false, true))
            {
                LegendEntry = "Male"
            };
            var plotRangeFemale = new Plot(coordinatesFemale, getPlotOptions(Color.Red.Name, true, false));
            var plotFemale      = new Plot(coordinatesFemale, getPlotOptions(Color.Red.Name, false, true))
            {
                LegendEntry = "Female"
            };
            var plotItem = new TeXReporting.Items.Plot(colors,
                                                       axisOptions,
                                                       new List <Plot> {
                plotRangeMale, plotMale, plotRangeFemale, plotFemale
            },
                                                       new Text("Test Figure"));

            _objectsToReport.Add(new Section("Simple Range Plot"));
            _objectsToReport.Add(plotItem);
            _figureCounter++;
        }