public void BarSeries() { var s1 = new OxyPlot.Series.BarSeries(); var s2 = new BarSeries(); OxyAssert.PropertiesAreEqual(s1, s2); }
/// <summary> /// Removes all files created by the plot class to function. /// </summary> public void RemovePlot() { viewerChart = null; BarSeries = null; var file = new FileInfo($"mopsdata//plots//{ID}barplot.json"); file.Delete(); var dir = new DirectoryInfo("mopsdata//"); var files = dir.GetFiles().Where(x => x.Extension.ToLower().Equals($"{ID}plot.pdf")); foreach (var f in files) { f.Delete(); } }
private void initPlot() { viewerChart = new PlotModel(); viewerChart.TextColor = OxyColor.FromRgb(175, 175, 175); viewerChart.PlotAreaBorderThickness = new OxyThickness(0); viewerChart.Axes.Add(new OxyPlot.Axes.CategoryAxis() { Key = ID, Position = OxyPlot.Axes.AxisPosition.Left, ItemsSource = Categories.Count > 20 ? null : Categories.Keys, FontSize = 24, AxislineColor = OxyColor.FromRgb(125, 125, 155), TicklineColor = OxyColor.FromRgb(125, 125, 155) }); viewerChart.Axes.Add(new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom, TicklineColor = OxyColor.FromRgb(125, 125, 155), Minimum = 0, FontSize = 24, AxislineStyle = LineStyle.Solid, AxislineColor = OxyColor.FromRgb(125, 125, 155) }); //viewerChart.LegendFontSize = 24; //viewerChart.LegendPosition = LegendPosition.BottomCenter; BarSeries = new OxyPlot.Series.BarSeries() { ItemsSource = new List <OxyPlot.Series.BarItem>(Categories.Values.Select(x => new OxyPlot.Series.BarItem(x))), //LabelPlacement = OxyPlot.Series.LabelPlacement.Outside, FontSize = 24, //LabelFormatString = "{0}", FillColor = OxyColor.FromRgb(190, 192, 187) }; viewerChart.Series.Add(BarSeries); }
// creates the graph window public void createUI() { // create the bar series var series = new OxyPlot.Series.BarSeries { StrokeColor = OxyPlot.OxyColors.Black, FillColor = OxyPlot.OxyColors.Orange, StrokeThickness = 1, LabelPlacement = OxyPlot.Series.LabelPlacement.Inside, LabelFormatString = "{0:}" }; // add data to bar series for (int i = 0; i < 12; i++) { series.Items.Add(new OxyPlot.Series.BarItem { Value = this.checkinCounts[i] }); } // create a model and add the bar to it var model = new OxyPlot.PlotModel { Title = "Checkins Per Month", Background = OxyPlot.OxyColors.White }; // add axis label model.Axes.Add(new OxyPlot.Axes.CategoryAxis { Position = OxyPlot.Axes.AxisPosition.Left, ItemsSource = new[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" } }); model.Series.Add(series); layout.DefaultSpacing = new Size(5, 5); layout.Padding = new Padding(10, 10, 10, 10); const int plotWidth = 600; const int plotHeight = 400; Bitmap bmap; var pf = Eto.Platform.Detect; // convert the oxyplot model to a bitmap base on platform if (pf.IsWpf) { var pngStream = new MemoryStream(); var exporter = new OxyPlot.ImageSharp.PngExporter(plotWidth, plotHeight); exporter.Export(model, pngStream); bmap = new Bitmap(pngStream); } else { OxyPlot.ImageSharp.PngExporter.Export(model, "temp.png", plotWidth, plotHeight); bmap = new Bitmap("temp.png"); if (File.Exists("temp.png")) { File.Delete("temp.png"); } } layout.BeginHorizontal(); layout.BeginVertical(); layout.Add(bmap); layout.EndHorizontal(); layout.EndVertical(); }