private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var style = (ScottPlot.Styles.IStyle)ListBoxStyle.SelectedItem; var palette = (ScottPlot.IPalette)ListBoxPalette.SelectedItem; if (style is null || palette is null) { return; } WpfPlot1.Plot.Style(style); WpfPlot1.Plot.Title($"Style: {style}\nPalette: {palette}"); WpfPlot1.Plot.Palette = palette; WpfPlot1.Plot.Clear(); for (int i = 0; i < palette.Count(); i++) { double offset = 1 + i * 1.1; double mult = 10 + i; double phase = i * .3 / palette.Count(); double[] ys = DataGen.Sin(51, 1, offset, mult, phase); var sig = WpfPlot1.Plot.AddSignal(ys); sig.LineWidth = 3; sig.MarkerSize = 0; } WpfPlot1.Plot.AxisAuto(horizontalMargin: 0); WpfPlot1.Refresh(); }
public MainWindow() { InitializeComponent(); WpfPlot1.Plot.AddSignal(ScottPlot.DataGen.Sin(51)); WpfPlot1.Plot.AddSignal(ScottPlot.DataGen.Cos(51)); WpfPlot1.Refresh(); }
public MultiAxisLock() { InitializeComponent(); PrimaryCheckbox.DataContext = this; SecondaryCheckbox.DataContext = this; TertiaryCheckbox.DataContext = this; Random rand = new Random(); // Add 3 signals each with a different vertical axis index. // Each signal defaults to X axis index 0 so their horizontal axis will be shared. var plt1 = WpfPlot1.Plot.AddSignal(DataGen.RandomWalk(rand, 100, mult: 1)); plt1.YAxisIndex = 0; plt1.LineWidth = 3; plt1.Color = System.Drawing.Color.Magenta; var plt2 = WpfPlot1.Plot.AddSignal(DataGen.RandomWalk(rand, 100, mult: 10)); plt2.YAxisIndex = 1; plt2.LineWidth = 3; plt2.Color = System.Drawing.Color.Green; var plt3 = WpfPlot1.Plot.AddSignal(DataGen.RandomWalk(rand, 100, mult: 100)); plt3.YAxisIndex = 2; plt3.LineWidth = 3; plt3.Color = System.Drawing.Color.Navy; // The horizontal axis is shared by these signal plots (XAxisIndex defaults to 0) WpfPlot1.Plot.XAxis.Label("Horizontal Axis"); // Customize the primary (left) and secondary (right) axes WpfPlot1.Plot.YAxis.Color(System.Drawing.Color.Magenta); WpfPlot1.Plot.YAxis.Label("Primary Axis"); WpfPlot1.Plot.YAxis2.Color(System.Drawing.Color.Green); WpfPlot1.Plot.YAxis2.Label("Secondary Axis"); // the secondary (right) axis ticks are hidden by default so enable them WpfPlot1.Plot.YAxis2.Ticks(true); // Create an additional vertical axis and customize it YAxis3 = WpfPlot1.Plot.AddAxis(Renderable.Edge.Left, 2); YAxis3.Color(System.Drawing.Color.Navy); YAxis3.Label("Tertiary Axis"); // adjust axis limits to fit the data once before locking them WpfPlot1.Plot.AxisAuto(); WpfPlot1.Refresh(); CheckChanged(null, null); }
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) { if (WpfPlot1 is null) { return; } WpfPlot1.Configuration.DpiStretch = false; WpfPlot1.Plot.Title( $"System Scaling: {Drawing.GDI.GetScaleRatio() * 100}%\n" + $"DPI Stretch Ratio: {WpfPlot1.Configuration.DpiStretchRatio}"); WpfPlot1.Refresh(); }