Example 4: Computing Other Statistics or Graphs for Each Chart Update

Example 1 illustrates how to set up the basic connection between a custom event handler and the chart. Shown below is the code for a custom event handler that will create a scatterplot (using the standard automation method; see also Recording Macros) every time when the chart is updated.

Private Sub SourceObj_OnUpdate(ByVal Obj As Object, _

ByVal SampleIDFrom As String, _

ByVal PartIDFrom As String, _

ByVal SampleIDTo As String, _

ByVal PartIDTo As String)

Dim newanalysis As Analysis

' Here we create a standard scatterplot; this code was created

' via the standard macro recording facilities of STATISTICA.

Set newanalysis = Analysis (sc2dScatterplots, ActiveDataSet)

newanalysis.Dialog.Variables = "2 | 1"

newanalysis.RouteOutput(newanalysis.Dialog.Graphs).Visible = True

End Sub

As this example illustrates, all STATISTICA analysis procedures can be called directly from the event handlers. Hence, the complete functionality of STATISTICA's analytic facilities is available to augment the quality control charting analysis (e.g., you can run regression, various non-parametric tests, etc. every time that the data change).