The following example runs a simulation with 10,000 trials and then performs the described operations to define and open a scatter chart.
CB.Simulation 10000 ' The next command removes all variables from a chart CB.ScatterPrefsND cbScatterManageFore, cbScatterRemoveAllVars ' The next command adds forecast from D7 to the scatter chart as a target Range("D7").Select CB.ScatterPrefsND cbScatterManageFore, cbScatterAddSelectedVar CB.ScatterPrefsND cbScatterSetTarget, True ' The next commands add assumptions D4 through D6 to the scatter chart Range("D4").Select CB.ScatterPrefsND cbScatterManageAssum, cbScatterAddSelectedVar Range("D5").Select CB.ScatterPrefsND cbScatterManageAssum, cbScatterAddSelectedVar Range("D6").Select CB.ScatterPrefsND cbScatterManageAssum, cbScatterAddSelectedVar ' The next command sets the scatter chart title CB.ScatterPrefsND cbScatterTitle, "Piston Displacement Scatter View" ' The next command makes sure the scatter chart is in Scatter view CB.ScatterPrefsND cbScatterViewType, cbScatterView ' The next command sets minimal plot size (valid range is 1-10) CB.ScatterPrefsND cbScatterPlotSize, 1 ' The next command sets Criteria Limit to Auto ' (displays number of plots appropriate to plot size) CB.ScatterPrefsND cbScatterCriteriaLimit, cbScatterLimitAuto ' The next commands specify properties of the plot points (triangle, ' size = 4, color = light green) CB.ScatterPrefsND cbScatterDrawPoints, True CB.ScatterPrefsND cbScatterPointSymbol, cbScatterPointSymbolTriangle CB.ScatterPrefsND cbScatterPointSize, 4 CB.ScatterPrefsND cbScatterPointColor, 2 ' The next commands draw a linear regression line on top of points ' (width = 2, color= purple) CB.ScatterPrefsND cbScatterDrawLines, True CB.ScatterPrefsND cbScatterLineType, cbScatterRegression CB.ScatterPrefsND cbScatterLineWidth, 2 CB.ScatterPrefsND cbScatterLineColor, 5 ' The next commands draw the correlation coefficient in each plot, ' but do not show the regression properties CB.ScatterPrefsND cbScatterDrawCorrelationCoefficient, True CB.ScatterPrefsND cbScatterShowLinearRegressionCoefficients, False ' The next command opens the chart CB.OpenChart cbChtScatter