Version: 0.6.0
numberaxis.h
1 // Name: numberaxis.h
3 // Purpose: Number axis declaration.
4 // Author: Moskvichev Andrey V.
5 // Created: 2008/11/07
6 // Copyright: (c) 2008-2010 Moskvichev Andrey V.
7 // Licence: wxWidgets licence
9 
10 #ifndef NUMBERAXIS_H_
11 #define NUMBERAXIS_H_
12 
13 #include <wx/axis/labelaxis.h>
14 
18 class WXDLLIMPEXP_FREECHART NumberAxis : public LabelAxis
19 {
20  DECLARE_CLASS(NumberAxis)
21 public:
22  NumberAxis(AXIS_LOCATION location);
23  virtual ~NumberAxis();
24 
25  virtual void UpdateBounds();
26 
31  void SetTickFormat(const wxString &tickFormat)
32  {
33  m_tickFormat = tickFormat;
34  FireAxisChanged();
35  }
36 
41  void SetLabelCount(size_t labelCount)
42  {
43  if (m_labelCount != labelCount) {
44  m_labelCount = labelCount;
45  FireAxisChanged();
46  }
47  }
48 
53  void IntegerValues(bool intValues = true)
54  {
55  if (m_intValues != intValues) {
56  m_intValues = intValues;
57  // TODO recalc tick steps
58  FireAxisChanged();
59  }
60  }
61 
66  double GetMultiplier() const;
67 
72  void SetMultiplier(double multiplier);
73 
79  void SetFixedBounds(double minValue, double maxValue);
80 
86  virtual void GetDataBounds(double &minValue, double &maxValue) const;
87 
92  size_t GetLabelCount() const;
93 
94 protected:
95  virtual bool AcceptDataset(Dataset *dataset);
96  void UpdateTickValues();
97 
98  //
99  // LabelAxis
100  //
101  virtual double GetValue(size_t step);
102 
103  virtual void GetLabel(size_t step, wxString &label);
104 
105  virtual bool IsEnd(size_t step);
106 
107  virtual bool HasLabels();
108 
109  virtual wxSize GetLongestLabelExtent(wxDC &dc);
110 
111  bool m_fixedBounds;
112  bool m_hasLabels;
113  double m_minValue;
114  double m_maxValue;
115 
116 private:
117 
118 
119  wxString m_tickFormat;
120 
121 
122  double m_labelInterval;
123 
124  size_t m_labelCount;
125  bool m_intValues;
126 
127  double m_multiplier;
128 
129 
130 };
131 
132 #endif /*NUMBERAXIS_H_*/
virtual void UpdateBounds()=0
virtual bool IsEnd(size_t step)=0
Definition: labelaxis.h:27
virtual bool AcceptDataset(Dataset *dataset)=0
void SetTickFormat(const wxString &tickFormat)
Definition: numberaxis.h:31
virtual double GetValue(size_t step)=0
void SetLabelCount(size_t labelCount)
Definition: numberaxis.h:41
virtual void GetDataBounds(double &minValue, double &maxValue) const =0
virtual void GetLabel(size_t step, wxString &label)=0
void IntegerValues(bool intValues=true)
Definition: numberaxis.h:53
Definition: dataset.h:50
Definition: numberaxis.h:18