I think that you can do what you want by creating two plots - one for the annotation and one for the data. Make sure that the plot for the annotation is before the data plot in the plots collection so that the annotation will appear under your data. For example, create a new VB project, add a graph and a button to the form, double-click the button, and add the following code:
Private Sub Command1_Click()
Dim annotation As CWAnnotation
Set annotation = CWGraph1.Annotations.Add
annotation.plot = CWGraph1.Plots(1)
annotation.Caption = ""
annotation.Arrow.HeadStyle = cwArrowHeadNone
annotation.Arrow.LineStyle = cwLineNone
annotation.Shape.Type = cwShapeMinMaxRegion
D
im xCoordinates(1) As Double
Dim yCoordinates(1) As Double
xCoordinates(0) = 2
xCoordinates(1) = 8
yCoordinates(0) = 2
yCoordinates(1) = 8
annotation.Shape.xCoordinates = xCoordinates
annotation.Shape.yCoordinates = yCoordinates
annotation.Shape.FillVisible = True
annotation.Shape.Color = RGB(255, 0, 0)
Dim plot As CWPlot
Set plot = CWGraph1.Plots.Add
Dim data(10) As Double
Dim i As Integer
For i = 0 To 10
data(i) = Rnd * 10
Next
plot.PlotY data
End Sub
When you run this code you'll see a red colored region whose x coordinates goes from 2 to 8 and whose y coordinates also goes from 2 to 8. You'll see a plot of random data whose x coordinates goes from 0 to 10 and whose y coordinates also go from 0 to 10. The plot of data will appear over the annotation.
Plea
se try this and post how it worked out. Thanks.
- Elton