SRGraph Class

class SRGraph: public CObject

The graph data parent object -- the main placeholder for all Objective Chart functionality

Defined in: SRGraph.h

public:

Contains an empty string

Class Members

Public data members

CHART_API virtual BOOL GetFeedbackLogging()

Returns the m_bFeedbackLogging flag

BOOL m_bSignificantChange

Set TRUE to inform the whole graph of a change in the data or component structures

int m_nCountryCode

Dialing code of the country for which this graph should be adjusted

CObject * m_pHint

Pointer to a hint object (not currently used)

LPARAM m_lHint

Most recent hint code

BOOL m_bHintPending

Semaphore signifying that a hint operation is outstanding

BOOL m_bBackgroundDraw

Semaphore enabling or disabling the use of a back buffer in draw operations

SRGraphStyle m_Style

Style data for axes and graph types

CObList m_ComponentList

List of components which make up the graphical display elements for this graph

SRGDataManager* m_pDataMgr

Data manager

BOOL m_bAutoDelete

Indicating if the graph manage the memory of data manager of not

BOOL m_bFeedbackLogging

Semaphore to enable or disable feedback logging

CObList m_FeedbackList

Linked list of SRGraphFeedback objects

Private member functions

int SubString(LPCTSTR text,CString &section,DWORD *index,double *number)

Parses a substring from the text buffer

public:

Reports syntax errors in graph template text

Public member functions

inline void SetAutoDeleteDataManager(BOOL bAutoDelete)

Sets the AutoDelete flag on the data manager

inline BOOL GetAutoDeleteDataManager()

Returns the AutoDelete flag on the data manager

inline void SetpDC(CDC* pDC)

Sets the pointer to a drawing device context -- not used

inline CDC* GetpDC()

Return a pointer to the current device context

CHART_API virtual void DrawingUsing(CDC *pDC,CWnd *pCWnd)

Prepares for the use of component drawing or sizing functions outside the normal drawing process

CHART_API virtual void NotDrawing()

Resets the drawing parameters set by DrawingUsing()

CHART_API SRGraphComponent * GetCurrentComponent()

Returns a pointer to the component in the main component list that is currently being drawn

CHART_API virtual SRGraphComponent* AddComponent(UINT nType, int nMeasure = CX_PERCENT, const CRect& rect = CRect(-1, -1, -1, -1), DWORD nBorder = CX_NO_BORDER, DWORD nShadow = CX_NO_SHADOW, DWORD nFillStyle = CX_SOLID_FILL, DWORD nGraphStyle = CX_GRAPH_VBAR, DWORD nAxisStyle = CX_AXIS_AUTOMATIC)

A one step version of add component to graph

CHART_API virtual CPen * GetPen(int nPenStyle, int nPenWidth, COLORREF PenColor)

Returns a new pen or one stored in the cache

CHART_API virtual SRGCompiledPolygon * LoadPolygon(LPCTSTR strPolygonName, LPCTSTR strSectionName)

Loads a named polygon

CHART_API virtual void SetDefaultDataStyle(SRGraphStyle v)

Initialises the default data style

CHART_API virtual SRGraphStyle * GetDefaultDataStyle()

Retrieves the default data style

CHART_API virtual void SetAutoColorRange(int v)

Sets the range of colors used by auto pen and auto brush

CHART_API virtual int GetAutoColorRange()

Sets the range of colors used by auto pen and auto brush

CHART_API virtual void DeleteTemporaryComponents(LPCTSTR strName)

Deletes components designated as "temporary" from the component list.

CHART_API virtual SRGraphComponent * FindComponentByName(LPCTSTR strName)

Finds a component on the component list

CHART_API virtual BOOL GetCompiledPolygon(LPCTSTR strPolygonName, LPCTSTR strSectionName, SRGCompiledPolygon * * pPoly,double dAngle=0)

Finds or tries to create a compiled polygon by accessing the polgon cache

CHART_API virtual void Create332Palette(CPalette *pPal)

Creates a half tone palette

CHART_API virtual void SerializeComponentList(CArchive &ar)

Saves or loads the component list via serialization

CHART_API virtual void LogPoint(CPoint point,int group,int index,int nRadius)

Adds a point to the feedback logging system

CHART_API virtual void KillData()

Removes all data from the graph object while leaving the component list intact

CHART_API virtual void InvalidateGroupPosition()

Marks the position of the last group accessed as invalid

CHART_API virtual void ClipPoly(CPoint *pPoint,int nPointCount,int nMode=RGN_COPY)

Sets the clipping region to a particular polygon

CHART_API virtual void ClipRect(CRect r,int nMode=RGN_COPY)

Sets the clipping region to a particular rectangle

CHART_API virtual void PopClip()

"Pops" a stored clipping region and restores it

CHART_API virtual void PushClip()

"Pushes" the current clipping region on to a stack

CHART_API virtual void PrintComponentList(CDC *pCD, CWnd *pCWnd)

Uses a print banding system to output the component list to the printer

CHART_API virtual POSITION GetCurrentComponentPos()

Returns the POSITION of the component currently being drawn

CHART_API virtual SRGraphDataList * NewGroup()

Creates a new SRGraphDataList-based object -- overridable to

CHART_API virtual SRGraphData * GetSafeData(int index,int group)

Returns the 'safe' data item -- does not grow the list, does not assert

CHART_API virtual SRGraphData * GetData(int index,int group)

Returns the 'unsafe' data item -- can grow the list

CHART_API virtual CSize GetDisplaySize()

Returns the size of the display area

CHART_API SRGraph()

Default contructor

CHART_API SRGraph(SRGDataManager* pDataMgr, BOOL bAutoDelete)

Constructor

CHART_API virtual void SetDataManager(SRGDataManager* pNewDataManager, BOOL bAutoDelete)

Install a data manager

inline SRGDataManager* GetDataManager()

Return the existing data manager

CRect m_DisplayRect

Current display rectangle -- not saved at serialization

CHART_API virtual ~SRGraph()

Destructor

CHART_API virtual void RollGroup(int nGroup, double dValue=0.0, BOOL bDirection=FALSE)

Rolls a group in the specified direction

CHART_API virtual void LogRectangle(CRect r,int group, int index)

Places a feedbck rectangle on the feedback list

inline void SetMaxArea(CRect r,BOOL bUseArea=TRUE)

Sets the maximum area which a graph may use

inline CRect GetMaxArea()

Returns the rectangle defined as the maximum usable area

inline BOOL GetUseMaxArea()

Returns TRUE if the sizes of the final display are to be controlled by the m_MaxArea rectangle

inline void SetUseMaxArea(BOOL b)

Enables or disables the use of the maximum size rectangle

inline void SetAlignment(DWORD dwAlign)

Sets the alignment style for this graph

inline DWORD GetAlignment()

Gets the alignment style for this graph

CHART_API virtual void SetSignificantChanges()

Signals to all components on the main list that an important change has taken place

CHART_API virtual void SetGlobalStyle(int nStartGroup,int nEndGroup,int nStartIndex,int nEndIndex,SRGraphStyle *ptrStyle,BOOL bSetHeaders=TRUE)

Sets the style of all data items in a range to a reference style

CHART_API virtual void SetComponentMinIndex(int nComponent,int index,UINT Type=-1)

Sets the minimum index for a given display on the component list

CHART_API virtual void SetComponentMaxIndex(int nComponent,int index,UINT Type=-1)

Sets the maximum index for a given display on the component list

CHART_API virtual void SetComponentMinGroup(int nComponent,int group,UINT Type=-1)

Sets the minimum group for a given display on the component list

CHART_API virtual void SetComponentMaxGroup(int nComponent,int group,UINT Type=-1)

Sets the maximum group for a given display on the component list

CHART_API virtual double GetGroupAverage(int group)

Returns the average of all data items in this group

CHART_API virtual double GetIndexTotal(int index,int nMinGroup=0,int nMaxGroup=0)

Returns the total for a given index across all groups

CHART_API virtual BOOL IsDynamic()

Returns FALSE -- this object is not a dynamic graph

CHART_API virtual void KillComponentList()

Wipes the component list without destroying the graph data

CHART_API virtual void SetGraphTitle(LPCTSTR title,int code=1)

Changes title text in the m_strTitle annotation list

CHART_API virtual void SetComponentHint(CWnd * pCWnd,LPARAM lHint,CObject * pHint)

Updates hint information for the component drawing routines

CHART_API virtual void ParseText(LPCTSTR text)

Interprets tab delimited text data into graph information

CHART_API virtual void KillGraph(void)

Empties a graph of data

CHART_API virtual double GetDataTotal(int mingroup, int minindex, int maxgroup, int maxindex)

Calculates the total of all data values in a given range of groups and indices -- used to calculate percentages

CHART_API virtual double GetDataTotal(int group=-1)

Calculates the total of all data storage values in this graph -- used to calculate percentages

CHART_API virtual int GetDataCount(int nGroup, BOOL GrowList = TRUE)

Get the number of data item in the given group

CHART_API virtual void ReadTemplate(LPCTSTR TemplateName)

Parses a graph template either from a resource or filename

CHART_API virtual BOOL UserParser(LPCTSTR line)

Override this function to interpret your own custom template commands

CHART_API virtual CString GetHeader(int group=0,int code=1)

Returns the header from the SRGraphDataList list indexed by group

CHART_API virtual CString GetText(int group,int index,int code=1)

Returns text held in the SRGraphData object within group and referenced by index

CHART_API virtual CString GetGraphTitle(int code=1)

Returns the title of the graph

CHART_API virtual int GetGroupCount()

Returns the total number of data sets (groups) in the graph

CHART_API virtual int GetMaxXDivisions()

Returns the count of the longest group

CHART_API virtual CScale GetAutoScaleRange(BOOL HiLo=FALSE)

Scans the graph data and returns the maximum and minimum value used in this graph

CHART_API virtual SRGraphDataList* GetGroup(int group,BOOL GrowList=TRUE)

References the correct SRGraphDataList in the array

CHART_API virtual POSITION AddComponent(SRGraphComponent *gc)

Adds a SRGraphComponent or derived object to the list of graphic objects

CHART_API virtual void DrawComponentList(CDC *pDC,CWnd *pCWnd)

Scans the component list, drawing as it goes (order in the list is reverse Z order on screen)

CHART_API virtual void Serialize(CArchive &ar)

Handles storage and retrieval of data

CHART_API void SetHeader(int group,LPCTSTR text,int nCode=1)

Sets a header for a group of data by annotating the SRGraphDataList for that group

CHART_API void SetValue(int index,int group,double number,BOOL bUseDefaultStyle=FALSE)

Sets a numeric value in the data array

CHART_API void SetText(int index,int group,LPCTSTR text)

Sets text in the data array

CHART_API void Dump(CDumpContext &dc) const

Dump diagnostics -- debug only

CHART_API virtual SRGraphFeedback* GetFeedback(int x,int y)

Searches for a feedback point

CHART_API virtual void LogPoly(LPPOINT points,int PointCount,int group,int index)

Adds a polygon to the feedback list

CHART_API virtual void LogPoint(CPoint point,int group,int index)

Adds a point to the feedback list

CHART_API virtual double GetGroupAverage(int MinIndex,int MaxIndex,int Group)

Retrieves an average value for a specific index across a range of groups

CHART_API virtual double GetGraphTotal()

Calculates the total of all graph values

CHART_API virtual BOOL IsBackgroundDraw()

Retrieves the m_bBackgroundDraw member

CHART_API virtual BOOL IsFeedbackLogging()

Retrieves the m_bFeedbackLogging member

CHART_API virtual void SetFeedbackLogging(BOOL bLogging=TRUE)

Initializes the m_bFeedbackLogging member

CHART_API virtual void SetBackgroundDraw(BOOL bBDraw=TRUE)

Initializes the m_bBackgroundDraw member

CHART_API virtual SRGraphAnnotationList * GetTitle()

Returns a pointer to the m_strTitle member

CHART_API virtual CObList * GetFeedbackList()

Returns a pointer to the m_FeedbackList member

CHART_API virtual CObList * GetComponentList()

Returns a pointer to the m_ComponentList member

CHART_API virtual SRGraphStyle * GetStyle()

Returns a pointer to the m_ComponentList member

CHART_API virtual double GetValue(int index,int group)

Gets a numeric value from the data array

CHART_API virtual SRGraphComponent * GetComponent(int nComponent,UINT Type)

Returns a pointer to a specific component in the component list

CHART_API virtual SRGraphComponent * GetNextComponent(POSITION& rPos,UINT Type=-1)

Searches the m_ComponentList for the next item after the supplied POSITION

CHART_API virtual POSITION GetFirstComponentPosition(UINT Type=-1)

Gets the first POSITION in the component list

CHART_API virtual CPtrList* GetDataList()

Returns a pointer to the m_data member

CHART_API virtual POSITION GetFirstDataPosition()

Finds the first POSITION of the first item on the m_data list

CHART_API virtual void* GetNextData(POSITION& p)

Gets the next item fron the m_data list

CHART_API virtual void SetCountryCode(int n)

Sets the dialing code for the annotations in this graph

CHART_API virtual int GetCountryCode()

Interrogates the dialing code for the annotations in this graph.

CHART_API virtual void SetBanding(BOOL v)

Sets the banding variable -- call SetBanding before a print or preview to use the banding system

CHART_API virtual BOOL GetBanding()

Returns the banding flag

CHART_API virtual void SetPaletteSupported(BOOL v)

Initializes the palette support flag.

CHART_API virtual BOOL GetPaletteSupported()

Returns the palette support flag.

CHART_API virtual void SetQuickBlit(BOOL v)

Sets the quickblit flag

CHART_API virtual BOOL GetQuickBlit()

Gets the quickblit flag

inline virtual CPalette* GetPalette()

Returns the stored palette

BOOL m_bIsEmpty

Flag signifying a clean graph if TRUE

BOOL m_bQuickBlit

6.11 and CE Quick blitting flag

CMapStringToPtr m_PenMap

This map collection stores pens which have been created by the chart

CMap<CString , LPCTSTR ,HFONT,HFONT &> m_FontMap

This map collection stores fonts which have been created by the chart

CObList m_PolygonList

The polygon cache

int m_nAutoColorRange

The color range used for choosing auto brushes.

BOOL m_bPaletteSupported

TRUE if a palette is used on this chart

CPalette m_Palette

Stored palette (set to a 332 palette)

CObStack m_ClipStack

Stack for storing clipping regions

CRect m_PageRect

Drawing rectangle used in printing

BOOL m_bBanding

Banding flag to enable use of banding system during printing

CHART_API virtual void AlignRect(CRect * r, CRect DCRect)

Aligns a display area rectangle within a given window or page

POSITION m_CurrentComponentPos

POSITION in the list of the component currently being drawn

BOOL m_bDrawing

Flag set when the chart is being drawn and the DC should be valid

CWnd * m_pCWnd

Pointer to the CWnd being drawn into -- not valid unless m_bDrawing is true

CDC * m_pDC

Pointer to the CDC being drawn into -- not valid unless m_bDrawing is true

CRect m_OldRect

Rectangle used to retain the old display rectangle

CRect m_BGRect

Background rectangle

CBitmap m_Shadow

Bitmap used as a back-buffer in flicker free drawing.

CRect m_MaxArea

Maximum area which a chart may occupy

DWORD m_dwAlignInDC

Binary semaphores for centering behaviour

BOOL m_bUseMaxArea

Semaphore set when maximum area is used to define the image size