00001
00002
00003
00004
00005
00006
00007
00009
00010 #ifndef NUMBERAXIS_H_
00011 #define NUMBERAXIS_H_
00012
00013 #include <wx/axis/labelaxis.h>
00014
00018 class WXDLLIMPEXP_FREECHART NumberAxis : public LabelAxis
00019 {
00020 DECLARE_CLASS(NumberAxis)
00021 public:
00022 NumberAxis(AXIS_LOCATION location);
00023 virtual ~NumberAxis();
00024
00025 virtual void UpdateBounds();
00026
00031 void SetTickFormat(const wxString &tickFormat)
00032 {
00033 m_tickFormat = tickFormat;
00034 FireAxisChanged();
00035 }
00036
00041 void SetLabelCount(size_t labelCount)
00042 {
00043 if (m_labelCount != labelCount) {
00044 m_labelCount = labelCount;
00045 FireAxisChanged();
00046 }
00047 }
00048
00053 void IntegerValues(bool intValues = true)
00054 {
00055 if (m_intValues != intValues) {
00056 m_intValues = intValues;
00057
00058 FireAxisChanged();
00059 }
00060 }
00061
00067 void SetFixedBounds(double minValue, double maxValue);
00068
00069 protected:
00070 virtual bool AcceptDataset(Dataset *dataset);
00071
00072
00073
00074
00075 virtual double GetValue(size_t step);
00076
00077 virtual void GetLabel(size_t step, wxString &label);
00078
00079 virtual bool IsEnd(size_t step);
00080
00081 virtual bool HasLabels();
00082
00083 virtual wxSize GetLongestLabelExtent(wxDC &dc);
00084
00085 virtual void GetDataBounds(double &minValue, double &maxValue);
00086
00087 size_t GetLabelCount() const;
00088
00089 private:
00090 void UpdateTickValues();
00091
00092 wxString m_tickFormat;
00093
00094 double m_minValue;
00095 double m_maxValue;
00096
00097 double m_labelInterval;
00098
00099 size_t m_labelCount;
00100 bool m_intValues;
00101
00102 bool m_hasLabels;
00103
00104 bool m_fixedBounds;
00105 };
00106
00107 #endif