13 #include <wx/wxfreechartdefs.h>
14 #include <wx/dataset.h>
16 #include <wx/dynarray.h>
18 #include <wx/drawobject.h>
19 #include <wx/observable.h>
28 class WXDLLIMPEXP_FREECHART
Axis;
43 virtual void AxisChanged(
Axis *axis) = 0;
49 virtual void BoundsChanged(
Axis *axis) = 0;
62 class WXDLLIMPEXP_FREECHART
Axis :
public wxObject,
public Observable<AxisObserver>
73 Axis(AXIS_LOCATION location);
91 return (m_location == AXIS_LEFT) || (m_location == AXIS_RIGHT);
109 void SetMargins(wxCoord marginMin, wxCoord marginMax);
130 void SetZoomPanMode();
178 if (m_useWin != useWin) {
191 if (m_winPos != winPos || m_winWidth != winWidth) {
193 m_winWidth = winWidth;
214 double minValue, maxValue;
219 winMax = wxMin(maxValue, winMin + m_winWidth);
233 m_datasets.Add(dataset);
242 virtual void GetDataBounds(
double &minValue,
double &maxValue)
const = 0;
274 virtual wxCoord
ToGraphics(wxDC &dc,
int minCoord,
int gRange,
double value);
284 virtual double ToData(wxDC &dc,
int minCoord,
int gRange, wxCoord g);
296 virtual void Draw(wxDC &dc, wxRect rc) = 0;
316 wxPen m_gridLinesPen;
325 FIRE_WITH_THIS(AxisChanged);
326 FIRE_WITH_THIS(BoundsChanged);
329 AXIS_LOCATION m_location;
334 WX_DECLARE_USER_EXPORTED_OBJARRAY(
Axis *, AxisArray, WXDLLIMPEXP_FREECHART);
351 void SetShareVisible(
bool shareVisible);
357 virtual void GetDataBounds(
double &minValue,
double &maxValue)
const;
365 virtual wxCoord
ToGraphics(wxDC &dc,
int minCoord,
int gRange,
double value);
367 virtual double ToData(wxDC &dc,
int minCoord,
int gRange, wxCoord g);
371 virtual void Draw(wxDC &dc, wxRect rc);
384 wxCoord ToGraphics(
int minCoord,
int gRange,
double minValue,
double maxValue, wxCoord margin,
bool vertical,
double value);
385 double ToData(
int minCoord,
int gRange,
double minValue,
double maxValue, wxCoord margin,
bool vertical, wxCoord g);
virtual void DrawGridLines(wxDC &dc, wxRect rcData)
Definition: axis.cpp:225
virtual void GetDataBounds(double &minValue, double &maxValue) const
Definition: axis.cpp:180
virtual double ToData(wxDC &dc, int minCoord, int gRange, wxCoord g)
Definition: axis.cpp:208
virtual void UpdateBounds()=0
virtual bool IsVisible(double value)
Definition: axis.cpp:65
void SetWindowPosition(double winPos)
Definition: axis.h:158
size_t GetDatasetCount()
Definition: axis.cpp:55
virtual void UpdateBounds()
Definition: axis.cpp:213
virtual double BoundValue(double value)
Definition: axis.cpp:89
virtual wxCoord ToGraphics(wxDC &dc, int minCoord, int gRange, double value)
Definition: axis.cpp:111
virtual void DrawGridLines(wxDC &dc, wxRect rcData)=0
virtual double BoundValue(double value)
Definition: axis.cpp:198
virtual bool AcceptDataset(Dataset *dataset)=0
virtual wxCoord GetExtent(wxDC &dc)
Definition: axis.cpp:185
void AddDataset(Dataset *dataset)
Definition: axis.h:230
Definition: dataset.h:189
Axis(AXIS_LOCATION location)
Definition: axis.cpp:25
virtual void GetDataBounds(double &minValue, double &maxValue) const =0
virtual bool IsVisible(double value)
Definition: axis.cpp:193
AXIS_LOCATION GetLocation()
Definition: axis.h:80
Definition: observable.h:14
virtual wxCoord ToGraphics(wxDC &dc, int minCoord, int gRange, double value)
Definition: axis.cpp:203
double GetWindowPosition()
Definition: axis.h:167
bool IsHorizontal()
Definition: axis.h:98
void SetWindow(double winPos, double winWidth)
Definition: axis.h:189
double GetWindowWidth()
Definition: axis.h:149
Dataset * GetDataset(size_t index)
Definition: axis.cpp:60
bool IsVertical()
Definition: axis.h:89
virtual void Draw(wxDC &dc, wxRect rc)
Definition: axis.cpp:218
virtual double ToData(wxDC &dc, int minCoord, int gRange, wxCoord g)
Definition: axis.cpp:130
bool IntersectsWindow(double v0, double v1)
Definition: axis.cpp:78
void SetMargins(wxCoord marginMin, wxCoord marginMax)
Definition: axis.cpp:46
void SetWindowWidth(double winWidth)
Definition: axis.h:140
virtual void Draw(wxDC &dc, wxRect rc)=0
void GetWindowBounds(double &winMin, double &winMax)
Definition: axis.h:212
void SetUseWindow(bool useWin)
Definition: axis.h:176
virtual wxCoord GetExtent(wxDC &dc)=0
virtual bool AcceptDataset(Dataset *dataset)
Definition: axis.cpp:230