Axis Class Reference

#include <axis.h>

Inheritance diagram for Axis:

Inheritance graph
[legend]
Collaboration diagram for Axis:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Axis (AXIS_LOCATION location)
AXIS_LOCATION GetLocation ()
bool IsVertical ()
bool IsHorizontal ()
void SetMargins (wxCoord marginMin, wxCoord marginMax)
size_t GetDatasetCount ()
DatasetGetDataset (size_t index)
void SetWindowWidth (double winWidth)
double GetWindowWidth ()
void SetWindowPosition (double winPos)
double GetWindowPosition ()
void SetUseWindow (bool useWin)
void SetWindow (double winPos, double winWidth)
bool IntersectsWindow (double v0, double v1)
void GetWindowBounds (double &winMin, double &winMax)
void AddDataset (Dataset *dataset)
virtual void GetDataBounds (double &minValue, double &maxValue)=0
virtual wxCoord GetExtent (wxDC &dc)=0
virtual bool IsVisible (double value)
virtual double BoundValue (double value)
virtual wxCoord ToGraphics (wxDC &dc, int minCoord, int gRange, double value)
virtual double ToData (wxDC &dc, int minCoord, int gRange, wxCoord g)
virtual void UpdateBounds ()=0
virtual void Draw (wxDC &dc, wxRect rc)=0
virtual void DrawGridLines (wxDC &dc, wxRect rcData)=0

Protected Member Functions

virtual bool AcceptDataset (Dataset *dataset)=0
 FIRE_WITH_THIS (AxisChanged)
 FIRE_WITH_THIS (BoundsChanged)

Protected Attributes

DatasetArray m_datasets
wxPen m_gridLinesPen
wxCoord m_marginMin
wxCoord m_marginMax
double m_winPos
double m_winWidth
bool m_useWin

Friends

class Plot
class AxisShare


Detailed Description

Base class for all axes. Axis has following attributes:
  1. Location - where axis arranged on plot, can be: AXIS_LEFT, AXIS_RIGHT, AXIS_TOP, AXIS_BOTTOM.
  2. Margins - distance from plot edges to axis labels.
  3. Window - visible subset of data. Window has width and position. Width means how much data points is visible at once, position is first data item visible.

Constructor & Destructor Documentation

Axis::Axis ( AXIS_LOCATION  location  ) 

Constructs new axis.

Parameters:
location axis location (cannot be changed after axis created)


Member Function Documentation

virtual bool Axis::AcceptDataset ( Dataset dataset  )  [protected, pure virtual]

Checks whether dataset can be accepted by this axis. Must be implemented by derivative classes. XXX: maybe remove this method later.

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

Implemented in AxisShare, CategoryAxis, CompDateAxis, DateAxis, and NumberAxis.

void Axis::AddDataset ( Dataset dataset  )  [inline]

internal. Don't use from programs.

References AxisShare::AcceptDataset().

virtual double Axis::BoundValue ( double  value  )  [virtual]

Returns nearest boundary value.

Parameters:
value out of bounds value, for which will be returned boundary value
Returns:
nearest boundary value

Reimplemented in AxisShare.

virtual void Axis::Draw ( wxDC &  dc,
wxRect  rc 
) [pure virtual]

Performs axis drawing.

Parameters:
dc device context
rc rectangle where to draw

Implemented in AxisShare, CompDateAxis, and LabelAxis.

virtual void Axis::DrawGridLines ( wxDC &  dc,
wxRect  rcData 
) [pure virtual]

Draws grid lines for axis.

Parameters:
dc device context
rc data area rectangle of plot

Implemented in AxisShare, CompDateAxis, and LabelAxis.

virtual void Axis::GetDataBounds ( double &  minValue,
double &  maxValue 
) [pure virtual]

Returns data bounds.

Parameters:
minValue output minimal data value
maxValue output maximal data value

Implemented in AxisShare, CategoryAxis, CompDateAxis, DateAxis, and NumberAxis.

Dataset* Axis::GetDataset ( size_t  index  ) 

Returns dataset, linked with this axis at specified index.

Parameters:
index dataset index
Returns:
dataset at index

Referenced by AxisPlot::GetAxisDataset().

size_t Axis::GetDatasetCount (  ) 

Returns dataset counts, linked with this axis.

Returns:
dataset counts, linked with this axis

virtual wxCoord Axis::GetExtent ( wxDC &  dc  )  [pure virtual]

Used to determine minimal size needed to draw axis contents, minimal width for vertical axes, minimal height for horizontal.

Parameters:
dc device context
Returns:
extent

Implemented in AxisShare, CompDateAxis, and LabelAxis.

AXIS_LOCATION Axis::GetLocation (  )  [inline]

Returns axis location.

Returns:
axis location

void Axis::GetWindowBounds ( double &  winMin,
double &  winMax 
) [inline]

Returns window bounds. If window is not used, simply returns data bounds.

Parameters:
winMin out for window minimal
winMax out for window maximal

References AxisShare::GetDataBounds().

double Axis::GetWindowPosition (  )  [inline]

Returns window position.

Returns:
window position

double Axis::GetWindowWidth (  )  [inline]

Returns window width.

Returns:
window width

bool Axis::IntersectsWindow ( double  v0,
double  v1 
)

Checks whether line in data space intersects window.

Parameters:
v0 line begin in data space
v0 line end in data space
Returns:
true if line intersects window

bool Axis::IsHorizontal (  )  [inline]

Checks whether axis is horizontal.

Returns:
true if axis is horizontal, false - overwise

References IsVertical().

bool Axis::IsVertical (  )  [inline]

Checks whether axis is vertical.

Returns:
true if axis is vertical, false - overwise

Referenced by IsHorizontal().

virtual bool Axis::IsVisible ( double  value  )  [virtual]

Checks whether data value is visible.

Parameters:
value value in data space
Returns:
true if data value is visible

Reimplemented in AxisShare.

void Axis::SetMargins ( wxCoord  marginMin,
wxCoord  marginMax 
)

Sets minimal/maximal margins for axis. Eg bottom/top for vertical axes, left/right for horizontal.

Parameters:
marginMin new minimal margin
marginMax new maximal margin

void Axis::SetUseWindow ( bool  useWin  )  [inline]

Sets whether to use window.

Parameters:
useWin true to use window

void Axis::SetWindow ( double  winPos,
double  winWidth 
) [inline]

Sets window params (position and width). Window params are in data space.

Parameters:
winPos new window position
winWidth new window width

Referenced by SetWindowPosition(), and SetWindowWidth().

void Axis::SetWindowPosition ( double  winPos  )  [inline]

Sets window position. Window position is in data space.

Parameters:
winPos new window position

References SetWindow().

void Axis::SetWindowWidth ( double  winWidth  )  [inline]

Sets window width. Window width is in data space.

Parameters:
winWidth new window width

References SetWindow().

virtual double Axis::ToData ( wxDC &  dc,
int  minCoord,
int  gRange,
wxCoord  g 
) [virtual]

Transforms coordinate from graphics space to data space.

Parameters:
dc device context
minCoord minimal graphics space coordinate
gRange graphics space range
value value in data space
Returns:
coordinate in data space

Reimplemented in AxisShare, CompDateAxis, and LogarithmicNumberAxis.

virtual wxCoord Axis::ToGraphics ( wxDC &  dc,
int  minCoord,
int  gRange,
double  value 
) [virtual]

Transforms coordinate from data space to graphics space.

Parameters:
dc device context
minCoord minimal graphics space coordinate
gRange graphics space range
value value in data space
Returns:
value in graphics space

Reimplemented in AxisShare, CompDateAxis, and LogarithmicNumberAxis.

virtual void Axis::UpdateBounds (  )  [pure virtual]

Performs axis bounds update after dataset/s change.

Implemented in AxisShare, CategoryAxis, CompDateAxis, DateAxis, and NumberAxis.


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

Generated on Mon Feb 15 21:32:22 2010 for wxFreeChart by  doxygen 1.5.8