here is another test. it also fails.
1. given class scope variable:
Private localPlot1 As SimpleScatterPlot
i added the following method to UserChartControl1 class:
Public Sub setDataSet4() Dim numPoints As Integer = 24 Dim x1(numPoints - 1) As Double Dim y4(numPoints - 1) As Double
Dim i As Integer
For i = 0 To numPoints - 1 x1(i) = CDbl(i) / (numPoints) y4(i) = x1(i) - 0.1 + 0.8 * ChartSupport.GetRandomDouble() - 0.15 Next
Dim Dataset4 As New SimpleDataset("Fourth", x1, y4)
localPlot1.SetDataset(Dataset4)
End Sub
2. In InitializeChart() i set localPlot1 as follows:
....
Dim thePlot1 As New SimpleScatterPlot(pTransform1, Dataset2, ChartObj.CROSS, attrib1)
localPlot1 = thePlot1
3. NOTE: at this point i can call
setDataSet4()
in the sub IntitializeChart and it works fine
4. but the call from Form1 fails:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
(BP) Me.UserChartControl11.setDataSet4() Me.UserChartControl11.UpdateDraw End Sub
Exception: Object reference not set to instance of object
5. using the debugger i break at (BP) and step into SetDataSet4: using QuickWatch i look at localPlot1 and it looks ok
6. the call in SetDataSet fails at
localPlot1.SetDataset(Dataset4)
conclusion: mysterious. i need to solve this today.
bill clarke |