#include <ChartAxis.h>
Public Types | |
enum | EAxisAutoModes { NotAutomatic, FullAutomatic, ScreenAutomatic } |
The different modes of automatic modes for an axis. More... | |
Public Member Functions | |
CChartAxis () | |
Default constructor. | |
virtual | ~CChartAxis () |
Default destructor. | |
int | GetPosition () |
Retrieves the position (in %) of the axis. | |
void | SetInverted (bool bInverted) |
Sets the axis in reverse. | |
bool | IsInverted () const |
Retrieves if the axis is inverted or not. | |
void | SetAutomatic (bool bAutomatic) |
Sets the axis in automatic or manual mode. | |
bool | IsAutomatic () const |
Returns true if an automatic mode has been set on this axis. | |
void | SetAutomaticMode (EAxisAutoModes AutoMode) |
Sets the automatic mode of the axis. | |
EAxisAutoModes | GetAutomaticMode () const |
Gets the automatic type of the axis. | |
void | SetVisible (bool bVisible) |
Sets the axis visible/invisible. | |
bool | IsVisible () const |
Retrieves the axis automatic mode. | |
void | SetMinMax (double Minimum, double Maximum) |
Sets the axis min and max values. | |
void | GetMinMax (double &Minimum, double &Maximum) const |
Gets the min anx max values of the axis. | |
void | SetAxisColor (COLORREF NewColor) |
Sets the axis color. | |
void | SetTextColor (COLORREF NewColor) |
Sets the tick labels color. | |
COLORREF | GetTextColor () const |
Gets the tick labels color. | |
void | SetFont (int nPointSize, const TChartString &strFaceName) |
Sets the tick labels font. | |
CChartAxisLabel * | GetLabel () const |
Retrieves the chart axis label object. | |
CChartGrid * | GetGrid () const |
Retrieves the chart axis grid object. | |
void | SetMarginSize (bool bAuto, int iNewSize) |
Sets the margin size. | |
void | SetPanZoomEnabled (bool bEnabled) |
Enable the pan and zoom for this axis. | |
void | SetZoomLimit (double dLimit) |
Sets the zoom limit. | |
void | EnableScrollBar (bool bEnabled) |
Enables/disables the scroll bar. | |
bool | ScrollBarEnabled () const |
Retrieves if the scroll bar is enabled or not. | |
void | SetAutoHideScrollBar (bool bAutoHide) |
Specifies if the scroll bar is in auto-hide mode. | |
bool | GetAutoHideScrollBar () const |
Retrieves if the scroll bar is in auto-hide mode. | |
virtual void | SetDiscrete (bool bDiscrete) |
Sets the axis in discrete mode. | |
long | ValueToScreen (double Value) const |
Converts a value on the axis to a screen position. | |
virtual double | ScreenToValue (long ScreenVal) const |
Converts a screen position to a value on the axis. | |
bool | IsHorizontal () const |
Returns true if the axis is horizontal. | |
BOOL | IsPointInside (const CPoint &screenPoint) const |
Returns true if a screen point is in the region of the axis. | |
Protected Member Functions | |
virtual double | GetFirstTickValue () const =0 |
Returns the first tick value. | |
virtual bool | GetNextTickValue (double dCurrentTick, double &dNextTick) const =0 |
Retrieves the next tick value after a given tick. | |
virtual long | GetTickPos (double Value) const =0 |
Retrieves the screen position of a certain tick. | |
virtual long | ValueToScreenDiscrete (double Value) const =0 |
Converts a value on the axis to a screen position. | |
virtual long | ValueToScreenStandard (double Value) const |
Converts a value on the axis to a screen position. | |
virtual TChartString | GetTickLabel (double TickValue) const =0 |
Retrieves the label for a specific tick. | |
virtual void | RefreshTickIncrement ()=0 |
Forces a recalculation of the tick increment. | |
virtual void | RefreshFirstTick ()=0 |
Forces a recalculation of the first tick value. | |
virtual void | GetScrollbarSteps (int &iTotalSteps, int &iCurrentStep) |
Retrieves the step information related to the scrollbar. | |
virtual void | SetAxisToScrollStep (int iPreviousStep, int iCurrentStep, bool bScrollInverted) |
Sets the axis to the specified scrollbar step. | |
virtual void | PanAxis (long PanStart, long PanEnd) |
Pan the axis. | |
virtual void | SetZoomMinMax (double Minimum, double Maximum) |
Sets the min and max values of the axis due to a zoom operation. | |
void | UndoZoom () |
Reverts the zoom and pan settings. | |
long | GetAxisLenght () const |
Retrieves the lenght (in pixels) of the axis. | |
void | GetSeriesMinMax (double &Minimum, double &Maximum) |
Retrieves the min and max values for all the series related to this axis. | |
void | GetSeriesScreenMinMax (double &Minimum, double &Maximum) |
Retrieves the screen min and max values for all the series related to this axis. | |
Protected Attributes | |
CChartCtrl * | m_pParentCtrl |
The parent chart control. | |
bool | m_bIsHorizontal |
Indicates if this is an horizontal or vertical axis. | |
bool | m_bIsInverted |
Indicates if the axis is inverted. | |
EAxisAutoModes | m_AutoMode |
Indicates if the axis is automatic. | |
bool | m_bIsVisible |
Indicates if the axis is visible or not. | |
bool | m_bIsSecondary |
Specifies if the axis is secondary. | |
double | m_MaxValue |
The axis max value. | |
double | m_MinValue |
The axis min value. | |
double | m_UnzoomMin |
Min value of the axis before it has been zoomed. | |
double | m_UnzoomMax |
Max value of the axis before it has been zoomed. | |
bool | m_bAutoTicks |
Specify if the tick increment is manual or automatic. | |
bool | m_bDiscrete |
Specify if the axis has to be in discrete mode or not. | |
int | m_StartPos |
Start position of the axis (in pixels). | |
int | m_EndPos |
End position of the axis (in pixels). | |
CRect | m_AxisRect |
The rectangle in which the axis is contained. |
This class cannot be instanciated but should be overriden in order to provide the required functionality (this is already done for standard axis, date/time axis and logarithmic axis).
The class provides already a lot of functionalities but delegate the ticks positioning and labeling to the child classes.
By default, the class manages a continues range of double values (which is the case for standard axis and date/time axis) but in some cases, this is not valid (for instance, a logarithmic scale). In that case, you should in addition override some specific functions (e.g. those handling the scrollbar). Take a look at the CChartLogarithmicAxis class for more details.
The different modes of automatic modes for an axis.
virtual double CChartAxis::GetFirstTickValue | ( | ) | const [protected, pure virtual] |
Returns the first tick value.
This pure virtual function must be implemented for specific axes type.
virtual bool CChartAxis::GetNextTickValue | ( | double | dCurrentTick, | |
double & | dNextTick | |||
) | const [protected, pure virtual] |
Retrieves the next tick value after a given tick.
This pure virtual function must be implemented for specific axes type.
dCurrentTick | The value of the current tick | |
dNextTick | The value of the next tick will be stored in this parameter |
void CChartAxis::GetScrollbarSteps | ( | int & | iTotalSteps, | |
int & | iCurrentStep | |||
) | [protected, virtual] |
Retrieves the step information related to the scrollbar.
This function can be implemented for specific axis types which should provide a behavior different than the standard behavior (for instance log axis).
iTotalSteps | Stores the total number of steps for the scrollbar | |
iCurrentStep | Stores the current step index for the scrollbar |
virtual TChartString CChartAxis::GetTickLabel | ( | double | TickValue | ) | const [protected, pure virtual] |
Retrieves the label for a specific tick.
This pure virtual function must be implemented for specific axes type.
TickValue | The tick value for which we need to get the label. |
virtual long CChartAxis::GetTickPos | ( | double | Value | ) | const [protected, pure virtual] |
Retrieves the screen position of a certain tick.
This pure virtual function must be implemented for specific axes type.
Value | The value of the tick for which we want to retrieve the position |
bool CChartAxis::IsAutomatic | ( | ) | const [inline] |
Returns true if an automatic mode has been set on this axis.
void CChartAxis::PanAxis | ( | long | PanStart, | |
long | PanEnd | |||
) | [protected, virtual] |
Pan the axis.
This function can be overriden in case the axis doesn't display a continuous range of values (e.g. log axis).
PanStart | The position of the start of the pan | |
PanEnd | The position of the end of the pan |
double CChartAxis::ScreenToValue | ( | long | ScreenVal | ) | const [virtual] |
Converts a screen position to a value on the axis.
The function is implemented for an axis with a standard behavior (the axis shows a continuous range of doubles). It is the case for standard axis and date/time axis (date are converted to doubles internally). Axis that needs a different behavior should override this function (e.g. a logarithmic axis). The function does not take care of the discrete mode.
ScreenVal | The screen value to convert |
void CChartAxis::SetAutoHideScrollBar | ( | bool | bAutoHide | ) |
Specifies if the scroll bar is in auto-hide mode.
In auto-hide mode, the scroll bar will be hidden until you hover the mouse over it.
void CChartAxis::SetAutomatic | ( | bool | bAutomatic | ) |
Sets the axis in automatic or manual mode.
In automatic mode, the axis min and max will be updated depending on the series related to this axis.
bAutomatic | true if the axis should be automatic. |
void CChartAxis::SetAxisToScrollStep | ( | int | iPreviousStep, | |
int | iCurrentStep, | |||
bool | bScrollInverted | |||
) | [protected, virtual] |
Sets the axis to the specified scrollbar step.
This function can be implemented for specific axis types which should provide a behavior different than the standard behavior (for instance log axis).
iPreviousStep | The previous scroll step. | |
iCurrentStep | The current scroll step to which the axis should be moved. | |
bScrollInverted | Specifies if the scroll is inverted or not. |
void CChartAxis::SetDiscrete | ( | bool | bDiscrete | ) | [virtual] |
Sets the axis in discrete mode.
bDiscrete | true if the axis has to be discrete, false otherwise. In discrete mode, the axis doesn't have a continuous range of values but only steps which are defined by the tick interval. In this mode, you won't be able to plot points at a different location that in the middle of two ticks. For instance, if you have a tick interval of 1.0, trying to plot a value of 0.9 will display the point at the same position as if the value was 0.3: it will be displayed in the middle of tick 0.0 and tick 1.0. It is mainly used to display the tick label in the middle of two ticks. This is for instance nice with date/time axis. |
void CChartAxis::SetFont | ( | int | nPointSize, | |
const TChartString & | strFaceName | |||
) |
Sets the tick labels font.
nPointSize | The font point size | |
strFaceName | The font face name |
void CChartAxis::SetInverted | ( | bool | bInverted | ) |
Sets the axis in reverse.
For an inverted axis, the values on the axis are in decreasing order.
bInverted | true if the axis has to be inverted. |
void CChartAxis::SetMarginSize | ( | bool | bAuto, | |
int | iNewSize | |||
) |
Sets the margin size.
bAuto | Specifies if the margin size is automatic or not. In automatic mode, the iNewSize parameter is ignored and the margin size is calculated automatically. | |
iNewSize | The new size of the margin, in manual mode. |
void CChartAxis::SetMinMax | ( | double | Minimum, | |
double | Maximum | |||
) |
Sets the axis min and max values.
This doesn't take into account the real type of the axis, so double values should be provided.
Minimum | The min value of the axis | |
Maximum | The max value of the axis. |
void CChartAxis::SetZoomLimit | ( | double | dLimit | ) | [inline] |
Sets the zoom limit.
The zoom limit is the minimum lenght (in values) of the axis.
long CChartAxis::ValueToScreen | ( | double | Value | ) | const |
Converts a value on the axis to a screen position.
The functions takes care of the discrete mode (internally, it calls ValueToScreenStandard or ValueToScreenDiscrete depending on the discrete mode).
Value | The value to convert |
virtual long CChartAxis::ValueToScreenDiscrete | ( | double | Value | ) | const [protected, pure virtual] |
Converts a value on the axis to a screen position.
This function is called internally only when the axis is in discrete mode. This pure virtual function must be implemented for specific axes type.
Value | The value to convert |
long CChartAxis::ValueToScreenStandard | ( | double | Value | ) | const [protected, virtual] |
Converts a value on the axis to a screen position.
This function is called internally only when the axis is in standard mode. This virtual function can be overriden when the axis doesn't display a continuous range of values (e.g. log axis).
Value | The value to convert |
EAxisAutoModes CChartAxis::m_AutoMode [protected] |
Indicates if the axis is automatic.
Indicates the automatic mode of the axis
bool CChartAxis::m_bIsSecondary [protected] |
Specifies if the axis is secondary.
The secondary axis is either on the top (for horizontal axis) or on the right (for vertical axis) of the chart.