Version: 0.6.0
pieplot.h
1 // Name: pieplot.h
3 // Purpose: pie plot declarations
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 PIEPLOT_H_
11 #define PIEPLOT_H_
12 
13 #include <wx/plot.h>
14 #include <wx/category/categorydataset.h>
15 #include <wx/category/categoryrenderer.h>
16 #include <wx/legend.h>
17 #include <wx/xy/xyarearenderer.h>
18 
19 #include <wx/colorscheme.h>
20 
21 const int shift3D = 20;
22 
27 class WXDLLIMPEXP_FREECHART PiePlot : public Plot, public DatasetObserver
28 {
29 public:
30  PiePlot();
31  virtual ~PiePlot();
32 
33  void SetDataset(CategoryDataset *dataset);
34 
35  void SetUsedSerie(size_t serie)
36  {
37  m_serie = serie;
38  FirePlotNeedRedraw();
39  }
40 
41  void SetColorScheme(ColorScheme *cs);
42 
43  void Set3DView(bool use3DView)
44  {
45  if (m_use3DView != use3DView) {
46  m_use3DView = use3DView;
47  FirePlotNeedRedraw();
48  }
49  }
50 
51  void SetEllipticAspect(float ellipticAspect)
52  {
53  if (m_ellipticAspect != ellipticAspect && ellipticAspect > 0 && ellipticAspect <= 1) {
54  m_ellipticAspect = ellipticAspect;
55  FirePlotNeedRedraw();
56  }
57  }
58 
59  void SetLegend(Legend *legend);
60 
61  //
62  // DatasetObserver
63  //
64  virtual void DatasetChanged(Dataset *dataset);
65 
66 protected:
67  virtual bool HasData();
68 
69  virtual void DrawData(wxDC &dc, wxRect rc);
70 
71 private:
72 
73  bool m_use3DView;
74  float m_ellipticAspect;
75 
76  wxFont m_labelsFont;
77  wxPen m_outlinePen;
78 
79  CategoryDataset *m_dataset;
80 
81  ColorScheme m_colorScheme;
82 
83  size_t m_serie;
84 
85  wxCoord m_legendPlotGap; // distance between plot and legend
86 
87  Legend *m_legend;
88 };
89 
90 #endif /*PIEPLOT_H_*/
Definition: categorydataset.h:19
Definition: legend.h:21
virtual void DrawData(wxDC &dc, wxRect rc)=0
virtual bool HasData()=0
Definition: colorscheme.h:21
Definition: plot.h:42
Definition: pieplot.h:27
Definition: dataset.h:50
Definition: dataset.h:37