public BarPlot(IEnumerable <Color> colors, AxisOptions axisOptions, BarPlotOptions barPlotOptions, IEnumerable <TeX.PGFPlots.Plot> plots, Text caption) : base(colors, axisOptions, plots, caption) { BarPlotOptions = barPlotOptions; }
protected override void Context() { base.Context(); _pdfFileName = "BarPlots"; _settings.DeleteWorkingDir = true; _settings.SaveArtifacts = true; _figureCounter = 0; var colors = new List <Color> { Color.Blue, Color.Red }; _objectsToReport.Add(new Chapter("Bar Plots")); var plotOptions1 = getPlotOptions(Color.Blue.Name); var plotOptions2 = getPlotOptions(Color.Red.Name); var coordinates1 = new List <Coordinate> { new Coordinate(1F, 5F), new Coordinate(2F, 10F), new Coordinate(3F, 5F) }; var barplot1 = new Plot(coordinates1, plotOptions1) { LegendEntry = "Male" }; var coordinates2 = new List <Coordinate> { new Coordinate(1F, 3F), new Coordinate(2F, 8F), new Coordinate(3F, 9F) }; var barplot2 = new Plot(coordinates2, plotOptions2) { LegendEntry = "Female" }; // simple bar plot var barPlotOptionsSideBySide = new BarPlotOptions { BarPlotType = BarPlotOptions.BarPlotTypes.SideBySide, Width = "0.45", Shift = Helper.Length(2, Helper.MeasurementUnits.pt), NodesNearCoords = true }; _objectsToReport.Add(new Section("Simple Bar Plot")); _objectsToReport.Add(new BarPlot(colors, getAxisOptions(LegendOptions.LegendPositions.OuterNorthEast), barPlotOptionsSideBySide, new List <Plot> { barplot1, barplot2 }, new Text("Test Figure"))); _figureCounter++; _objectsToReport.Add(new Section("Simple Bar Plot With Legend Inside")); _objectsToReport.Add(new BarPlot(colors, getAxisOptions(LegendOptions.LegendPositions.NorthEast), barPlotOptionsSideBySide, new List <Plot> { barplot1, barplot2 }, new Text("Test Figure"))); _figureCounter++; // simple stacked bar plot var barPlotOptionsStacked = new BarPlotOptions { BarPlotType = BarPlotOptions.BarPlotTypes.Stacked, Width = "0.9" }; _objectsToReport.Add(new Section("Simple Stacked Bar Plot")); _objectsToReport.Add(new BarPlot(colors, getAxisOptions(LegendOptions.LegendPositions.OuterNorthEast), barPlotOptionsStacked, new List <Plot> { barplot1, barplot2 }, new Text("Test Figure"))); _figureCounter++; _objectsToReport.Add(new Section("Simple Stacked Bar Plot With Legend Inside")); _objectsToReport.Add(new BarPlot(colors, getAxisOptions(LegendOptions.LegendPositions.NorthEast), barPlotOptionsStacked, new List <Plot> { barplot1, barplot2 }, new Text("Test Figure"))); _figureCounter++; // simple interval bar plot var barPlotOptionsInterval = new BarPlotOptions { BarPlotType = BarPlotOptions.BarPlotTypes.Interval, TickLabelIntervalBoundaries = true }; // add dummy coordinate var coordinatesInt1 = new List <Coordinate>(coordinates1); var coordinatesInt2 = new List <Coordinate>(coordinates2); coordinatesInt1.Add(new Coordinate(4F, 0F)); coordinatesInt2.Add(new Coordinate(4F, 0F)); var barplotInt1 = new Plot(coordinatesInt1, plotOptions1) { LegendEntry = "Male" }; var barplotInt2 = new Plot(coordinatesInt2, plotOptions2) { LegendEntry = "Female" }; _objectsToReport.Add(new Section("Simple Interval Bar Plot")); _objectsToReport.Add(new BarPlot(colors, getAxisOptionsForInterval(LegendOptions.LegendPositions.OuterNorthEast), barPlotOptionsInterval, new List <Plot> { barplotInt1, barplotInt2 }, new Text("Test Figure"))); _figureCounter++; _objectsToReport.Add(new Section("Simple Interval Bar Plot With Legend Inside")); _objectsToReport.Add(new BarPlot(colors, getAxisOptionsForInterval(LegendOptions.LegendPositions.NorthEast), barPlotOptionsInterval, new List <Plot> { barplotInt1, barplotInt2 }, new Text("Test Figure"))); _figureCounter++; // simple stacked interval bar plot var barPlotOptionsIntervalStacked = new BarPlotOptions { BarPlotType = BarPlotOptions.BarPlotTypes.IntervalStacked, TickLabelIntervalBoundaries = true }; _objectsToReport.Add(new Section("Simple Stacked Interval Bar Plot")); _objectsToReport.Add(new BarPlot(colors, getAxisOptionsForInterval(LegendOptions.LegendPositions.OuterNorthEast), barPlotOptionsIntervalStacked, new List <Plot> { barplotInt1, barplotInt2 }, new Text("Test Figure"))); _figureCounter++; _objectsToReport.Add(new Section("Simple Stacked Interval Bar Plot With Legend Inside")); _objectsToReport.Add(new BarPlot(colors, getAxisOptionsForInterval(LegendOptions.LegendPositions.NorthEast), barPlotOptionsIntervalStacked, new List <Plot> { barplotInt1, barplotInt2 }, new Text("Test Figure"))); _figureCounter++; }