13 #include <wx/wxfreechartdefs.h> 14 #include <wx/dataset.h> 16 #include <wx/dynarray.h> 18 #include <wx/drawobject.h> 27 class WXDLLIMPEXP_FREECHART
Axis;
39 class WXDLLIMPEXP_FREECHART
Axis :
public wxObject
50 Axis(AXIS_LOCATION location);
68 return (m_location == AXIS_LEFT) || (m_location == AXIS_RIGHT);
86 void SetMargins(wxCoord marginMin, wxCoord marginMax);
95 m_majorGridlinePen = pen;
105 m_minorGridlinePen = pen;
114 return m_majorGridlinePen;
123 return m_minorGridlinePen;
145 void SetZoomPanMode();
193 if (m_useWin != useWin) {
205 if (m_winPos != winPos || m_winWidth != winWidth) {
207 m_winWidth = winWidth;
227 double minValue, maxValue;
232 winMax = wxMin(maxValue, winMin + m_winWidth);
246 m_datasets.Add(dataset);
255 virtual void GetDataBounds(
double &minValue,
double &maxValue)
const = 0;
287 virtual wxCoord
ToGraphics(wxDC &dc,
int minCoord,
int gRange,
double value);
297 virtual double ToData(wxDC &dc,
int minCoord,
int gRange, wxCoord g);
309 virtual void Draw(wxDC &dc, wxRect rc) = 0;
329 wxPen m_majorGridlinePen;
330 wxPen m_minorGridlinePen;
340 AXIS_LOCATION m_location;
345 WX_DECLARE_USER_EXPORTED_OBJARRAY(
Axis *, AxisArray, WXDLLIMPEXP_FREECHART);
362 void SetShareVisible(
bool shareVisible);
368 virtual void GetDataBounds(
double &minValue,
double &maxValue)
const;
376 virtual wxCoord
ToGraphics(wxDC &dc,
int minCoord,
int gRange,
double value);
378 virtual double ToData(wxDC &dc,
int minCoord,
int gRange, wxCoord g);
382 virtual void Draw(wxDC &dc, wxRect rc);
395 wxCoord
ToGraphics(
int minCoord,
int gRange,
double minValue,
double maxValue, wxCoord margin,
bool vertical,
double value);
396 double ToData(
int minCoord,
int gRange,
double minValue,
double maxValue, wxCoord margin,
bool vertical, wxCoord g);
double GetWindowPosition()
Returns window position.
virtual wxCoord ToGraphics(wxDC &dc, int minCoord, int gRange, double value)
Transforms coordinate from data space to graphics space.
bool IsVertical()
Checks whether axis is vertical.
virtual wxCoord ToGraphics(wxDC &dc, int minCoord, int gRange, double value)
Transforms coordinate from data space to graphics space.
Dataset * GetDataset(size_t index)
Returns dataset, linked with this axis at specified index.
bool IntersectsWindow(double v0, double v1)
Checks whether line in data space intersects window.
virtual wxCoord GetExtent(wxDC &dc)=0
Used to determine minimal size needed to draw axis contents, minimal width for vertical axes...
virtual void Draw(wxDC &dc, wxRect rc)=0
Performs axis drawing.
Base class for all plots.
virtual bool AcceptDataset(Dataset *dataset)
Checks whether dataset can be accepted by this axis.
void SetWindowWidth(double winWidth)
Sets window width.
bool IsHorizontal()
Checks whether axis is horizontal.
virtual double ToData(wxDC &dc, int minCoord, int gRange, wxCoord g)
Transforms coordinate from graphics space to data space.
void SetWindowPosition(double winPos)
Sets window position.
virtual wxCoord GetExtent(wxDC &dc)
Used to determine minimal size needed to draw axis contents, minimal width for vertical axes...
void SetMajorGridlinePen(const wxPen &pen)
Sets the pen to be used for drawing major gridlines.
void SetMargins(wxCoord marginMin, wxCoord marginMax)
Sets minimal/maximal margins for axis.
virtual void GetDataBounds(double &minValue, double &maxValue) const =0
Returns data bounds.
double GetWindowWidth()
Returns window width.
const wxPen & GetMajorGridlinePen()
Gets the pen that is currently used to draw major gridlines on this axis.
Axis(AXIS_LOCATION location)
Constructs new axis.
void SetUseWindow(bool useWin)
Sets whether to use window.
const wxPen & GetMinorGridlinePen()
Gets the pen that is currently used to draw minor gridlines on this axis.
virtual double BoundValue(double value)
Returns nearest boundary value.
virtual void Draw(wxDC &dc, wxRect rc)
Performs axis drawing.
void GetWindowBounds(double &winMin, double &winMax)
Returns window bounds.
virtual double BoundValue(double value)
Returns nearest boundary value.
virtual bool IsVisible(double value)
Checks whether data value is visible.
virtual bool UpdateBounds()=0
Performs axis bounds update after dataset/s change.
Base class for all datasets (XYDatasets, XYZDatasets, CategoryDatasets, OHLCDatasets, etc).
void SetMinorGridlinePen(const wxPen &pen)
Sets the pen to be used for drawing minor gridlines.
virtual bool AcceptDataset(Dataset *dataset)=0
Checks whether dataset can be accepted by this axis.
virtual void DrawGridLines(wxDC &dc, wxRect rcData)
Draws grid lines for axis.
AXIS_LOCATION GetLocation()
Returns axis location.
void AddDataset(Dataset *dataset)
internal.
size_t GetDatasetCount()
Returns dataset counts, linked with this axis.
virtual bool UpdateBounds() wxOVERRIDE
Performs axis bounds update after dataset/s change.
void SetWindow(double winPos, double winWidth)
Sets window params (position and width).
virtual void GetDataBounds(double &minValue, double &maxValue) const
Returns data bounds.
virtual void DrawGridLines(wxDC &dc, wxRect rcData)=0
Draws grid lines for axis.
virtual double ToData(wxDC &dc, int minCoord, int gRange, wxCoord g)
Transforms coordinate from graphics space to data space.
virtual bool IsVisible(double value)
Checks whether data value is visible.