-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
BUGunexpected behaviorunexpected behavior
Description
Bug Report
Issue: After calling Reset() method, BackColor is no longer set. Example code is provided below.
System Details
- ScottPlot Version: 4.1.61
- Operating System: Windows 11
- Application Type: WinForms
- .NET Version: .NET 7.0
Imports ScottPlot
Public Class Form1
Public Sub New()
InitializeComponent()
'' IF RESET IS COMMENTED OUT, BACKCOLOR IS SET CORRECTLY
FormsPlot1.Reset()
FormsPlot1.BackColor = Color.LightGray
'' Prepare separate Y axes
FormsPlot1.Plot.YAxis.Color(Color.Magenta)
Dim yAxis1 = FormsPlot1.Plot.YAxis
Dim yAxis2 = FormsPlot1.Plot.AddAxis(ScottPlot.Renderable.Edge.Left, 2, "", Color.Navy)
Dim yAxis3 = FormsPlot1.Plot.AddAxis(ScottPlot.Renderable.Edge.Left, 3, "", Color.Green)
'' Create data and add it to the plot
Dim rand = New Random(0)
Dim data1 As Double() = DataGen.RandomWalk(rand, 100, mult:=1)
Dim data2 As Double() = DataGen.RandomWalk(rand, 100, mult:=10)
Dim data3 As Double() = DataGen.RandomWalk(rand, 100, mult:=100)
Dim avg1 As Double = data1.Sum() / data1.Length
Dim avg2 As Double = data2.Sum() / data2.Length
Dim avg3 As Double = data3.Sum() / data3.Length
Dim plt1 = FormsPlot1.Plot.AddSignal(data1)
plt1.YAxisIndex = 0
plt1.LineWidth = 3
plt1.Color = Color.Magenta
Dim plt2 = FormsPlot1.Plot.AddSignal(data2)
plt2.YAxisIndex = 3
plt2.LineWidth = 3
plt2.Color = Color.Green
Dim plt3 = FormsPlot1.Plot.AddSignal(data3)
plt3.YAxisIndex = 2
plt3.LineWidth = 3
plt3.Color = Color.Navy
'' Add draggable horizontal lines specifying the vertical axis index for each
Dim hline1 = FormsPlot1.Plot.AddHorizontalLine(avg1)
hline1.DragEnabled = True
hline1.Color = plt1.Color
hline1.LineStyle = LineStyle.Dash
hline1.YAxisIndex = 0
hline1.PositionLabelBackground = plt1.Color
hline1.PositionFormatter = Function(ByVal position As Double) position.ToString("N0")
hline1.PositionLabel = True
hline1.PositionLabelAxis = yAxis1
Dim hline2 = FormsPlot1.Plot.AddHorizontalLine(avg3)
hline2.DragEnabled = True
hline2.Color = plt3.Color
hline2.LineStyle = LineStyle.Dash
hline2.YAxisIndex = 2
hline2.PositionLabelBackground = plt3.Color
hline2.PositionFormatter = Function(ByVal position As Double) position.ToString("N0")
hline2.PositionLabel = True
hline2.PositionLabelAxis = yAxis2
Dim hline3 = FormsPlot1.Plot.AddHorizontalLine(avg2)
hline3.DragEnabled = True
hline3.Color = plt2.Color
hline3.LineStyle = LineStyle.Dash
hline3.YAxisIndex = 3
hline3.PositionLabelBackground = plt2.Color
hline3.PositionFormatter = Function(ByVal position As Double) position.ToString("N0")
hline3.PositionLabel = True
hline3.PositionLabelAxis = yAxis3
'' update the plot
FormsPlot1.Plot.AxisAuto()
FormsPlot1.Refresh()
End Sub
End ClassReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BUGunexpected behaviorunexpected behavior