00001
00002
00003
00004
00005
00006
00007
00009
00010 #ifndef BARRENDERER_H_
00011 #define BARRENDERER_H_
00012
00013 #include "wx/xy/xyrenderer.h"
00014 #include "wx/areadraw.h"
00015
00016 class CategoryDataset;
00017 class BarRenderer;
00018
00023 class WXDLLIMPEXP_FREECHART BarType
00024 {
00025 public:
00026 BarType(double base);
00027 virtual ~BarType();
00028
00040 virtual void Draw(BarRenderer *barRenderer, wxDC &dc, wxRect rc, Axis *horizAxis, Axis *vertAxis, bool vertical, size_t item, CategoryDataset *dataset);
00041
00042
00043
00044
00045 virtual double GetMinValue(CategoryDataset *dataset);
00046 virtual double GetMaxValue(CategoryDataset *dataset);
00047
00048 protected:
00060 virtual void GetBarGeometry(CategoryDataset *dataset, size_t item, size_t serie,
00061 int &width, wxCoord &shift, double &base, double &value) = 0;
00062
00063 double m_base;
00064 };
00065
00069 class WXDLLIMPEXP_FREECHART NormalBarType : public BarType
00070 {
00071 public:
00078 NormalBarType(int barWidth, int serieGap = 1, double base = 0.0);
00079 virtual ~NormalBarType();
00080
00081 protected:
00082 virtual void GetBarGeometry(CategoryDataset *dataset, size_t item, size_t serie,
00083 int &width, wxCoord &shift, double &base, double &value);
00084
00085 private:
00086 int m_barWidth;
00087 int m_serieGap;
00088 };
00089
00093 class WXDLLIMPEXP_FREECHART StackedBarType : public BarType
00094 {
00095 public:
00101 StackedBarType(int barWidth, double base);
00102 virtual ~StackedBarType();
00103
00104 virtual double GetMinValue(CategoryDataset *dataset);
00105 virtual double GetMaxValue(CategoryDataset *dataset);
00106
00107 protected:
00108 virtual void GetBarGeometry(CategoryDataset *dataset, size_t item, size_t serie,
00109 int &width, wxCoord &shift, double &base, double &value);
00110
00111 private:
00112 int m_barWidth;
00113 };
00114
00118 class WXDLLIMPEXP_FREECHART LayeredBarType : public BarType
00119 {
00120 public:
00126 LayeredBarType(int initialBarWidth, double base);
00127 virtual ~LayeredBarType();
00128
00129 protected:
00130 virtual void GetBarGeometry(CategoryDataset *dataset, size_t item, size_t serie,
00131 int &width, wxCoord &shift, double &base, double &value);
00132
00133 private:
00134 int m_initialBarWidth;
00135 };
00136
00140 class WXDLLIMPEXP_FREECHART BarRenderer : public Renderer
00141 {
00142 DECLARE_CLASS(BarRenderer)
00143 public:
00149 BarRenderer(BarType *barType);
00150 virtual ~BarRenderer();
00151
00152
00153
00154
00155 virtual void DrawLegendSymbol(wxDC &dc, wxRect rcSymbol, size_t serie);
00156
00165 void Draw(wxDC &dc, wxRect rc, Axis *horizAxis, Axis *vertAxis, bool vertical, CategoryDataset *dataset);
00166
00173 void SetBarType(BarType *barType);
00174
00179 BarType *GetBarType();
00180
00186 void SetBarDraw(size_t serie, AreaDraw *areaDraw);
00187
00193 AreaDraw *GetBarDraw(size_t serie);
00194
00195 double GetMinValue(CategoryDataset *dataset);
00196 double GetMaxValue(CategoryDataset *dataset);
00197
00198 private:
00199 BarType *m_barType;
00200
00201 AreaDrawCollection m_barDraws;
00202 };
00203
00204 #endif