SRGDataManager Class

class SRGDataManager

This class stores the data of a graph. The data is stored as a virtual 2-dimensional array of SRGrpahData object. The row of this array is called Group while the column is called Index. Each data object in this array can be accessed by group and index numbers. Even though you can get one row of data by using GetGroup() function, you can not get a whole column in one function call. You need to use each group to get the corresponding column. It is highly recommended that you always use the GetSafeData() function to access existing individual data objects. A standard SRGDataManager object is instantiated by the SRGraph constructor. If you need to customize the data manager, first create your custom SRGDataManager object and then pass this object to SRGraph object via its constructor or SetDataManager() function. You can setup the data for your chart using functions from either the SRGraph or SRGDataManager object. Note that a SRGDataManager object can be shared by several SRGraph objects.

Defined in: DataMgr.h

Class Members

 SRGDataManager()

Constructor

virtual  ~SRGDataManager()

Destructor that frees the internal memory

void  SetDefaultDataStyle(SRGraphStyle v)

Initialize the default data style

SRGraphStyle *  GetDefaultDataStyle()

Obtain the default data style

inline int GetDefaultGroup() const

Retrieves the number of the default group

inline void SetDefaultGroup(int nDefaultGroup)

Sets the number of the default group

virtual SRGraphDataList*  NewGroup()

Creates a new SRGraphDataList object on the application heap

virtual void  Serialize(CArchive &ampar)

Serialize this object

virtual void  KillData()

Clear all the data inside this object

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

Add a numeric data item into the data array

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

Add a text string for the indicating data item

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

Add a text string for the indicating group of data

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

Obtain a pointer to a group with given group index

virtual CScale  GetAutoScaleRange(BOOL HiLo = FALSE)

Returns the maximum and minimum values stored in this graph

virtual int  GetMaxXDivisions()

Returns the count of the longest group

virtual int  GetGroupCount()

Returns the number of groups in this object

CString  GetGraphTitle(int code = 1)

Returns the title string of this class object

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

Returns the text string of the given data item

CString  GetHeader(int group,int code = 1)

Returns the text string of the given group

double  GetDataTotal(int group = -1)

Returns the sum of the data of the specified group

virtual int  GetDataCount(int nGroup, BOOL bGrowList = TRUE)

Returns the number of data items in the specified group

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

Set the title for this object

virtual double  GetGroupAverage(int group)

Returns the average value of the specified group

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

Returns the sum of the data items with specified index and group range

virtual double  GetTotal()

Returns the sum of a the data item in this object

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

Returns the average value of the specified group and index range

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

Returns the sum of the data items in the specified group and index range

virtual double  GetValue(int index,int group)

Returns the numeric value of the specified data item

virtual CPtrList *  GetDataList()

Returns the whole data list

virtual POSITION  GetFirstDataPosition()

Returns the header position of the internal data list

virtual void *  GetNextData(POSITION& p)

Returns the next position in the internal data list

virtual SRGraphAnnotationList *  GetTitle()

Returns the whole title string list

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

Set the style to all the specified data item

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

Rolls a group in the specified direction

virtual SRGraphData *  GetData(int index, int group)

Returns the data object in the specified position

virtual SRGraphData*  GetSafeData(int index, int group)

Returns the data object in the specified position

virtual void  InvalidateGroupPosition()

Reset the internal pointer position

CPtrList  m_data

The data list -- contains a SRGraphDataList for each group

SRGraphAnnotationList  m_strTitle

The graph title

SRGraphStyle m_DefaultDataStyle

The default data style object

POSITION m_LastPos

POSITION of last accessed data item -- used to enhance data access speed

int m_LastGroup

Group of last accessed data item -- used to enhance data access speed

SRGraphDummyData dummydata

Dummy chart data object that is returned in case none exists

int m_nDefaultGroup

Default group for all display types that use only one group -- pie charts, etc.