public void AddPointPlot( IEnumerable <TX> xSeries, XAxisPosition xpos, IEnumerable <TY> ySeries, YAxisPosition ypos, MarkerType _markerType, int MarkerSize, Color MarkerColor, bool MarkerFilled, bool ShowLabelInLegend) { NPlot.PointPlot plot = new NPlot.PointPlot(); plot.AbscissaData = xSeries; plot.OrdinateData = ySeries; plot.Marker = new NPlot.Marker(ToNPlotMarkerType(_markerType), MarkerSize, MarkerColor); plot.ShowInLegend = ShowLabelInLegend; MyPlot my = new MyPlot(); my.plot = plot; my.XAxisPosition = xpos == XAxisPosition.Bottom ? NPlot.PlotSurface2D.XAxisPosition.Bottom : NPlot.PlotSurface2D.XAxisPosition.Top; my.YAxisPosition = ypos == YAxisPosition.Left ? NPlot.PlotSurface2D.YAxisPosition.Left : NPlot.PlotSurface2D.YAxisPosition.Right; plots.Add(my); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.DefaultExt = ".png"; dlg.Filter = "PNG files (.png)|*.png"; if (dlg.ShowDialog() == true) { MyPlot.SaveBitmap(dlg.FileName); MessageBox.Show("Chart saved"); } }
private void MenuItem_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "IsobaricAnalyzerChart"; dlg.DefaultExt = ".png"; dlg.Filter = "PNG files (.png)|*.png"; if (dlg.ShowDialog() == true) { MyPlot.SaveBitmap(dlg.FileName); Console.WriteLine("Chart saved"); } }
private void ComputeResponse() { var crossFr = CrossFreqSlider.Value; var crossLen = Convert.ToInt32(CrossLengthFreqSlider.Value); var npoles1 = Convert.ToInt32(NPolesLowSlider.Value); var npoles2 = Convert.ToInt32(NPolesHighSlider.Value); var lambda1 = LambdaLowSlider.Value; var lambda2 = LambdaHighSlider.Value; if (target != null) { Array.Resize(ref filter, target.Length); int size = target.Length; ParFiltDesign.computeResponse(filter, W, target, out size, npoles1, npoles2, crossFr, crossLen, lambda1, lambda2, Fs, NFIR, useNAK); MyPlot.AddToPlotdB(fr, filter, "filter", 1); } }
private async void Button_Click_1(object sender, RoutedEventArgs e) { var instances = InputReader.ReadKnapsackInstances(InputFile.Text); IList <KnapsackInstance> instancesToSolve; if ((bool)RandomInstance.IsChecked) { Random random = new Random(); instancesToSolve = new List <KnapsackInstance>(); instancesToSolve.Add(instances.ElementAt(random.Next(instances.Count))); } else { instancesToSolve = instances; } var results = await SolveInstances(instancesToSolve, true); MyPlot.Model.Series.Clear(); var solutionInfoBuilder = new StringBuilder(); foreach (var result in results) { solutionInfoBuilder.AppendLine($"----INSTANCE NO.{result.KnapsackInstance.Id}------"); solutionInfoBuilder.AppendLine($"Epsilon: {result.Epsilon}"); solutionInfoBuilder.AppendLine($"Time [ms]: {result.RunTimeMs}"); solutionInfoBuilder.AppendLine($"Actual price: {result.Configuration.Price}"); solutionInfoBuilder.AppendLine($"Optimal price: {result.OptimalConfiguration.Price}"); solutionInfoBuilder.AppendLine($"Actual vector: {string.Join(",", result.Configuration.ItemVector.Select(i => i ? 1 : 0))}"); solutionInfoBuilder.AppendLine($"Solution vector: {string.Join(",", result.OptimalConfiguration.ItemVector.Select(i => i ? 1 : 0))}"); var series = new LineSeries { ItemsSource = result.MovesHistory }; MyPlot.Model.Series.Add(series); } MyPlot.Model.DefaultXAxis.Title = "Number of steps"; MyPlot.Model.DefaultYAxis.Title = "Value of optimalization criterion"; SolutionInfo.Text = solutionInfoBuilder.ToString(); MyPlot.InvalidatePlot(); }
private void LoadResponse(object sender, RoutedEventArgs e) { int size = 1600; double[] w = new double[size]; double[] H = new double[size]; bool result = false; if (ItemSelected == null) { return; } do { string ff = FilePath + "\\" + ItemSelected; result = ParFiltDesign.loadResponse(w, H, out size, FilePath + "\\" + ItemSelected); if (!result) { if (size < 0) //error occured { return; } w = new double[size]; H = new double[size]; } } while (!result); Array.Resize(ref w, size); //shortens the output to correct length Array.Resize(ref H, size); //shortens the output to correct length fr = w.Select(r => r * Fs / (2 * Math.PI)).ToArray(); MyPlot.AddToPlotdB(fr, H, "Target", 0); target = H; W = w; }
// Zu plotende Funktionen definieren public void AddLinePlot( IEnumerable <TX> xSeries, XAxisPosition xpos, IEnumerable <TY> ySeries, YAxisPosition ypos, Color _color, string Label, bool ShowLabelInLegend) { NPlot.LinePlot plot = new NPlot.LinePlot(ySeries, xSeries); plot.ShowInLegend = ShowLabelInLegend; plot.Label = Label; plot.Color = _color; MyPlot my = new MyPlot(); my.plot = plot; my.XAxisPosition = xpos == XAxisPosition.Bottom ? NPlot.PlotSurface2D.XAxisPosition.Bottom : NPlot.PlotSurface2D.XAxisPosition.Top; my.YAxisPosition = ypos == YAxisPosition.Left ? NPlot.PlotSurface2D.YAxisPosition.Left : NPlot.PlotSurface2D.YAxisPosition.Right; plots.Add(my); }