#include <axis.h>
Public Member Functions | |
Axis (AXIS_LOCATION location) | |
AXIS_LOCATION | GetLocation () |
bool | IsVertical () |
bool | IsHorizontal () |
void | SetMargins (wxCoord marginMin, wxCoord marginMax) |
size_t | GetDatasetCount () |
Dataset * | GetDataset (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 |
Axis::Axis | ( | AXIS_LOCATION | location | ) |
Constructs new axis.
location | axis location (cannot be changed after axis created) |
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.
dataset | dataset to be checked |
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.
value | out of bounds value, for which will be returned boundary value |
Reimplemented in AxisShare.
virtual void Axis::Draw | ( | wxDC & | dc, | |
wxRect | rc | |||
) | [pure virtual] |
Performs axis drawing.
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.
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.
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.
index | dataset index |
Referenced by AxisPlot::GetAxisDataset().
size_t Axis::GetDatasetCount | ( | ) |
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.
dc | device context |
Implemented in AxisShare, CompDateAxis, and LabelAxis.
AXIS_LOCATION Axis::GetLocation | ( | ) | [inline] |
Returns axis location.
void Axis::GetWindowBounds | ( | double & | winMin, | |
double & | winMax | |||
) | [inline] |
Returns window bounds. If window is not used, simply returns data bounds.
winMin | out for window minimal | |
winMax | out for window maximal |
References AxisShare::GetDataBounds().
double Axis::GetWindowPosition | ( | ) | [inline] |
Returns window position.
double Axis::GetWindowWidth | ( | ) | [inline] |
Returns window width.
bool Axis::IntersectsWindow | ( | double | v0, | |
double | v1 | |||
) |
Checks whether line in data space intersects window.
v0 | line begin in data space | |
v0 | line end in data space |
bool Axis::IsHorizontal | ( | ) | [inline] |
Checks whether axis is horizontal.
References IsVertical().
bool Axis::IsVertical | ( | ) | [inline] |
Checks whether axis is vertical.
Referenced by IsHorizontal().
virtual bool Axis::IsVisible | ( | double | value | ) | [virtual] |
Checks whether data value is visible.
value | value in data space |
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.
marginMin | new minimal margin | |
marginMax | new maximal margin |
void Axis::SetUseWindow | ( | bool | useWin | ) | [inline] |
Sets whether to use window.
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.
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.
winPos | new window position |
References SetWindow().
void Axis::SetWindowWidth | ( | double | winWidth | ) | [inline] |
Sets window width. Window width is in data space.
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.
dc | device context | |
minCoord | minimal graphics space coordinate | |
gRange | graphics space range | |
value | value 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.
dc | device context | |
minCoord | minimal graphics space coordinate | |
gRange | graphics space range | |
value | value in data 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.