public TemperaturePlotWindow(float[] temperature) { var plotModel = new OxyPlot.PlotModel(); plotModel.Title = "Temperature"; plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Left, Title = "Celcius" }); //plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "Epochs" }); var labels = new string[] { "Temperature" }; var colors = new OxyPlot.OxyColor[] { OxyPlot.OxyColors.Blue }; var lineSeries = new OxyPlot.Series.LineSeries(); lineSeries.ItemsSource = temperature.Select((value, index) => new OxyPlot.DataPoint(index, value)); lineSeries.Title = labels[0]; lineSeries.Color = colors[0]; plotModel.Series.Add(lineSeries); var plotView = new OxyPlot.Wpf.PlotView(); plotView.Model = plotModel; Content = plotView; }
public PlotWindow(List <List <double> > results) { var plotModel = new OxyPlot.PlotModel(); plotModel.Title = "Training and Validation Accuracy"; plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Left, Title = "Accuracy", Minimum = 0, Maximum = 1 }); plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "Epochs" }); var labels = new string[] { "Training", "Validation" }; var colors = new OxyPlot.OxyColor[] { OxyPlot.OxyColors.Blue, OxyPlot.OxyColors.Green }; for (int row = 0; row < results.Count; row++) { var lineSeries = new OxyPlot.Series.LineSeries(); lineSeries.ItemsSource = results[row].Select((value, index) => new OxyPlot.DataPoint(index, value)); lineSeries.Title = labels[row]; lineSeries.Color = colors[row]; plotModel.Series.Add(lineSeries); } var plotView = new OxyPlot.Wpf.PlotView(); plotView.Model = plotModel; Title = "Chart"; Content = plotView; }
public PlotWindow(List <List <double> > results) { var plotModel = new OxyPlot.PlotModel(); plotModel.Title = "Mean Absolute Validation Error Per Fold"; plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Left, Title = "Error" }); plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "Epochs" }); var colors = new OxyPlot.OxyColor[] { OxyPlot.OxyColors.Blue, OxyPlot.OxyColors.Green, OxyPlot.OxyColors.Red, OxyPlot.OxyColors.Black }; for (int row = 0; row < results.Count; row++) { var lineSeries = new OxyPlot.Series.LineSeries(); lineSeries.ItemsSource = results[row].Select((value, index) => new OxyPlot.DataPoint(index, value)); lineSeries.Title = string.Format("Fold {0}/{1}", row + 1, results.Count); lineSeries.Color = colors[row]; plotModel.Series.Add(lineSeries); } var plotView = new OxyPlot.Wpf.PlotView(); plotView.Model = plotModel; Title = "Chart"; Content = plotView; }
public static OxyPlot.PlotModel CreateOxyPlotModel() { OxyPlot.PlotModel plotModel = new OxyPlot.PlotModel(); plotModel.Annotations = null; plotModel.AutoAdjustPlotMargins = true; plotModel.Axes = null; plotModel.AxisTierDistance = 4D; plotModel.Background = null; plotModel.Culture = null; plotModel.DefaultColors = null; plotModel.DefaultFont = "Arial";//Segoe UI"; plotModel.DefaultFontSize = 12D; plotModel.IsLegendVisible = true; plotModel.LegendBackground = null; plotModel.LegendBorder = null; plotModel.LegendBorderThickness = 1D; plotModel.LegendColumnSpacing = 0D; plotModel.LegendFont = null; plotModel.LegendFontSize = 12D; plotModel.LegendFontWeight = 400D; plotModel.LegendItemAlignment = global::OxyPlot.HorizontalAlignment.Left; plotModel.LegendItemOrder = global::OxyPlot.LegendItemOrder.Normal; plotModel.LegendItemSpacing = 24D; plotModel.LegendMargin = 8D; plotModel.LegendOrientation = global::OxyPlot.LegendOrientation.Vertical; plotModel.LegendPadding = 8D; plotModel.LegendPlacement = global::OxyPlot.LegendPlacement.Inside; plotModel.LegendPosition = global::OxyPlot.LegendPosition.RightTop; plotModel.LegendSymbolLength = 16D; plotModel.LegendSymbolMargin = 4D; plotModel.LegendSymbolPlacement = global::OxyPlot.LegendSymbolPlacement.Left; plotModel.LegendTextColor = null; plotModel.LegendTitle = null; plotModel.LegendTitleColor = null; plotModel.LegendTitleFont = null; plotModel.LegendTitleFontSize = 12D; plotModel.LegendTitleFontWeight = 700D; plotModel.PlotAreaBackground = null; plotModel.PlotAreaBorderColor = null; plotModel.PlotAreaBorderThickness = 1D; plotModel.PlotType = global::OxyPlot.PlotType.XY; plotModel.Series = null; plotModel.Subtitle = null; plotModel.SubtitleColor = null; plotModel.SubtitleFont = null; plotModel.SubtitleFontSize = 14D; plotModel.SubtitleFontWeight = 400D; plotModel.TextColor = null; plotModel.Title = null; plotModel.TitleColor = null; plotModel.TitleFont = null; plotModel.TitleFontSize = 18D; plotModel.TitleFontWeight = 700D; plotModel.TitlePadding = 6D; return(plotModel); }
private void VolumeCortado(int[] solucao) { var plotVolumeCortado = new OxyPlot.PlotModel(); var xAxis = new CategoryAxis { Key = "xAxis", Position = AxisPosition.Bottom, Title = "Ano", Minimum = -1, Maximum = HeuristicsBase.h + 1 }; plotVolumeCortado.Axes.Add(new LinearAxis { Key = "yAxis", Position = AxisPosition.Left, Title = "Volume (m³)", Minimum = 0, MaximumPadding = 0.1 }); var serieVolumeCortado = new OxyPlot.Series.ColumnSeries { Title = "Volume cortado", StrokeThickness = 2, FillColor = OxyPlot.OxyColor.FromRgb(180, 180, 180) }; var serieMinVolumeCortado = new OxyPlot.Series.LineSeries { Selectable = false, Title = "Mínimo", Color = OxyPlot.OxyColor.FromRgb(0, 0, 0), CanTrackerInterpolatePoints = false }; var serieMaxVolumeCortado = new OxyPlot.Series.LineSeries { Title = "Máximo", Color = OxyPlot.OxyColor.FromRgb(0, 0, 0), CanTrackerInterpolatePoints = false }; serieMinVolumeCortado.Points.Add(new OxyPlot.DataPoint(-1000, HeuristicsBase.volMin)); serieMaxVolumeCortado.Points.Add(new OxyPlot.DataPoint(-1000, HeuristicsBase.volMax)); serieMinVolumeCortado.Points.Add(new OxyPlot.DataPoint(1000, HeuristicsBase.volMin)); serieMaxVolumeCortado.Points.Add(new OxyPlot.DataPoint(1000, HeuristicsBase.volMax)); //Adicionando o volume médio ao gráfico xAxis.ActualLabels.Add("Md"); serieVolumeCortado.Items.Add(new OxyPlot.Series.ColumnItem(HeuristicsBase.volumeMedio)); serieVolumeCortado.Items[0].Color = OxyPlot.OxyColor.FromRgb(80, 80, 80); for (var i = 0; i < HeuristicsBase.h; i++) { //Adicionando o número do ano no eixo X do gráfico xAxis.ActualLabels.Add(i.ToString()); serieVolumeCortado.Items.Add(new OxyPlot.Series.ColumnItem(solucao.Select((p, idx) => HeuristicsBase.mVolume[idx, p, i]).Sum())); } plotVolumeCortado.Axes.Add(xAxis); plotVolumeCortado.Series.Add(serieVolumeCortado); plotVolumeCortado.Series.Add(serieMinVolumeCortado); plotVolumeCortado.Series.Add(serieMaxVolumeCortado); plot_interface_2.Model = plotVolumeCortado; }
public override void AddToModel(OxyPlot.PlotModel model) { foreach (GraphingClass dh in histos) { if (dh.GetHistoCoords().Count > 1) { dh.AddToModel(model); } } }
public ViewModel() { _connected = false; _cameraList = new ObservableCollection <Videoinsight.LIB.Camera>(); _testCamera = null; _controlPanelVisibility = Visibility.Collapsed; _detectorValue = "0"; pointCount = 0; pointLimit = 100; maxValue = 1.5; MyPlotModel = new OxyPlot.PlotModel { Title = "", TitleFontSize = 10 }; MyXAxis = new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom, Minimum = 0, Maximum = pointLimit, Title = "", MajorGridlineStyle = OxyPlot.LineStyle.None, MinorGridlineStyle = OxyPlot.LineStyle.None, TickStyle = OxyPlot.Axes.TickStyle.None }; MyYAxis = new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Left, Minimum = 0, Maximum = maxValue, Title = "", MajorGridlineStyle = OxyPlot.LineStyle.None, MinorGridlineStyle = OxyPlot.LineStyle.None, TickStyle = OxyPlot.Axes.TickStyle.None }; MyPlotModel.Axes.Add(MyXAxis); MyPlotModel.Axes.Add(MyYAxis); MyXAxis.IsZoomEnabled = false; MyXAxis.IsPanEnabled = false; MyYAxis.IsZoomEnabled = false; MyYAxis.IsPanEnabled = false; MyDataSeries = new OxyPlot.Series.LineSeries { Title = "", MarkerType = OxyPlot.MarkerType.None, }; MyDataSeries.Points.Add(new OxyPlot.DataPoint(0, 0)); MyDataSeries.Points.Add(new OxyPlot.DataPoint(1, 1)); MyDataSeries.Points.Add(new OxyPlot.DataPoint(2, 0.5)); MyDataSeries.Points.Add(new OxyPlot.DataPoint(3, 1)); MyPlotModel.Series.Add(MyDataSeries); }
private void Form1_Load(object sender, EventArgs e) { // simulate making a plot from a console // generate some random XY data int pointCount = 1_000; double[] xs1 = RandomWalk(pointCount); double[] ys1 = RandomWalk(pointCount); double[] xs2 = RandomWalk(pointCount); double[] ys2 = RandomWalk(pointCount); // create lines and fill them with data points var line1 = new OxyPlot.Series.LineSeries() { Title = $"Series 1", Color = OxyPlot.OxyColors.Blue, StrokeThickness = 1, MarkerSize = 2, MarkerType = OxyPlot.MarkerType.Circle }; var line2 = new OxyPlot.Series.LineSeries() { Title = $"Series 2", Color = OxyPlot.OxyColors.Red, StrokeThickness = 1, MarkerSize = 2, MarkerType = OxyPlot.MarkerType.Circle }; for (int i = 0; i < pointCount; i++) { line1.Points.Add(new OxyPlot.DataPoint(xs1[i], ys1[i])); line2.Points.Add(new OxyPlot.DataPoint(xs2[i], ys2[i])); } // create the model and add the lines to it var model = new OxyPlot.PlotModel { Title = $"Scatter Plot ({pointCount:N0} points each)" }; model.Series.Add(line1); model.Series.Add(line2); // save the file as a PNG string filePath = System.IO.Path.GetFullPath("oxyplot-console-quickstart.png"); OxyPlot.WindowsForms.PngExporter.Export(model, filePath, 400, 300, OxyPlot.OxyColors.White); Console.WriteLine($"Saved: {filePath}"); }
private void InitPlotterAxes() { var plotModel = new OxyPlot.PlotModel { PlotType = OxyPlot.PlotType.XY, }; var X = new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom, Minimum = 0, Maximum = 5.0 }; _filteredAxis = new OxyPlot.Axes.LinearAxis { Key = "Filtered", Position = OxyPlot.Axes.AxisPosition.Left, Minimum = -600, Maximum = 600 }; _unfilteredAxis = new OxyPlot.Axes.LinearAxis { Key = "Unfiltered", Position = OxyPlot.Axes.AxisPosition.Right, Minimum = -40000, Maximum = -20000 }; plotModel.Axes.Add(X); plotModel.Axes.Add(_filteredAxis); plotModel.Axes.Add(_unfilteredAxis); _filteredSeries = new OxyPlot.Series.LineSeries { XAxisKey = X.Key, YAxisKey = _filteredAxis.Key, Color = OxyPlot.OxyColor.FromRgb(0, 0, 255) }; _unfilteredSeries = new OxyPlot.Series.LineSeries { XAxisKey = X.Key, YAxisKey = _unfilteredAxis.Key, Color = OxyPlot.OxyColor.FromRgb(255, 0, 0) }; plotModel.Series.Add(_unfilteredSeries); plotModel.Series.Add(_filteredSeries); plotView1.Model = plotModel; }
private void FixSizing(ref OxyPlot.PlotModel model) { foreach (var series in model.Series.OfType <OxyPlot.Series.LineSeries>()) { series.MarkerSize = 2; } model.DefaultFontSize = 10; foreach (var axis in model.Axes) { axis.FontSize = 10; } model.TitleFontSize = 10; }
public MainPage() { //InitializeComponent(); OxyPlot.PlotModel Model = new OxyPlot.PlotModel { Title = "Hello, Forms!" }; Model.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.1, "cos(x)")); Content = new PlotView { Model = Model, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, }; }
private void PlotChart(Card card, Dictionary <uint, List <Quotation> > all_quotes) { OxyPlot.Wpf.PlotView plotView = new OxyPlot.Wpf.PlotView(); OxyPlot.PlotModel plot = new OxyPlot.PlotModel() { LegendPlacement = OxyPlot.LegendPlacement.Outside, LegendPosition = OxyPlot.LegendPosition.BottomCenter, LegendOrientation = OxyPlot.LegendOrientation.Horizontal }; plot.Axes.Add(new OxyPlot.Axes.DateTimeAxis()); plot.Axes.Add(new OxyPlot.Axes.LinearAxis() { Minimum = 0 }); List <DateTime> dates = new List <DateTime>(); List <double> values = new List <double>(); foreach (var provider in all_quotes) { OxyPlot.Series.LineSeries ls = new OxyPlot.Series.LineSeries() { Title = Static.Database.Instance.Providers.First(x => x.ID == provider.Key).Name, CanTrackerInterpolatePoints = false, MarkerSize = 2, MarkerType = OxyPlot.MarkerType.Circle, TrackerFormatString = "{0}\n{2:dd/MM/yyyy}\nR$ {4:F2}" }; foreach (Quotation q in provider.Value) { DateTime dt = DateTime.FromFileTimeUtc(q.Timestamp); double vl = double.Parse(q.Value); dates.Add(dt); values.Add(vl); ls.Points.Add(OxyPlot.Axes.DateTimeAxis.CreateDataPoint(dt, vl)); } plot.Series.Add(ls); } if (dates.Count > 0) { plot.Axes[0].Minimum = OxyPlot.Axes.DateTimeAxis.ToDouble(dates.Min().AddDays(-1)); plot.Axes[0].Maximum = OxyPlot.Axes.DateTimeAxis.ToDouble(dates.Max().AddDays(1)); plot.Axes[1].Maximum = values.Max() * 1.1; } plotView.Model = plot; plotGrid.Children.Clear(); plotGrid.Children.Add(plotView); }
private void FlorestaRegulada(int[] solucao) { var plotFlorestaRegulada = new OxyPlot.PlotModel(); plotFlorestaRegulada.Axes.Add(new CategoryAxis { Key = "xAxis", Position = AxisPosition.Bottom, Title = "Ano", Minimum = -1, Maximum = HeuristicsBase.r + 1 }); plotFlorestaRegulada.Axes.Add(new LinearAxis { Key = "yAxis", Position = AxisPosition.Left, Title = "Area (ha)", Minimum = 0, MaximumPadding = 0.1 }); var serieFlorestaRegulada = new OxyPlot.Series.ColumnSeries { Title = "Area de corte", StrokeThickness = 2, FillColor = OxyPlot.OxyColor.FromRgb(180, 180, 180) }; var serieMinFlorestaRegulada = new OxyPlot.Series.LineSeries { Title = "Mínimo", Color = OxyPlot.OxyColor.FromRgb(0, 0, 0), CanTrackerInterpolatePoints = false }; var serieMaxFlorestaRegulada = new OxyPlot.Series.LineSeries { Title = "Máximo", Color = OxyPlot.OxyColor.FromRgb(0, 0, 0), CanTrackerInterpolatePoints = false }; serieMinFlorestaRegulada.Points.Add(new OxyPlot.DataPoint(-1000, HeuristicsBase.areaPorR_menosAlfaReg)); serieMaxFlorestaRegulada.Points.Add(new OxyPlot.DataPoint(-1000, HeuristicsBase.areaPorR_maisAlfaReg)); serieMinFlorestaRegulada.Points.Add(new OxyPlot.DataPoint(1000, HeuristicsBase.areaPorR_menosAlfaReg)); serieMaxFlorestaRegulada.Points.Add(new OxyPlot.DataPoint(1000, HeuristicsBase.areaPorR_maisAlfaReg)); for (var i = 0; i < HeuristicsBase.r; i++) { serieFlorestaRegulada.Items.Add(new OxyPlot.Series.ColumnItem(solucao.Select((p, idx) => HeuristicsBase.mRegArea[idx, p, i]).Sum())); } plotFlorestaRegulada.Series.Add(serieFlorestaRegulada); plotFlorestaRegulada.Series.Add(serieMinFlorestaRegulada); plotFlorestaRegulada.Series.Add(serieMaxFlorestaRegulada); plot_interface_1.Model = plotFlorestaRegulada; }
public MainWindow() : base(global::Gtk.WindowType.Toplevel) { //Build(); var plotView = new CustomPlotView(); this.Add(plotView); plotView.ShowAll(); var myModel = new OxyPlot.PlotModel { Title = "Example 1" }; myModel.Series.Add(new OxyPlot.Series.FunctionSeries(Math.Cos, 0, 10, 0.1, "cos(x)")); plotView.Model = myModel; }
private void invBitButton_Click(object sender, RoutedEventArgs e) { try { int n = int.Parse(invBitTextBox.Text); if (n < 0 || n > textIn.Text.Length * 8) { throw new ArgumentException(); } MD5 md5 = new MD5(textIn.Text); rounds1 = md5.rounds; hashGraphFirst.Text = md5.GetStringHash(); byte[] m = textIn.Text.Select(new Func <char, byte>((char c) => (byte)c)).ToArray(); m[n / 8] ^= (byte)(1 << n % 8); md5 = new MD5(m); rounds2 = md5.rounds; hashGraphSecond.Text = md5.GetStringHash(); OxyPlot.PlotModel plotModel = new OxyPlot.PlotModel(); plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Minimum = 0, Maximum = 64 }); plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Left, Minimum = 0, Maximum = 256 }); OxyPlot.Series.LineSeries lineSeries = new OxyPlot.Series.LineSeries(); for (int i = 0; i < 64; ++i) { int c = 0; for (int j = 0; j < 128; ++j) { if (rounds1[i][j] != rounds2[i][j]) { c++; } } lineSeries.Points.Add(new OxyPlot.DataPoint(i, c)); } plotModel.Series.Add(lineSeries); plotView.Model = plotModel; } catch { MessageBox.Show("Номер инвертируемого бита некорректен!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void ScatterButton_Click(object sender, EventArgs e) { // generate some random XY data int pointCount = 1_000; double[] xs1 = RandomWalk(pointCount); double[] ys1 = RandomWalk(pointCount); double[] xs2 = RandomWalk(pointCount); double[] ys2 = RandomWalk(pointCount); // create lines and fill them with data points var line1 = new OxyPlot.Series.LineSeries() { Title = $"Series 1", Color = OxyPlot.OxyColors.Blue, StrokeThickness = 1, MarkerSize = 2, MarkerType = OxyPlot.MarkerType.Circle }; var line2 = new OxyPlot.Series.LineSeries() { Title = $"Series 2", Color = OxyPlot.OxyColors.Red, StrokeThickness = 1, MarkerSize = 2, MarkerType = OxyPlot.MarkerType.Circle }; for (int i = 0; i < pointCount; i++) { line1.Points.Add(new OxyPlot.DataPoint(xs1[i], ys1[i])); line2.Points.Add(new OxyPlot.DataPoint(xs2[i], ys2[i])); } // create the model and add the lines to it var model = new OxyPlot.PlotModel { Title = $"Scatter Plot ({pointCount:N0} points each)" }; model.Series.Add(line1); model.Series.Add(line2); // load the model into the user control plotView1.Model = model; }
public PlotWindow(List <List <double> > results) { var plotModel = new OxyPlot.PlotModel(); plotModel.Title = "Cats And Dogs"; plotModel.LegendPosition = OxyPlot.LegendPosition.BottomRight; plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Left, Title = "Accuracy", Minimum = 0, Maximum = 1, }); plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Minimum = 0, Maximum = results[0].Count + 1, Title = "Epochs" }); var labels = new string[] { "Train Set", "Validation Set" }; var markerTypes = new OxyPlot.MarkerType[] { OxyPlot.MarkerType.Plus, OxyPlot.MarkerType.Circle }; for (int row = 0; row < results.Count; row++) { var scatterSeries = new OxyPlot.Series.ScatterSeries() { MarkerType = markerTypes[row], MarkerStroke = OxyPlot.OxyColors.Blue, MarkerFill = OxyPlot.OxyColors.Black }; scatterSeries.ItemsSource = results[row].Select((value, index) => new OxyPlot.Series.ScatterPoint(index + 1, value)); scatterSeries.Title = labels[row]; plotModel.Series.Add(scatterSeries); } var plotView = new OxyPlot.Wpf.PlotView(); plotView.Model = plotModel; Title = "Chart"; Content = plotView; }
public void Test1() { var g = new GainStage(); g.Update(12000, 48000); var data = Enumerable.Range(0, 2000).Select(x => Math.Sin(x / 127.3) * 1.2).ToArray(); var output = new double[data.Length]; for (var i = 0; i < data.Length; i++) { output[i] = g.Compute(data[i]); } var plt = new OxyPlot.PlotModel(); plt.AddLine(data); plt.AddLine(output); plt.Show(); }
public PlotWindow(List <List <double> > results) { var plotModel = new OxyPlot.PlotModel(); plotModel.Title = "Overfitting and Underfitting"; plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Left, Title = "Validation Loss", Minimum = 0, Maximum = 1, }); plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Minimum = 0, Maximum = results[0].Count + 1, Title = "Epochs" }); var labels = new string[] { "Original Model", "Dropout-regularized model" }; var markerTypes = new OxyPlot.MarkerType[] { OxyPlot.MarkerType.Plus, OxyPlot.MarkerType.Circle }; for (int row = 0; row < results.Count; row++) { var scatterSeries = new OxyPlot.Series.ScatterSeries() { MarkerType = markerTypes[row], MarkerStroke = OxyPlot.OxyColors.Blue, MarkerFill = OxyPlot.OxyColors.Blue }; scatterSeries.ItemsSource = results[row].Select((value, index) => new OxyPlot.Series.ScatterPoint(index + 1, value)); scatterSeries.Title = labels[row]; plotModel.Series.Add(scatterSeries); } var plotView = new OxyPlot.Wpf.PlotView(); plotView.Model = plotModel; Title = "Chart"; Content = plotView; }
private void BarButton_Click(object sender, EventArgs e) { // generate some random Y data int pointCount = 5; double[] ys1 = RandomWalk(pointCount); double[] ys2 = RandomWalk(pointCount); // create a series of bars and populate them with data var seriesA = new OxyPlot.Series.ColumnSeries() { Title = "Series A", StrokeColor = OxyPlot.OxyColors.Black, FillColor = OxyPlot.OxyColors.Red, StrokeThickness = 1 }; var seriesB = new OxyPlot.Series.ColumnSeries() { Title = "Series B", StrokeColor = OxyPlot.OxyColors.Black, FillColor = OxyPlot.OxyColors.Blue, StrokeThickness = 1 }; for (int i = 0; i < pointCount; i++) { seriesA.Items.Add(new OxyPlot.Series.ColumnItem(ys1[i], i)); seriesB.Items.Add(new OxyPlot.Series.ColumnItem(ys2[i], i)); } // create a model and add the bars into it var model = new OxyPlot.PlotModel { Title = "Bar Graph (Column Series)" }; model.Axes.Add(new OxyPlot.Axes.CategoryAxis()); model.Series.Add(seriesA); model.Series.Add(seriesB); // load the model into the user control plotView1.Model = model; }
public static PdfDocument GetPDF(this OxyPlot.PlotModel model, float width, float height) { if (model is null) { return(null); } NSData dat = null; model.DefaultFont = OxyPlot.StandardFonts.Helvetica.RegularFont.FontName; using (var stream = new MemoryStream()) { OxyPlot.PdfExporter.Export(model, stream, width, height); dat = NSData.FromArray(stream.GetBuffer()); } return(new PdfDocument(dat)); }
private void InitializeView() { var model = new OxyPlot.PlotModel() { Title = "Test", }; model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom }); model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Left }); model.Series.Add(Series); Graph.Model = model; }
OxyPlot.PlotModel CreateModel() { var model = new OxyPlot.PlotModel(); model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Maximum = 1f, Minimum = -1f, Position = OxyPlot.Axes.AxisPosition.Left }); model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom }); series = new OxyPlot.Series.LineSeries() { }; model.Series.Add(series); return(model); }
OxyPlot.PlotModel SetSpector(IEnumerable <OxyPlot.DataPoint> data) { var model = new OxyPlot.PlotModel(); model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Left, Title = "power" }); model.Axes.Add(new OxyPlot.Axes.LogarithmicAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "Freq", }); var series = new OxyPlot.Series.LineSeries(); series.Points.AddRange(data); model.Series.Add(series); return(model); }
OxyPlot.PlotModel SetPowergram(IEnumerable <OxyPlot.DataPoint> data) { var model = new OxyPlot.PlotModel() { Title = "velocity" }; model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "t" }); model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Title = "Power(dB)", Position = OxyPlot.Axes.AxisPosition.Left }); var s = new OxyPlot.Series.LineSeries(); s.Points.AddRange(data); model.Series.Add(s); return(model); }
public void Sample02() { this.Title = "Gráfico"; this.Icon = "Icon.png"; OxyPlot.PlotModel myModel = new OxyPlot.PlotModel("Square wave"); OxyPlot.Series.LineSeries ls = new OxyPlot.Series.LineSeries("sin(x)+sin(3x)/3+sin(5x)/5+..."); int n = 10; for (double x = -10; x < 10; x += 0.0001) { double y = 0; for (int i = 0; i < n; i++) { int j = i * 2 + 1; y += Math.Sin(j * x) / j; } ls.Points.Add(new OxyPlot.DataPoint(x, y)); } myModel.Series.Add(ls); myModel.Axes.Add(new OxyPlot.Axes.LinearAxis(OxyPlot.Axes.AxisPosition.Left, -4, 4)); myModel.Axes.Add(new OxyPlot.Axes.LinearAxis(OxyPlot.Axes.AxisPosition.Bottom)); this.Content = new Xamarin.Forms.StackLayout { Spacing = 20, Padding = 10, VerticalOptions = Xamarin.Forms.LayoutOptions.Center, Children = { myModel } }; return; }
private OxyPlot.PlotModel GerarGraficoPizza() { //CONFIGURACAO var valores = new OxyPlot.Series.PieSeries(); valores.Stroke = OxyPlot.OxyColors.White; valores.StrokeThickness = 1.0; valores.Diameter = 1.0; valores.InnerDiameter = 0.0; valores.StartAngle = 90.0; valores.AngleSpan = 360.0; valores.AngleIncrement = 1.0; valores.OutsideLabelFormat = "{2:0} %"; valores.InsideLabelFormat = "{1}"; valores.TickDistance = 0.5; valores.TickRadialLength = 6; valores.TickHorizontalLength = 1; valores.TickLabelDistance = 1; valores.InsideLabelPosition = 0.5; valores.FontSize = 12; valores.Slices.Add( new OxyPlot.Series.PieSlice("Cotação Real", Moeda.CotacaoRealMoeda)); valores.Slices.Add( new OxyPlot.Series.PieSlice("Cotação Dolar", Moeda.CotacaoDolarMoeda)); // ADICIONANDO OS VALORES NO GRÁFICO var plotModel = new OxyPlot.PlotModel(); plotModel.IsLegendVisible = true; plotModel.Series.Add(valores); return(plotModel); }
void ShowScorePlot() { var model = new OxyPlot.PlotModel(); model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Title = "score", Position = OxyPlot.Axes.AxisPosition.Left, }); model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Title = "generation", Position = OxyPlot.Axes.AxisPosition.Bottom, Maximum = int.Parse(maxGeneration.Text) }); series = new OxyPlot.Series.LineSeries() { Title = "best" }; model.Series.Add(series); //ser = new OxyPlot.Series.LineSeries() //{ // Title = "average" //}; //ser.Points.AddRange(scoreHistory.Select((x, i) => new OxyPlot.DataPoint(i, x.Item2))); //model.Series.Add(ser); //ser = new OxyPlot.Series.LineSeries() //{ // Title = "distribution" //}; //ser.Points.AddRange(scoreHistory.Select((x, i) => new OxyPlot.DataPoint(i, x.Item3))); //model.Series.Add(ser); plot.Model = model; plot.InvalidatePlot(); }
public static OxyPlot.PlotModel CreatePlotModel(IList <KeyValuePair <DateTime, Tuple <double, double>[]> > u) { var pm = new OxyPlot.PlotModel(); var scatterSeries = new OxyPlot.Series.ScatterSeries { MarkerType = OxyPlot.MarkerType.Circle }; var first = u.First().Key; scatterSeries.Points.AddRange(u.SelectMany(_ => { return(_.Value.Select(__ => { var size = 2; var colorValue = __.Item2; return new OxyPlot.Series.ScatterPoint((_.Key - first).TotalDays, __.Item1, size, colorValue); })); })); //scatterSeries.Points=cx; pm.Series.Add(scatterSeries); return(pm); }
public static OxyPlot.PlotModel CreatePlotModel(double[] x, double[] y1, double[] y2, string title, string subtitle, string xtitle, string ytitle, string ytitle1, string ytitle2) { var model = new OxyPlot.PlotModel() { Subtitle = subtitle, Title = title }; model.Background = OxyPlot.OxyColors.White; model.TitleFontSize = 14; model.SubtitleFontSize = 12; model.Axes.Add(new OxyPlot.Axes.LinearAxis() { MajorGridlineStyle = OxyPlot.LineStyle.Dash, MinorGridlineStyle = OxyPlot.LineStyle.Dot, Position = OxyPlot.Axes.AxisPosition.Bottom, FontSize = 12, Title = xtitle }); model.Axes.Add(new OxyPlot.Axes.LinearAxis() { MajorGridlineStyle = OxyPlot.LineStyle.Dash, MinorGridlineStyle = OxyPlot.LineStyle.Dot, Position = OxyPlot.Axes.AxisPosition.Left, FontSize = 12, Title = ytitle }); model.LegendFontSize = 11; model.LegendPlacement = OxyPlot.LegendPlacement.Outside; model.LegendOrientation = OxyPlot.LegendOrientation.Vertical; model.LegendPosition = OxyPlot.LegendPosition.BottomCenter; model.TitleHorizontalAlignment = OxyPlot.TitleHorizontalAlignment.CenteredWithinView; model.AddLineSeries(x, y1, ytitle1); model.AddLineSeries(x, y2, ytitle2); return(model); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { OxyPlot.PlotModel plotModel1 = new OxyPlot.PlotModel(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.treeView1 = new System.Windows.Forms.TreeView(); this.plot1 = new OxyPlot.WindowsForms.Plot(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.SuspendLayout(); // // splitContainer1 // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 // this.splitContainer1.Panel1.Controls.Add(this.treeView1); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.plot1); this.splitContainer1.Size = new System.Drawing.Size(943, 554); this.splitContainer1.SplitterDistance = 314; this.splitContainer1.TabIndex = 0; // // treeView1 // this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill; this.treeView1.Location = new System.Drawing.Point(0, 0); this.treeView1.Name = "treeView1"; this.treeView1.Size = new System.Drawing.Size(314, 554); this.treeView1.TabIndex = 1; // // plot1 // this.plot1.Dock = System.Windows.Forms.DockStyle.Fill; this.plot1.KeyboardPanHorizontalStep = 0.1D; this.plot1.KeyboardPanVerticalStep = 0.1D; this.plot1.Location = new System.Drawing.Point(0, 0); plotModel1.Annotations = ((System.Collections.ObjectModel.Collection<OxyPlot.Annotations.Annotation>)(resources.GetObject("plotModel1.Annotations"))); plotModel1.AutoAdjustPlotMargins = true; plotModel1.Axes = ((System.Collections.ObjectModel.Collection<OxyPlot.Axes.Axis>)(resources.GetObject("plotModel1.Axes"))); plotModel1.AxisTierDistance = 4D; plotModel1.Background = null; plotModel1.Culture = null; plotModel1.DefaultColors = ((System.Collections.Generic.IList<OxyPlot.OxyColor>)(resources.GetObject("plotModel1.DefaultColors"))); plotModel1.DefaultFont = "Segoe UI"; plotModel1.DefaultFontSize = 12D; plotModel1.IsLegendVisible = true; plotModel1.LegendBackground = null; plotModel1.LegendBorder = null; plotModel1.LegendBorderThickness = 1D; plotModel1.LegendColumnSpacing = 0D; plotModel1.LegendFont = null; plotModel1.LegendFontSize = 12D; plotModel1.LegendFontWeight = 400D; plotModel1.LegendItemAlignment = OxyPlot.HorizontalAlignment.Left; plotModel1.LegendItemOrder = OxyPlot.LegendItemOrder.Normal; plotModel1.LegendItemSpacing = 24D; plotModel1.LegendMargin = 8D; plotModel1.LegendOrientation = OxyPlot.LegendOrientation.Vertical; plotModel1.LegendPadding = 8D; plotModel1.LegendPlacement = OxyPlot.LegendPlacement.Inside; plotModel1.LegendPosition = OxyPlot.LegendPosition.RightTop; plotModel1.LegendSymbolLength = 16D; plotModel1.LegendSymbolMargin = 4D; plotModel1.LegendSymbolPlacement = OxyPlot.LegendSymbolPlacement.Left; plotModel1.LegendTextColor = null; plotModel1.LegendTitle = null; plotModel1.LegendTitleColor = null; plotModel1.LegendTitleFont = null; plotModel1.LegendTitleFontSize = 12D; plotModel1.LegendTitleFontWeight = 700D; plotModel1.PlotAreaBackground = null; plotModel1.PlotAreaBorderColor = ((OxyPlot.OxyColor)(resources.GetObject("plotModel1.PlotAreaBorderColor"))); plotModel1.PlotAreaBorderThickness = 1D; plotModel1.PlotType = OxyPlot.PlotType.XY; plotModel1.Series = ((System.Collections.ObjectModel.Collection<OxyPlot.Series.Series>)(resources.GetObject("plotModel1.Series"))); plotModel1.Subtitle = null; plotModel1.SubtitleColor = null; plotModel1.SubtitleFont = null; plotModel1.SubtitleFontSize = 14D; plotModel1.SubtitleFontWeight = 400D; plotModel1.TextColor = ((OxyPlot.OxyColor)(resources.GetObject("plotModel1.TextColor"))); plotModel1.Title = null; plotModel1.TitleColor = null; plotModel1.TitleFont = null; plotModel1.TitleFontSize = 18D; plotModel1.TitleFontWeight = 700D; plotModel1.TitlePadding = 6D; this.plot1.Model = plotModel1; this.plot1.Name = "plot1"; this.plot1.PanCursor = System.Windows.Forms.Cursors.Hand; this.plot1.Size = new System.Drawing.Size(625, 554); this.plot1.TabIndex = 0; this.plot1.Text = "plot1"; this.plot1.ZoomHorizontalCursor = System.Windows.Forms.Cursors.SizeWE; this.plot1.ZoomRectangleCursor = System.Windows.Forms.Cursors.SizeNWSE; this.plot1.ZoomVerticalCursor = System.Windows.Forms.Cursors.SizeNS; // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(943, 554); this.Controls.Add(this.splitContainer1); this.Name = "MainForm"; this.Text = "OxyPlot.WindowsForms Example Browser"; this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.ResumeLayout(false); }