00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #ifndef __XYDYNAMICDATASET_H
00012 #define __XYDYNAMICDATASET_H
00013
00014 #include <wx/wx.h>
00015 #include <wx/gdicmn.h>
00016 #include <wx/dynarray.h>
00017
00018 #include "wx/wxfreechartdefs.h"
00019 #include "wx/xy/xydataset.h"
00020
00021 class WXDLLIMPEXP_FREECHART XYDynamicDataset;
00022
00023 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRealPoint
00024 , wxRealPointArray
00025 , WXDLLIMPEXP_FREECHART);
00026
00031 class WXDLLIMPEXP_FREECHART XYDynamicSerie : public wxObject
00032 {
00033
00034 DECLARE_CLASS(XYDynamicSerie);
00035
00036 public:
00037 friend class XYDynamicDataset;
00038
00039 XYDynamicSerie();
00040 XYDynamicSerie(const wxRealPointArray& data);
00041
00042 virtual ~XYDynamicSerie();
00043
00049 double GetX(size_t index);
00050
00056 double GetY(size_t index);
00057
00063 wxRealPoint GetXY(size_t index);
00064
00069 size_t GetCount();
00070
00075 const wxString &GetName();
00076
00081 void SetName(const wxString &name);
00082
00088 void AddXY(double x, double y);
00089
00094 void AddXY(const wxRealPoint& xy);
00095
00100 void AddXY(const wxRealPointArray& data);
00101
00108 void Insert(size_t index, double x, double y);
00109
00115 void Insert(size_t index, const wxRealPoint& xy);
00116
00122 void Insert(size_t index, const wxRealPointArray& data);
00123
00129 void Remove(size_t index, size_t count = 1);
00130
00134 void Clear();
00135
00136 private:
00137 void SetDataset(XYDynamicDataset *dataset);
00138
00139 wxRealPointArray m_data;
00140 wxString m_name;
00141 XYDynamicDataset *m_dataset;
00142 };
00143
00144 WX_DECLARE_USER_EXPORTED_OBJARRAY(XYDynamicSerie *
00145 , XYDynamicSerieArray
00146 , WXDLLIMPEXP_FREECHART);
00147
00151 class WXDLLIMPEXP_FREECHART XYDynamicDataset : public XYDataset
00152 {
00153 DECLARE_CLASS(XYDynamicDataset);
00154
00155 public:
00156 friend class XYDynamicSerie;
00157
00158 XYDynamicDataset();
00159 virtual ~XYDynamicDataset();
00160
00165 void AddSerie(const wxRealPointArray& data);
00166
00171 void AddSerie(XYDynamicSerie *serie);
00172
00173 virtual size_t GetSerieCount();
00174
00175 virtual wxString GetSerieName(size_t serie);
00176 void SetSerieName(size_t serie, const wxString &name);
00177
00178 virtual double GetX(size_t index, size_t serie);
00179 virtual double GetY(size_t index, size_t serie);
00180 virtual size_t GetCount(size_t serie);
00181
00182 private:
00183 XYDynamicSerieArray m_series;
00184 };
00185
00186 #endif
00187