#include <ChartCtrl.h>
Public Types | |
enum | EAxisPos { LeftAxis = 0, BottomAxis, RightAxis, TopAxis } |
An enumeration of the different axis positions. | |
Public Member Functions | |
CDC * | GetDC () |
Retrieves de device context. | |
CRect | GetPlottingRect () const |
Retrieves the plotting rectangle. | |
CChartLegend * | GetLegend () const |
Returns a pointer to the legend object. | |
CChartTitle * | GetTitle () const |
Returns a pointer to the title object. | |
CChartStandardAxis * | CreateStandardAxis (EAxisPos axisPos) |
Create and attach a standard axis to the control. | |
CChartLogarithmicAxis * | CreateLogarithmicAxis (EAxisPos axisPos) |
Create and attach a logarithmic axis to the control. | |
CChartDateTimeAxis * | CreateDateTimeAxis (EAxisPos axisPos) |
Create and attach a date/time axis to the control. | |
void | AttachCustomAxis (CChartAxis *pAxis, EAxisPos axisPos) |
Attach a custom axis to the control. | |
CChartPointsSerie * | CreatePointsSerie (bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false) |
Create and attach a point series to the control. | |
CChartLineSerie * | CreateLineSerie (bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false) |
Create and attach a line series to the control. | |
CChartSurfaceSerie * | CreateSurfaceSerie (bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false) |
Create and attach a surface series to the control. | |
CChartBarSerie * | CreateBarSerie (bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false) |
Create and attach a bar series to the control. | |
CChartCandlestickSerie * | CreateCandlestickSerie (bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false) |
Create and attach a candlestick series to the control. | |
CChartGanttSerie * | CreateGanttSerie (bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false) |
Create and attach a gantt series to the control. | |
void | AttachCustomSerie (CChartSerie *pNewSeries, bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false) |
Attaches a custom series to the chart. | |
CChartSerie * | GetSerie (unsigned uSerieId) const |
Retrieves a specific series from the chart. | |
void | RemoveSerie (unsigned uSerieId) |
Removes a specific series from the chart. | |
void | RemoveAllSeries () |
Removes all the series from the chart. | |
size_t | GetSeriesCount () const |
Returns the number of series in the chart. | |
CChartCrossHairCursor * | CreateCrossHairCursor (bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false) |
Create and attach a cross-hair cursor to the control. | |
CChartDragLineCursor * | CreateDragLineCursor (EAxisPos relatedAxis) |
Create and attach a drag-line cursor to the control. | |
void | AttachCustomCursor (CChartCursor *pCursor) |
Attach a custom cursor to the control. | |
void | RemoveCursor (unsigned cursorId) |
Removes a cursor with a specific Id from the control. | |
void | ShowMouseCursor (bool bShow) |
Shows/hides the mouse cursor when it is over the plotting area. | |
CChartAxis * | GetBottomAxis () const |
CChartAxis * | GetLeftAxis () const |
CChartAxis * | GetTopAxis () const |
CChartAxis * | GetRightAxis () const |
CChartAxis * | GetAxis (EAxisPos axisPos) const |
Returns a specific axis attached to the control. | |
UINT | GetEdgeType () const |
Returns the type of the edge used as border. | |
void | SetEdgeType (UINT NewEdge) |
Sets the edge type. | |
COLORREF | GetBackColor () const |
Returns the background color. | |
void | SetBackColor (COLORREF NewCol) |
Sets the background color. | |
COLORREF | GetBorderColor () const |
Returns the color of the plotting area's border. | |
void | SetBorderColor (COLORREF NewCol) |
Sets the color of the plotting area's border. | |
COLORREF | GetZoomRectColor () const |
Returns the color of the zoom rectangle. | |
void | SetZoomRectColor (COLORREF NewCol) |
Sets the color of the zoom rectangle. | |
void | SetBackGradient (COLORREF Col1, COLORREF Col2, EGradientType GradientType) |
Sets a gradient background. | |
void | SetPanEnabled (bool bEnabled) |
Enables/disables the pan feature. | |
bool | GetPanEnabled () const |
Returns true if the pan feature is enabled. | |
void | SetZoomEnabled (bool bEnabled) |
Enables/disables the zoom feature. | |
bool | GetZoomEnabled () const |
Returns true if the zoom feature is enabled. | |
void | UndoPanZoom () |
Undo all pan and zoom operations that were done on the chart. | |
void | RefreshCtrl () |
Forces a refresh of the control. | |
void | EnableRefresh (bool bEnable) |
Enables/disables the refresh of the control. | |
int | Create (CWnd *pParentWnd, const RECT &rect, UINT nID, DWORD dwStyle=WS_VISIBLE) |
Creates the control dynamically. | |
virtual void | Print (const TChartString &strTitle, CPrintDialog *pPrntDialog=NULL) |
Print the chart. | |
CChartCtrl () | |
Default constructor. | |
virtual | ~CChartCtrl () |
Default destructor. | |
void | RegisterMouseListener (CChartMouseListener *pMouseListener) |
Register a mouse listener with the control. | |
void | GoToFirstSerie () |
Tell the control to set the current series to the first series. | |
CChartSerie * | GetNextSerie () |
Returns the next series in the control. | |
void | RefreshScreenAutoAxes () |
Refreshes all the axes which are automatic for the screen. | |
Static Public Member Functions | |
static double | DateToValue (const COleDateTime &Date) |
Helper function to convert a date to a double value. | |
static COleDateTime | ValueToDate (double Value) |
Helper function to convert a double value to a date. | |
Protected Member Functions | |
afx_msg void | OnPaint () |
afx_msg BOOL | OnEraseBkgnd (CDC *pDC) |
afx_msg void | OnSize (UINT nType, int cx, int cy) |
afx_msg void | OnMouseMove (UINT nFlags, CPoint point) |
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point) |
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point) |
afx_msg void | OnLButtonDblClk (UINT nFlags, CPoint point) |
afx_msg void | OnRButtonDown (UINT nFlags, CPoint point) |
afx_msg void | OnRButtonUp (UINT nFlags, CPoint point) |
afx_msg void | OnRButtonDblClk (UINT nFlags, CPoint point) |
afx_msg void | OnHScroll (UINT nSBCode, UINT nPos, CScrollBar *pScrollBar) |
afx_msg void | OnVScroll (UINT nSBCode, UINT nPos, CScrollBar *pScrollBar) |
virtual void | OnBeginPrinting (CDC *pDC, CPrintInfo *pInfo) |
virtual void | OnPrint (CDC *pDC, CPrintInfo *pInfo) |
virtual void | OnEndPrinting (CDC *pDC, CPrintInfo *pInfo) |
virtual void | DrawChart (CDC *pDC, CRect ChartRect) |
virtual void | DrawBackground (CDC *pDC, CRect ChartRect) |
void CChartCtrl::AttachCustomAxis | ( | CChartAxis * | pAxis, | |
EAxisPos | axisPos | |||
) |
Attach a custom axis to the control.
This function takes ownership of the axis pointer, so you must not destroy it. If the axis is alread attached to a chart control (even this one), the function will fail with an assertion. This function should be used only when you want to provide a custom axis to the control, otherwise you should use the AttachStandardAxis, AttachLogarithmicAxis and AttachDateTimeAxis instead.
pAxis | The axis to attach to the control. | |
axisPos | The position of the axis. This value can be:
|
void CChartCtrl::AttachCustomCursor | ( | CChartCursor * | pCursor | ) |
Attach a custom cursor to the control.
You should only use this function if you want to attach a custom cursor to the control. Otherwise, you should use the CreateXXXCursor helper functions.
pCursor | The custom cursor to be attached to the control. |
void CChartCtrl::AttachCustomSerie | ( | CChartSerie * | pNewSeries, | |
bool | bSecondaryHorizAxis = false , |
|||
bool | bSecondaryVertAxis = false | |||
) |
Attaches a custom series to the chart.
You should only use this function if you want to attach a custom series to the control. Otherwise, you should use the CreateXXXSerie helper functions. The function will assert if the associated axes are not attached to the control.
pNewSeries | The new series to be added. The control will take ownership of the pointer, so dont't delete it yourself. | |
bSecondaryHorizAxis | Specifies if the associated horizontal axis is secondary or not. If this value is false, the associated horizontal axis is the bottom axis, otherwise it is the top axis. | |
bSecondaryVertAxis | Specifies if the associated vertical axis is secondary or not. If this value is false, the associated vertical axis is the left axis, otherwise it is the right axis. |
int CChartCtrl::Create | ( | CWnd * | pParentWnd, | |
const RECT & | rect, | |||
UINT | nID, | |||
DWORD | dwStyle = WS_VISIBLE | |||
) |
Creates the control dynamically.
pParentWnd | Parent window of the control | |
rect | Position of the control | |
nID | ID of the control | |
dwStyle | Style of the control |
CChartBarSerie * CChartCtrl::CreateBarSerie | ( | bool | bSecondaryHorizAxis = false , |
|
bool | bSecondaryVertAxis = false | |||
) |
Create and attach a bar series to the control.
bSecondaryHorizAxis | Specifies if the horizontal axis is the secondary axis or not. | |
bSecondaryVertAxis | Specifies if the vertical axis is the secondary axis or not. |
CChartCandlestickSerie * CChartCtrl::CreateCandlestickSerie | ( | bool | bSecondaryHorizAxis = false , |
|
bool | bSecondaryVertAxis = false | |||
) |
Create and attach a candlestick series to the control.
bSecondaryHorizAxis | Specifies if the horizontal axis is the secondary axis or not. | |
bSecondaryVertAxis | Specifies if the vertical axis is the secondary axis or not. |
CChartCrossHairCursor * CChartCtrl::CreateCrossHairCursor | ( | bool | bSecondaryHorizAxis = false , |
|
bool | bSecondaryVertAxis = false | |||
) |
Create and attach a cross-hair cursor to the control.
A cross-hair cursor display a cross on the control and move accordingly to the mouse. It is attached to an horizontal and a vertical axis.
bSecondaryHorizAxis | Specifies if the horizontal axis is the secondary axis or not. | |
bSecondaryVertAxis | Specifies if the vertical axis is the secondary axis or not. |
CChartDateTimeAxis * CChartCtrl::CreateDateTimeAxis | ( | EAxisPos | axisPos | ) |
Create and attach a date/time axis to the control.
axisPos | The position of the axis. |
CChartDragLineCursor * CChartCtrl::CreateDragLineCursor | ( | EAxisPos | relatedAxis | ) |
Create and attach a drag-line cursor to the control.
A drag-line cursor is a simple line (horizontal or vertical) that can be dragged with the mouse by clicking on it. It is attached to a specific axis.
relatedAxis | The axis position to which the cursor is attached to. |
CChartGanttSerie * CChartCtrl::CreateGanttSerie | ( | bool | bSecondaryHorizAxis = false , |
|
bool | bSecondaryVertAxis = false | |||
) |
Create and attach a gantt series to the control.
bSecondaryHorizAxis | Specifies if the horizontal axis is the secondary axis or not. | |
bSecondaryVertAxis | Specifies if the vertical axis is the secondary axis or not. |
CChartLineSerie * CChartCtrl::CreateLineSerie | ( | bool | bSecondaryHorizAxis = false , |
|
bool | bSecondaryVertAxis = false | |||
) |
Create and attach a line series to the control.
The function will assert if the associated axes are not attached to the control.
bSecondaryHorizAxis | Specifies if the horizontal axis is the secondary axis or not. | |
bSecondaryVertAxis | Specifies if the vertical axis is the secondary axis or not. |
CChartLogarithmicAxis * CChartCtrl::CreateLogarithmicAxis | ( | EAxisPos | axisPos | ) |
Create and attach a logarithmic axis to the control.
axisPos | The position of the axis. |
CChartPointsSerie * CChartCtrl::CreatePointsSerie | ( | bool | bSecondaryHorizAxis = false , |
|
bool | bSecondaryVertAxis = false | |||
) |
Create and attach a point series to the control.
bSecondaryHorizAxis | Specifies if the horizontal axis is the secondary axis or not. | |
bSecondaryVertAxis | Specifies if the vertical axis is the secondary axis or not. |
CChartStandardAxis * CChartCtrl::CreateStandardAxis | ( | EAxisPos | axisPos | ) |
Create and attach a standard axis to the control.
axisPos | The position of the axis. |
CChartSurfaceSerie * CChartCtrl::CreateSurfaceSerie | ( | bool | bSecondaryHorizAxis = false , |
|
bool | bSecondaryVertAxis = false | |||
) |
Create and attach a surface series to the control.
The function will assert if the associated axes are not attached to the control.
bSecondaryHorizAxis | Specifies if the horizontal axis is the secondary axis or not. | |
bSecondaryVertAxis | Specifies if the vertical axis is the secondary axis or not. |
void CChartCtrl::EnableRefresh | ( | bool | bEnable | ) |
Enables/disables the refresh of the control.
This function is used when several settings have to be changed at the same time on the control. This way we can avoid refreshing the control when it is not needed.
bEnable | false to disable the refresh and true to re-enable the refresh. |
CChartAxis* CChartCtrl::GetAxis | ( | EAxisPos | axisPos | ) | const [inline] |
Returns a specific axis attached to the control.
If the specified axis does not exist, NULL is returned.
axisPos | The axis position (left, bottom, right or top). |
CDC * CChartCtrl::GetDC | ( | ) |
Retrieves de device context.
This function is used for internal purposes only.
CChartSerie * CChartCtrl::GetNextSerie | ( | ) |
Returns the next series in the control.
This function is used with the GoToFirstSerie to iterate over all series in the control. First call GoToFirstSerie and then call this function until it returns NULL to iterate over all series. Warning: calling this function without calling GoToFirstSerie before might lead to unpredicted results. The same if you add or remove series between the call to GetFirstSerie and the call to GetNextSerie.
CChartSerie* CChartCtrl::GetSerie | ( | unsigned | uSerieId | ) | const |
Retrieves a specific series from the chart.
uSerieId | The Id of the series to retrieve |
void CChartCtrl::GoToFirstSerie | ( | ) |
Tell the control to set the current series to the first series.
This function is used with the GetNextSerie to iterate over all series in the control.
void CChartCtrl::Print | ( | const TChartString & | strTitle, | |
CPrintDialog * | pPrntDialog = NULL | |||
) | [virtual] |
Print the chart.
strTitle | The title of the print document. | |
pPrntDialog | A pointer to a CPrintDialog. If NULL is passed, the default print dialog will be displayed. |
void CChartCtrl::RefreshCtrl | ( | ) |
Forces a refresh of the control.
This function is used for internal purposes.
void CChartCtrl::RegisterMouseListener | ( | CChartMouseListener * | pMouseListener | ) | [inline] |
Register a mouse listener with the control.
This listener will be notified each time a mouse event occurs on the control.
pMouseListener | The mouse listener to register with this control. |
void CChartCtrl::RemoveCursor | ( | unsigned | cursorId | ) |
Removes a cursor with a specific Id from the control.
The cursor Id can be retrieved on through the CChartCursor::GetCursorId function.
cursorId | The Id of the cursor to remove from the control. |
void CChartCtrl::RemoveSerie | ( | unsigned | uSerieId | ) |
Removes a specific series from the chart.
uSerieId | The Id of the series to be removed. |
void CChartCtrl::SetBackGradient | ( | COLORREF | Col1, | |
COLORREF | Col2, | |||
EGradientType | GradientType | |||
) |
Sets a gradient background.
Col1 | The first gradient color | |
Col2 | The second gradient color | |
GradientType | The type of gradient used from Col1 to Col2. It can take the following values:
|
void CChartCtrl::SetEdgeType | ( | UINT | NewEdge | ) | [inline] |
Sets the edge type.
NewEdge | The type of the edge. See the DrawEdge function in MSDN for a list of the different types. |