wxFreeChart
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NumberAxis Class Reference

An axis for displaying and scaling numerical data. More...

#include <numberaxis.h>

Inheritance diagram for NumberAxis:
Inheritance graph
[legend]
Collaboration diagram for NumberAxis:
Collaboration graph
[legend]

Public Member Functions

 NumberAxis (AXIS_LOCATION location)
 
virtual bool UpdateBounds ()
 Performs axis bounds update after dataset/s change.
 
void SetTickFormat (const wxString &tickFormat)
 Sets format for tick marks. More...
 
 wxDEPRECATED_MSG ("Do not use this function, instead use SetMajorInterval.") void SetLabelCount(size_t labelCount)
 
void IntegerValues (bool intValues=true)
 Set whether to use integer values instead of doubles. More...
 
void ZeroOrigin (bool zeroOrigin=true)
 Set whether the axis origin starts at zero. More...
 
void ForceExtraMajorInterval (bool force=true)
 Forces an extra tick to be drawn at the top of vertical axis if the maximum value is the same as the last tick. More...
 
double GetMultiplier () const
 Returns multiplier for values. More...
 
void SetMultiplier (double multiplier)
 Sets multiplier for values. More...
 
void SetFixedBounds (double minValue, double maxValue)
 Make data bounds fixed. More...
 
virtual void GetDataBounds (double &minValue, double &maxValue) const
 Returns bounds, taken from data, eg. More...
 
size_t GetLabelCount () const
 Returns label count, to be draw on axis. More...
 
- Public Member Functions inherited from LabelAxis
 LabelAxis (AXIS_LOCATION location)
 
void SetTitle (const wxString &title)
 Sets axis title. More...
 
const wxString & GetTitle ()
 Returns axis title. More...
 
void SetTitleLocation (int location)
 Sets axis title location. More...
 
int GetTitleLocation ()
 Returns axis title location. More...
 
void SetTitleFont (wxFont &font)
 Sets axis title font. More...
 
const wxFont & GetTitleFont ()
 Returns axis title font. More...
 
void SetTitleColour (wxColour &colour)
 Sets axis title colour. More...
 
wxColour GetTitleColour ()
 Returns axis title colour. More...
 
void SetLabelPen (wxPen labelPen)
 Sets pen for label lines. More...
 
void SetLabelTextColour (wxColour labelTextColour)
 Sets colour for labels. More...
 
wxColour GetLabelTextColour ()
 Returns label colour. More...
 
void SetLabelTextFont (wxFont labelTextFont)
 Sets font for labels text. More...
 
const wxFont & GetLabelTextFont ()
 Returns label font. More...
 
void SetVerticalLabelText (bool verticalLabelText)
 Sets whether to draw labels text vertical. More...
 
bool GetVerticalLabelText ()
 Returns whether to draw labels text vertical. More...
 
 wxDEPRECATED_MSG ("Use SetMinorIntervalCount instead.") void SetMajorLabelSteps(size_t step)
 Sets major label steps. More...
 
void SetMinorIntervalCount (size_t count)
 Set the number of ticks between each label (major interval). More...
 
size_t GetMinorIntervalCout ()
 Get the number of ticks between each label (major interval). More...
 
void SetLabelSkip (int blankLabels)
 
int GetLabelSkip ()
 
void SetLabelColourer (LabelColourer *labelColourer)
 
LabelColourerGetLabelColourer ()
 
void SetAxisVisible (bool bVisible)
 Sets visibility of axis. More...
 
virtual void Draw (wxDC &dc, wxRect rc)
 Performs axis drawing. More...
 
virtual void DrawGridLines (wxDC &dc, wxRect rc)
 Draws grid lines for axis. More...
 
virtual wxCoord GetExtent (wxDC &dc)
 Used to determine minimal size needed to draw axis contents, minimal width for vertical axes, minimal height for horizontal. More...
 
- Public Member Functions inherited from Axis
 Axis (AXIS_LOCATION location)
 Constructs new axis. More...
 
AXIS_LOCATION GetLocation ()
 Returns axis location. More...
 
bool IsVertical ()
 Checks whether axis is vertical. More...
 
bool IsHorizontal ()
 Checks whether axis is horizontal. More...
 
void SetMargins (wxCoord marginMin, wxCoord marginMax)
 Sets minimal/maximal margins for axis. More...
 
void SetMajorGridlinePen (const wxPen &pen)
 Sets the pen to be used for drawing major gridlines. More...
 
void SetMinorGridlinePen (const wxPen &pen)
 Sets the pen to be used for drawing minor gridlines. More...
 
const wxPen & GetMajorGridlinePen ()
 Gets the pen that is currently used to draw major gridlines on this axis. More...
 
const wxPen & GetMinorGridlinePen ()
 Gets the pen that is currently used to draw minor gridlines on this axis. More...
 
size_t GetDatasetCount ()
 Returns dataset counts, linked with this axis. More...
 
DatasetGetDataset (size_t index)
 Returns dataset, linked with this axis at specified index. More...
 
void SetZoomPanMode ()
 
void SetWindowWidth (double winWidth)
 Sets window width. More...
 
double GetWindowWidth ()
 Returns window width. More...
 
void SetWindowPosition (double winPos)
 Sets window position. More...
 
double GetWindowPosition ()
 Returns window position. More...
 
void SetUseWindow (bool useWin)
 Sets whether to use window. More...
 
void SetWindow (double winPos, double winWidth)
 Sets window params (position and width). More...
 
bool IntersectsWindow (double v0, double v1)
 Checks whether line in data space intersects window. More...
 
void GetWindowBounds (double &winMin, double &winMax)
 Returns window bounds. More...
 
void AddDataset (Dataset *dataset)
 internal. More...
 
virtual bool IsVisible (double value)
 Checks whether data value is visible. More...
 
virtual double BoundValue (double value)
 Returns nearest boundary value. More...
 
virtual wxCoord ToGraphics (wxDC &dc, int minCoord, int gRange, double value)
 Transforms coordinate from data space to graphics space. More...
 
virtual double ToData (wxDC &dc, int minCoord, int gRange, wxCoord g)
 Transforms coordinate from graphics space to data space. More...
 

Protected Member Functions

virtual bool AcceptDataset (Dataset *dataset)
 Checks whether dataset can be accepted by this axis. More...
 
double CalcNiceInterval (double value, bool round=false)
 Helper function to calculate a 'nice' label interval for the given dataset. More...
 
void UpdateMajorIntervalValues ()
 
virtual double GetValue (size_t step)
 Returns value on step. More...
 
virtual void GetLabel (size_t step, wxString &label)
 Returns label on step. More...
 
virtual bool IsEnd (size_t step)
 Check whether step is last. More...
 
virtual bool HasLabels ()
 
virtual wxSize GetLongestLabelExtent (wxDC &dc)
 

Protected Attributes

bool m_fixedBounds
 
bool m_hasLabels
 
double m_minValue
 
double m_maxValue
 
double m_labelInterval
 
size_t m_labelCount
 
- Protected Attributes inherited from Axis
DatasetArray m_datasets
 
wxPen m_majorGridlinePen
 
wxPen m_minorGridlinePen
 
wxCoord m_marginMin
 
wxCoord m_marginMax
 
double m_winPos
 
double m_winWidth
 
bool m_useWin
 

Detailed Description

An axis for displaying and scaling numerical data.

Definition at line 18 of file numberaxis.h.

Member Function Documentation

virtual bool NumberAxis::AcceptDataset ( Dataset dataset)
protectedvirtual

Checks whether dataset can be accepted by this axis.

Must be implemented by derivative classes. XXX: maybe remove this method later.

Parameters
datasetdataset to be checked
Returns
true - if dataset can be accepted, false overwise

Implements Axis.

double NumberAxis::CalcNiceInterval ( double  value,
bool  round = false 
)
protected

Helper function to calculate a 'nice' label interval for the given dataset.

Label intervals are considered nice if they are 1, 2, 5 or 10 raised to an appropriate power of 10.

Parameters
valueThe approximate interval required.
roundWhether the values should be rounded.
Returns
The 'nice' value for the interval.
void NumberAxis::ForceExtraMajorInterval ( bool  force = true)
inline

Forces an extra tick to be drawn at the top of vertical axis if the maximum value is the same as the last tick.

This setting is disabled by default. Note: this setting if the axis bounds are set manually by SetFixedBounds.

Parameters
forceIf true, an extra tick is drawn at the top of a vertical axis if the maximum value falls on a tick interval.

Definition at line 71 of file numberaxis.h.

References Axis::AcceptDataset(), Axis::GetDataBounds(), LabelAxis::GetLabel(), LabelAxis::GetValue(), and LabelAxis::IsEnd().

virtual void NumberAxis::GetDataBounds ( double &  minValue,
double &  maxValue 
) const
virtual

Returns bounds, taken from data, eg.

real min-max value.

Parameters
minValueoutput minimal data value
maxValueoutput maximal data value

Implements Axis.

virtual void NumberAxis::GetLabel ( size_t  step,
wxString &  label 
)
protectedvirtual

Returns label on step.

Parameters
stepstep index
labeloutput label

Implements LabelAxis.

Reimplemented in LogarithmicNumberAxis, and JulianDateAxis.

size_t NumberAxis::GetLabelCount ( ) const

Returns label count, to be draw on axis.

Returns
label count, to be draw on axis
double NumberAxis::GetMultiplier ( ) const

Returns multiplier for values.

Returns
multiplier
virtual double NumberAxis::GetValue ( size_t  step)
protectedvirtual

Returns value on step.

Parameters
stepstep index
Returns
value on step

Implements LabelAxis.

Reimplemented in LogarithmicNumberAxis.

void NumberAxis::IntegerValues ( bool  intValues = true)
inline

Set whether to use integer values instead of doubles.

Parameters
intValuesif true than use integer values, false - double values

Definition at line 43 of file numberaxis.h.

virtual bool NumberAxis::IsEnd ( size_t  step)
protectedvirtual

Check whether step is last.

Parameters
stepstep
Returns
true if step is last

Implements LabelAxis.

void NumberAxis::SetFixedBounds ( double  minValue,
double  maxValue 
)

Make data bounds fixed.

Parameters
minValueminimal data value
maxValuemaximal data value
void NumberAxis::SetMultiplier ( double  multiplier)

Sets multiplier for values.

Parameters
multipliermultiplier
void NumberAxis::SetTickFormat ( const wxString &  tickFormat)
inline

Sets format for tick marks.

Parameters
tickFormattick format

Definition at line 31 of file numberaxis.h.

References LabelAxis::wxDEPRECATED_MSG().

void NumberAxis::ZeroOrigin ( bool  zeroOrigin = true)
inline

Set whether the axis origin starts at zero.

This setting is enabled by default. Note: this setting is ignored if the axis bounds are set manually by SetFixedBounds.

Parameters
zeroOriginIf true, the minimum value on the axis is zero. If false, then the minimum value will be calculated from the dataset.

Definition at line 58 of file numberaxis.h.


The documentation for this class was generated from the following file: