ChartDirector 6.3 (C++ Edition)

CChartViewer


CChartViewer is a MFC control that inherits from the MFC CStatic control and from ViewPortManager. It is used in MFC applications for displaying charts images and to handle mouse interactions.

CChartViewer is released in source code format in the MFC sample programs that comes with ChartDirector. The source code serves as an example on how one can display charts and handle mouse interactions in general GUI framework.

Methods
MethodInheritedDescription
setChart(Self)Sets a BaseChart object for display.
getChart(Self)Gets the BaseChart pointer provided by the previous CChartViewer.setChart method call.
setImageMap(Self)Sets the image map that defines the hot spots on the chart image.
getImageMapHandler(Self)Gets the ImageMapHandler object for the current image map.
setDefaultToolTip(Self)Sets the default tool tip to use when the mouse is over the CChartViewer but not over any hot spot.
getToolTipCtrl(Self)Gets the MFC CToolTipCtrl object used by CChartViewer for handling the tool tips.
getChartMouseX(Self)Gets the mouse x-coordinate in the chart pixel coordinate system.
getChartMouseY(Self)Gets the mouse y-coordinate in the chart pixel coordinate system.
getPlotAreaMouseX(Self)Gets the mouse x-coordinate on the plot area in the chart pixel coordinate system.
getPlotAreaMouseY(Self)Gets the mouse y-coordinate on the plot area in the chart pixel coordinate system.
setPlotAreaMouseMargin(Self)Sets all margins (left, right, top, and bottom) of the plot area mouse event region to the same value.
setPlotAreaMouseMargin2(Self)Sets the margins of the plot area mouse event region.
removeDynamicLayer(Self)Calls BaseChart.removeDynamicLayer when the specified event occurs.
updateDisplay(Self)Updates the display.
setMouseUsage(Self)Sets the mouse usage mode.
getMouseUsage(Self)Gets the mouse usage mode.
setZoomDirection(Self)Sets the zoom direction for mouse zoom in/out actions.
getZoomDirection(Self)Gets the zoom direction for mouse zoom in/out actions.
setScrollDirection(Self)Sets the scroll direction for mouse scroll actions.
getScrollDirection(Self)Gets the scroll direction for mouse scroll actions.
setZoomInRatio(Self)Sets the magnification ratio for each zoom in click of the mouse.
getZoomInRatio(Self)Gets the magnification ratio for each zoom in click of the mouse.
setZoomOutRatio(Self)Sets the magnification ratio for each zoom out click of the mouse.
getZoomOutRatio(Self)Gets the magnification ratio for each zoom out click of the mouse.
setMouseWheelZoomRatio(Self)Sets the magnification ratio for each mouse wheel event.
getMouseWheelZoomRatio(Self)Gets the magnification ratio for each mouse wheel event.
setSelectionBorderWidth(Self)Sets the border width of the zoom selection box.
getSelectionBorderWidth(Self)Gets the border width of the zoom selection box.
setSelectionBorderColor(Self)Sets the border color of the zoom selection box as a Win32 COLORREF value.
getSelectionBorderColor(Self)Gets the border color of the zoom selection box.
setMinimumDrag(Self)Sets the minimum mouse drag distance before it is considered as an intentional drag.
getMinimumDrag(Self)Gets the minimum mouse drag distance before it is considered as an intentional drag.
setUpdateInterval(Self)Sets the minimum gap interval between two CVN_ViewPortChanged messages in milliseconds.
getUpdateInterval(Self)Gets the minimum gap interval between two CVN_ViewPortChanged messages in milliseconds.
updateViewPort(Self)Triggers the CVN_ViewPortChanged message.
needUpdateChart(Self)Determines if the current CVN_ViewPortChanged message requires chart update.
needUpdateImageMap(Self)Determines if the current CVN_ViewPortChanged message requires image map update.
isMouseOnPlotArea(Self)Checks if the mouse cursor is on the extended plot area.
isMouseDragging(Self)Checks if the mouse is dragging on the plot area.
isInMouseMoveEvent(Self)Checks if the current code is executing in a MouseMoveChart or MouseMovePlotArea event.
isInViewPortChangedEvent(Self)Checks if the current code is executing in a ViewPortChanged event.
setChartMetricsViewPortManagerSets the chart metrics to the ViewPortManager so it knows the positions of the necessary chart objects for supporting viewports.
getPlotAreaLeftViewPortManagerGets the x-coordinate of the left side of the plot area in pixels.
getPlotAreaTopViewPortManagerGets the y-coordinate of the top side of the plot area in pixels.
getPlotAreaWidthViewPortManagerGets the width of the plot area in pixels.
getPlotAreaHeightViewPortManagerGets the height of the plot area in pixels.
inPlotAreaViewPortManagerDetermines if a given point is within the plot area.
setViewPortLeftViewPortManagerSets the position of the left side of the viewport.
getViewPortLeftViewPortManagerGets the position of the left side of the viewport.
setViewPortTopViewPortManagerSets the position of the top side of the viewport.
getViewPortTopViewPortManagerGets the position of the top side of the viewport.
setViewPortWidthViewPortManagerSets the width of the viewport.
getViewPortWidthViewPortManagerGets the width of the viewport.
setViewPortHeightViewPortManagerSets the height of the viewport.
getViewPortHeightViewPortManagerGets the height of the viewport.
validateViewPortViewPortManagerEnsures the viewport left, top, width and height are within valid ranges and adjusts them if necessary.
setZoomInWidthLimitViewPortManagerSets the viewport width at maximum zoom in.
getZoomInWidthLimitViewPortManagerGets the viewport width at maximum zoom in for mouse zoom in actions.
setZoomOutWidthLimitViewPortManagerSets the viewport width at maximum zoom out.
getZoomOutWidthLimitViewPortManagerGets the viewport width at maximum zoom out for mouse zoom out actions.
setZoomInHeightLimitViewPortManagerSets the viewport height at maximum zoom in.
getZoomInHeightLimitViewPortManagerGets the viewport height at maximum zoom in for mouse zoom in actions.
setZoomOutHeightLimitViewPortManagerSets the viewport height at maximum zoom out.
getZoomOutHeightLimitViewPortManagerGets the viewport height at maximum zoom out for mouse zoom out actions.
canZoomInViewPortManagerChecks if it is possible to zoom in further at a certain direction without violating zoom in limits.
canZoomOutViewPortManagerChecks if it is possible to zoom out further at a certain direction without violating zoom out limits.
zoomAtViewPortManagerZooms at a certain point.
zoomAroundViewPortManagerZooms around a certain point.
zoomToViewPortManagerZooms to the selected rectangular region.
startDragViewPortManagerTakes a snapshot of the viewport to prepare for dragging. This method must be called before calling ViewPortManager.dragTo.
dragToViewPortManagerScrolls the viewport to reflect dragging of the underlying rectangular surface.
setFullRangeViewPortManagerDefines the full range of a viewport data scale.
updateFullRangeHViewPortManagerUpdates the full range of a horizontal viewport data scale.
updateFullRangeVViewPortManagerUpdates the full range of a vertical viewport data scale.
getValueAtViewPortViewPortManagerConverts a viewport coordinate to a value of the specified data scale.
getViewPortAtValueViewPortManagerConverts a value of the specified data scale to a viewport coordinate.
syncLinearAxisWithViewPortViewPortManagerSynchronizes a linear Axis with the part of the data scale in viewport.
syncLogAxisWithViewPortViewPortManagerSynchronizes a logarithmic Axis with the part of the data scale in viewport.
syncDateAxisWithViewPortViewPortManagerSynchronizes a date/time Axis with the part of the data scale in viewport.
Note: Methods inherited from CStatic are omitted.

Events
MethodInheritedDescription
BN_CLICKED(Self)This is a standard windows notification code that is sent to the parent window through the WM_COMMAND message when the CChartViewer control is clicked.
CVN_MouseMoveChart(Self)This is a windows notification code that is sent to the parent window through the WM_COMMAND message when the mouse moves over the CChartViewer control.
CVN_MouseLeaveChart(Self)This is a windows notification code that is sent to the parent window through the WM_COMMAND message when the mouse leaves the CChartViewer control.
CVN_MouseMovePlotArea(Self)This is a windows notification code that is sent to the parent window through the WM_COMMAND message when the mouse moves over the extended plot area.
CVN_MouseLeavePlotArea(Self)This is a windows notification code that is sent to the parent window through the WM_COMMAND message when the mouse leaves the extended plot area.
CVN_ViewPortChanged(Self)This is a windows notification code that is sent to the parent window through the WM_COMMAND message when the viewport is changed through mouse actions, or when CChartViewer.updateViewPort is called.
Note: Events inherited from CStatic are omitted.