SetExtent Method

Microsoft Office Web Components Visual Basic

SetExtent Method

You use the SetExtent method to to specify the view extent of the ChScrollView object of a Chart component. Returns Nothing.

expression.SetExtent(HorizontalExtent, VerticalExtent)

expression    Required. An expression that returns a ChScrollView object.

HorizontalExtent   Required Long.

VerticalExtent   Required Long.

Remarks

Using this method to specify the current scroll view position has the same effect as setting the HorizontalExtent and VerticalExtent properties individually. If you use the SetExtent method rather than the HorizontalExtent and VerticalExtent properties individually, however, less repainting will occur.

You use methods and properties of the ChScrollView object to retrieve information about and control the view of a chart. The portion of the Chart component that displays the chart itself is the visible plot area and it can display the entire chart or a portion of the chart. When only a portion of the chart is displayed in the visible plot area, the effect is as if you have zoomed in on that portion of the chart and the remainder of the chart is contained within a virtual plot area that extends beyond the boundary of the visible plot area. For information on how the values of the properties of the ChScrollView object relate to each other, see the ChScrollView object topic.

The VerticalPosition and HorizontalPosition properties describe the upper-left corner of the visible plot area. The VerticalExtent and HorizontalExtent properties describe the lower-right corner of the visible plot area. Because you will frequently work with these properties together, you can use SetPosition method to specify the upper-left corner of the visible plot area and the SetExtent method to specify the lower-right corner.

Example

The following example uses the SetExtent method to set the vertical and horizontal extent of the scroll view of a chart to zoom by 200 percent.

    Dim lngHMax
Dim lngVMax

lngHMax = ChartSpace1.Charts(0).ScrollView.HorizontalExtentMax * 2
lngVMax = ChartSpace1.Charts(0).ScrollView.VerticalExtentMax * 2

ChartSpace1.Charts(0).ScrollView.SetExtent lngHMax, lngVMax