ChScrollView Object
Using the ChScrollView Object
You use methods and properties of the ChScrollView object to retrieve information and to control the scroll view of a chart.
You use the the ScrollView property of the ChChart object to retrieve the ChScrollView object of the chart (one per chart.) This object is the primary interface that allows applications to retrieve information and control the scroll view. The ChScrollView object has several properties that you can use to specify and determine the scroll view of the chart.
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.
The VerticalPosition and HorizontalPosition properties shift the scroll view vertically and horizontally. The initial values of these properties are treated as the location (0, 0), and are relative to the values of the Left and Top properties of the actual plot area (the ChPlotArea object). The incremental shift in the position of the scroll view is relative to the ratio of the VerticalExtent and VerticalExtentMax properties, and to the ratio of the HorizontalExtent and HorizontalExtentMax properties.
The ratio of the VerticalExtent and VerticalExtentMax properties describes the position of the scroll view area’s vertical dimension relative to the actual plot area’s vertical dimension. The ratio of the HorizontalExtent and HorizontalExtentMax properties value describes the position of the scroll view area’s horizontal dimension relative to the actual plot area’s horizontal dimension.
You can zoom the display of the chart in or out by setting the VerticalExtentMax and HorizontalExtentMax properties to values greater or less than the VerticalExtent and HorizontalExtent properties, respectively. For example, to zoom the chart by 200%, set the VerticalExtentMax and HorizontalExtentMax properties to twice the value of the VerticalExtent and HorizontalExtent properties.
Whether the chart is zoomed or not, you can access the scroll view’s dimensions by using the Top, Left, Right, and Bottom properties of the ChScrollView object. And, you can access the actual plot area’s dimensions by using the Top, Left, Right, and Bottom properties of the ChPlotArea object.
If the value of either the HorizontalExtent or the HorizontalExtentMax property is less than or equal to zero (0), the scroll view is disabled and a chart cannot be scrolled horizontally. Similarly, a chart cannot be scrolled vertically if the value of either the VerticalExtentMax or the VerticalExtent property is less than or equal to zero.
You can also change the scroll position and scroll extent using the SetPosition and SetExtent methods of the Chart component. Using the SetPosition and SetExtent methods is the same as setting the individual HorizontalExtent, VerticalExtent, HorizontalPosition, and VerticalPosition properties, but these methods allow you to set multiple properties at the same time to reduce the number of times the chart is repainted.