wxFreeChart
ohlcdataset.h
1 // Name: ohlcdataset.h
3 // Purpose: OHLC datasets base class 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 OHLCDATASET_H_
11 #define OHLCDATASET_H_
12 
13 #include <wx/xy/xydataset.h>
14 #include <wx/ohlc/ohlcrenderer.h>
15 
16 struct OHLCItem
17 {
18  double open;
19  double high;
20  double low;
21  double close;
22 
23  int volume;
24 
25  time_t date;
26 };
27 
31 class WXDLLIMPEXP_FREECHART OHLCDataset : public Dataset, public DateTimeDataset
32 {
33  DECLARE_CLASS(OHLCDataset)
34 public:
35  OHLCDataset();
36  virtual ~OHLCDataset();
37 
38  OHLCRenderer *GetRenderer()
39  {
40  return (OHLCRenderer *) m_renderer;
41  }
42 
47  void SetSerieName(const wxString &serieName)
48  {
49  m_serieName = serieName;
50  DatasetChanged();
51  }
52 
57  virtual OHLCItem *GetItem(size_t index) = 0;
58 
63  virtual size_t GetCount() = 0;
64 
65  //
66  // Dataset
67  //
68  virtual double GetMinValue(bool verticalAxis);
69 
70  virtual double GetMaxValue(bool verticalAxis);
71 
72  virtual size_t GetSerieCount();
73 
74  virtual wxString GetSerieName(size_t serie);
75 
76  virtual size_t GetCount(size_t serie);
77 
78  virtual DateTimeDataset *AsDateTimeDataset();
79 
80  //
81  // DateDataset
82  //
83  virtual time_t GetDate(size_t index);
84 
85 protected:
86  virtual bool AcceptRenderer(Renderer *r);
87 
88  wxString m_serieName;
89 };
90 
91 #endif /*OHLCDATASET_H_*/
Base class for all renderers.
Definition: chartrenderer.h:21
Open-High-Low-Close datasets base class.
Definition: ohlcdataset.h:31
void SetSerieName(const wxString &serieName)
Sets serie name.
Definition: ohlcdataset.h:47
Base class for all datasets (XYDatasets, XYZDatasets, CategoryDatasets, OHLCDatasets, etc).
Definition: dataset.h:39
Base class for datasets, with date/time.
Definition: dataset.h:153
Base class for rendering OHLC data.
Definition: ohlcrenderer.h:30