ChartDirector 7.0 (Java Edition)

ViewPortControl


The ViewPortControl is a SWING control to let the user visualize and manipulate the viewport managed by the ChartViewer. It is a subclass of the JLabel control.

In typical usage, the ViewPortControl displays an "overall chart" that shows the full data range, and connects to the ChartViewer using ViewPortControl.setViewer. It can then include a rectangle on the overall chart to represent the viewport in the ChartViewer. The region outside the rectangle can be dimmed out to highlight the viewport region. If the viewport is changed (such as if the user uses the mouse wheel to zoom in the chart), the rectangle will update automatically.

To manipulate the viewport, the user can drag the rectangle to move the viewport (equivalent to scrolling). The user can also resize the viewport by dragging the border of the rectangle (equivalent to zooming), or drag a new rectangular region on the overall chart to be used as the new viewport, or click on a point on the chart to center the viewport at that point.

MethodInheritedDescription
setChart(Self)Sets a BaseChart object for displaying in the control. The chart usually is an overall chart that includes the full data range.
getChart(Self)Gets the BaseChart object provided by the previous ViewPortControl.setChart method call.
setViewer(Self)Associates a ChartViewer object with this ViewPortControl object.
getViewer(Self)Gets the ChartViewer object provided by the previous ViewPortControl.setViewer method call.
setDragInsideToMove(Self)Enables or disables dragging inside the viewport to move it.
getDragInsideToMove(Self)Checks if dragging inside the viewport to move it is enabled or disabled.
setDragBorderToResize(Self)Enables or disables dragging the viewport border to resize it.
getDragBorderToResize(Self)Checks if dragging the viewport border to resize it is enabled or disabled.
setDragOutsideToSelect(Self)Enables or disables dragging outside the viewport to select a new viewport.
getDragOutsideToSelect(Self)Checks if dragging outside the viewport to select a new viewport is enabled or disabled.
setClickToCenter(Self)Enables or disables centering the viewport at the clicked point.
getClickToCenter(Self)Checks if centering the viewport at the clicked point is enabled or disabled.
setViewPortExternalColor(Self)Sets the fill color for the region outside the viewport.
getViewPortExternalColor(Self)Gets the fill color for the region outside the viewport.
setViewPortBorderColor(Self)Sets the viewport border color.
getViewPortBorderColor(Self)Gets the viewport border color.
setViewPortBorderWidth(Self)Sets the viewport border width.
getViewPortBorderWidth(Self)Gets the viewport border width.
setViewPortFillColor(Self)Sets the fill color for the region inside the viewport.
getViewPortFillColor(Self)Gets the fill color for the region inside the viewport.
setSelectionBorderColor(Self)Sets the border color of the selection box.
getSelectionBorderColor(Self)Gets the border color of the selection box.
setSelectionBorderWidth(Self)Sets the border width of the selection box.
getSelectionBorderWidth(Self)Gets the border width of the selection box.
setCursor(Self)Sets the mouse cursors to be used at various parts of the control.
setMouseMargin(Self)Sets the margin around the viewport border for mouse drag.
updateDisplay(Self)Updates the display.
Note: Methods inherited from JLabel are omitted.