CNiGraph

CNi

Class CNiGraph Base ClassesData ItemsConstructorsDestructorsFunctionsGo to hierarchy chart    Prev page: ValidateControlNext page: Annotations    
Class Declared in:
NiGraph.h

'Overview' icon -- Shortcut to top of page. Overview

CNiGraph encapsulates the interface to the Measurement Studio ActiveX graph control, which allows you to plot and chart two-dimensional data.

CNiGraph is capable of responding to events that are generated by the control. For a list of the events that can be generated by this control and details on how to respond to the events in your program, refer to the Graph Events page.

Features

  • Plotting and Charting - plotting data refers to the process of taking a large number of points and updating one or more plots on the graph with new data, replacing the old plot with the new plot. Charting data appends new data points to an existing plot over time. Charting is used with slow processes where only few data points per second are added to the graph. When the number of data points exceeds the number of points that can be displayed on the graph, the graph scrolls so that new points are added to the right side of the graph while old points disappear to the left.
  • Multiple plot styles - point, line, line-point, and bar.
  • Multiple plots with individual properties such as name, line and point style, width, and base value.
  • Cursors - display a crosshair on a graph to mark a specific point or region on the graph or highlight data.
  • Configurable axes, including customizable ticks, labels, value pairs, and captions.
  • Built-in format styles for labels, including scientific, symbolic engineering, scaling, time, and date.
  • Panning and zooming at runtime - panning is useful when the graph displays only a subset of the data that has been plotted. You can scroll through all data plotted on the graph, essentially shifting the graph's display to different portions of the plot.

Note: Set the TrackMode property to allow user interaction (such as panning, zooming, moving cursors, and moving annotations) with the graph while your program is running.

  • CNiGraph includes bindable properties. You can bind these properties to a DataSocket source or target. This allows you to read property values from and write property values to the source or target. Click here for a list of bindable properties.

Note: To specify a date/time value, you must convert your date or time value to a double. A date is implemented as a floating-point value with the integer part of the number measuring days from midnight, 30 December 1899, and the fractional part representing the time of day. The absolute value of the fractional part of the number represents the time as a fraction of a day. Thus, 1 second equals 1 / 24 hours / 60 minutes, which is 1/86400 or approximately 1.157407e-5. So, midnight, 31 December 1899, is represented by 1.0. Similarly, 6 AM, 1 January 1900, is represented by 2.25, and midnight, 29 December 1899, is -1.0. However, 6 AM, 29 December 1899, is -1.25.

Hierarchy Chart Hierarchy Chart

'Base Classes' icon -- Shortcut to top of page. Base Classes

'Data Items' icon -- Shortcut to top of page. Data Items

Public data CNiAnnotations Annotations Gets a collection of annotation objects associated with the control.
Public data CNiAnnotation AnnotationTemplate Returns the annotation to use as a template for new annotations.
Public data CNiAxes Axes Gets a collection of axis objects associated with the control.
Public data CNiColor BackColor Specifies the color for the graph caption's background.
Public data CNiBindings Bindings Gets a collection of binding objects associated with the control.
Public data CString Caption Specifies the caption to be drawn on the CNiGraph.
Public data CNiColor CaptionColor Specifies the color of the caption.
Public data long ChartLength Specifies how many points the graph stores when charting before deleting old data.
Public data ChartStyles ChartStyle Specifies how chart functions update the display as new data is added to the plot.
Public data CNiCursors Cursors Gets a collection of cursor objects associated with the control.
Public data bool DefaultPlotPerRow This is the default value used by the overloaded versions of the Plot/Chart functions that do not take the plotPerRow parameter.
Public data double DefaultXFirst This is the default value used by the overloaded versions of the PlotY functions that do not take the xFirst parameter.
Public data double DefaultXInc This is the default value used by the overloaded versions of the PlotY and ChartY functions that do not take the xInc parameter.
Public data bool Enabled Specifies if the graph generates any events.
Public data CNiFont Font Specifies the font for labels on all axes.
Public data CNiColor GraphFrameColor Specifies the color for the graph frame.
Public data GraphFrameStyles GraphFrameStyle Determines if the graph has a 3D frame or a classic frame.
Public data bool ImmediateUpdates Specifies if the graph draws new data as soon as it is available.
Public data KeyboardModes KeyboardMode Specifies how the control handles keyboard input from the user.
Public data CNiColor PlotAreaColor Specifies the background color of the plot area.
Public data CNiPlots Plots Gets a collection of plot objects associated with the control.
Public data CNiPlot PlotTemplate Returns the plot to use as a template for new plots.
Public data long ReadyState Returns the ready state of the control.
Public data GraphTrackModes TrackMode Determines how the mouse interacts with the graph.
Public data bool Windowless Specifies if the control has a window.

'Constructors' icon -- Shortcut to top of page. Constructors

Protected constructor

CNiGraph( CNiInterface::ThreadAccess option = CNiInterface::MultipleThreadsWithCaching )

'Destructors' icon -- Shortcut to top of page. Destructors

Protected destructor

~CNiGraph()

'Functions' icon -- Shortcut to top of page. Functions

Public function void

AboutBox()

Displays the About Box for the control.
Public function void

ChartXvsY( const CNiVector& x, const CNiMatrix& y, bool chartPerRow )

Charts a matrix of data as one or more x-y plots.
Public function void

ChartXvsY( const CNiVector& x, const CNiMatrix& y )

Charts a matrix of data as one or more x-y plots.
Public function void

ChartXvsY( const CNiVector& x, const CNiVector& y )

Charts two vectors of data as a single x-y plot.
Public function void

ChartXY( const CNiMatrix& xy, bool chartPerRow )

Charts a matrix of data as one or more x-y plots.
Public function void

ChartXY( const CNiMatrix& xy )

Charts a matrix of data as one or more x-y plots.
Public function void

ChartXY( double x, double y )

Charts a single point of data as one x-y plot.
Public function void

ChartY( const CNiMatrix& y, double xInc, bool chartPerRow )

Charts a matrix of data as one or more y plots.
Public function void

ChartY( const CNiMatrix& y, bool chartPerRow )

Charts a matrix of data as one or more y plots.
Public function void

ChartY( const CNiMatrix& y )

Charts a matrix of data as one or more y plots.
Public function void

ChartY( const CNiVector& y, double xInc )

Charts a vector of data.
Public function void

ChartY( const CNiVector& y )

Charts a vector of data.
Public function void

ChartY( double y, double xInc )

Charts a point of data.
Public function void

ChartY( double y )

Charts a point of data.
Public function void

ClearData()

Clears data in all plots.
Public function CNiPicture

ControlImage()

Returns an image of the entire control.
Protected function virtual BOOL

Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL )

Creates the ActiveX control that is represented in the MFC program by this object.
Protected function BOOL

Create( LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL )

Creates the ActiveX control that is represented in the MFC program by this object.
Protected function BOOL

CreateControl( LPCTSTR lpszClass, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL )

Creates the ActiveX control that is represented in the MFC program by this object.
Protected function BOOL

CreateControl( REFCLSID clsid, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL )

Creates the ActiveX control that is represented in the MFC program by this object.
Public function void

ExportStyle( LPCTSTR fileName )

Exports the style of the control to a file.
Protected function static const CLSID &

GetClsid()

Returns the globally unique identifier (GUID) of the ActiveX control to which this class connects.
Protected function static const IID &

GetIid()

Returns the globally unique identifier (GUID) of the ActiveX interface to which this class connects.
Public function CNiImage

Images( const CString& imageName )

Gets the image object associated with the specified part of the CNiGraph control.
Public function CNiImage

Images( long imageIndex )

Gets the image object associated with the specified part of the CNiGraph control.
Public function void

ImportStyle( LPCTSTR fileName )

Imports a previously exported style.
Public function void

PlotXvsY( const CNiVector& x, const CNiMatrix& y, bool plotPerRow )

Plots a matrix of data as one or more x-y plots.
Public function void

PlotXvsY( const CNiVector& x, const CNiMatrix& y )

Plots a matrix of data as one or more x-y plots.
Public function void

PlotXvsY( const CNiVector& x, const CNiVector& y )

Plots two vectors of data as a single x-y plot.
Public function void

PlotXY( const CNiMatrix& xy, bool plotPerRow )

Plots a matrix of data as one or more x-y plots.
Public function void

PlotXY( const CNiMatrix& xy )

Plots a matrix of data as one or more x-y plots.
Public function void

PlotXY( double x, double y )

Plots a single point of data as one x-y plot.
Public function void

PlotY( const CNiMatrix& y, double xFirst, double xInc, bool plotPerRow )

Plots a matrix of data as one or more y plots.
Public function void

PlotY( const CNiMatrix& y, bool plotPerRow )

Plots a matrix of data as one or more y plots.
Public function void

PlotY( const CNiMatrix& y )

Plots a matrix of data as one or more y plots.
Public function void

PlotY( const CNiVector& y, double xFirst, double xInc )

Plots a vector of data as a single y plot.
Public function void

PlotY( const CNiVector& y, double xFirst )

Plots a vector of data as a single y plot.
Public function void

PlotY( const CNiVector& y )

Plots a vector of data as a single y plot.
Public function void

Refresh()

Forces the control to redraw.
Protected function void

ValidateControl()

Validates the current state of the control.