wxFreeChart
|
Base class for all axes. More...
#include <axis.h>
Public Member Functions | |
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... | |
Dataset * | GetDataset (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 void | GetDataBounds (double &minValue, double &maxValue) const =0 |
Returns data bounds. More... | |
virtual wxCoord | GetExtent (wxDC &dc)=0 |
Used to determine minimal size needed to draw axis contents, minimal width for vertical axes, minimal height for horizontal. 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... | |
virtual bool | UpdateBounds ()=0 |
Performs axis bounds update after dataset/s change. | |
virtual void | Draw (wxDC &dc, wxRect rc)=0 |
Performs axis drawing. More... | |
virtual void | DrawGridLines (wxDC &dc, wxRect rcData)=0 |
Draws grid lines for axis. More... | |
Protected Member Functions | |
virtual bool | AcceptDataset (Dataset *dataset)=0 |
Checks whether dataset can be accepted by this axis. More... | |
Protected Attributes | |
DatasetArray | m_datasets |
wxPen | m_majorGridlinePen |
wxPen | m_minorGridlinePen |
wxCoord | m_marginMin |
wxCoord | m_marginMax |
double | m_winPos |
double | m_winWidth |
bool | m_useWin |
Friends | |
class | Plot |
class | AxisShare |
Base class for all axes.
Axis has following attributes:
Axis::Axis | ( | AXIS_LOCATION | location | ) |
Constructs new axis.
location | axis location (cannot be changed after axis created) |
|
protectedpure 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, NumberAxis, CompDateAxis, DateAxis, and CategoryAxis.
Referenced by NumberAxis::ForceExtraMajorInterval(), DateAxis::SetDateFormat(), and CompDateAxis::SetSpanDraw().
|
inline |
internal.
Don't use from programs.
Definition at line 243 of file axis.h.
References AxisShare::AcceptDataset(), AxisShare::BoundValue(), AxisShare::Draw(), AxisShare::DrawGridLines(), AxisShare::GetDataBounds(), AxisShare::GetExtent(), AxisShare::IsVisible(), AxisShare::ToData(), AxisShare::ToGraphics(), and AxisShare::UpdateBounds().
|
virtual |
Returns nearest boundary value.
value | out of bounds value, for which will be returned boundary value |
Reimplemented in AxisShare, and LogarithmicNumberAxis.
|
pure virtual |
Performs axis drawing.
dc | device context |
rc | rectangle where to draw |
Implemented in AxisShare, LabelAxis, and CompDateAxis.
Referenced by LabelAxis::GetMinorIntervalCout().
|
pure virtual |
Draws grid lines for axis.
dc | device context |
rc | data area rectangle of plot |
Implemented in AxisShare, LabelAxis, and CompDateAxis.
Referenced by LabelAxis::GetMinorIntervalCout().
|
pure virtual |
Returns data bounds.
minValue | output minimal data value |
maxValue | output maximal data value |
Implemented in AxisShare, NumberAxis, CompDateAxis, DateAxis, and CategoryAxis.
Referenced by NumberAxis::ForceExtraMajorInterval(), and DateAxis::SetDateFormat().
Dataset* Axis::GetDataset | ( | size_t | index | ) |
Returns dataset, linked with this axis at specified index.
index | dataset index |
Referenced by AxisPlot::GetAxisDataset(), and GetMinorGridlinePen().
size_t Axis::GetDatasetCount | ( | ) |
Returns dataset counts, linked with this axis.
Referenced by GetMinorGridlinePen().
|
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, LabelAxis, and CompDateAxis.
Referenced by LabelAxis::GetMinorIntervalCout().
|
inline |
|
inline |
|
inline |
Gets the pen that is currently used to draw minor gridlines on this axis.
Definition at line 121 of file axis.h.
References GetDataset(), and GetDatasetCount().
|
inline |
Returns window bounds.
If window is not used, simply returns data bounds.
winMin | out for window minimal |
winMax | out for window maximal |
Definition at line 225 of file axis.h.
References AxisShare::GetDataBounds().
|
inline |
|
inline |
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 |
Referenced by SetWindow().
|
inline |
Checks whether axis is horizontal.
Definition at line 75 of file axis.h.
References IsVertical(), and SetMargins().
|
inline |
Checks whether axis is vertical.
Definition at line 66 of file axis.h.
Referenced by IsHorizontal().
|
virtual |
Checks whether data value is visible.
value | value in data space |
Reimplemented in AxisShare, and LogarithmicNumberAxis.
|
inline |
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 |
Referenced by IsHorizontal().
|
inline |
|
inline |
|
inline |
Sets window params (position and width).
Window params are in data space.
winPos | new window position |
winWidth | new window width |
Definition at line 203 of file axis.h.
References IntersectsWindow().
Referenced by SetWindowPosition(), and SetWindowWidth().
|
inline |
Sets window position.
Window position is in data space.
winPos | new window position |
Definition at line 173 of file axis.h.
References SetWindow().
|
inline |
Sets window width.
Window width is in data space.
winWidth | new window width |
Definition at line 155 of file axis.h.
References SetWindow().
|
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, LogarithmicNumberAxis, and CompDateAxis.
|
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.