wxFreeChart
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
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  }
39 
40  void SetColorScheme(ColorScheme *cs);
41 
42  void Set3DView(bool use3DView)
43  {
44  if (m_use3DView != use3DView)
45  m_use3DView = use3DView;
46  }
47 
48  void SetEllipticAspect(float ellipticAspect)
49  {
50  if (m_ellipticAspect != ellipticAspect && ellipticAspect > 0 && ellipticAspect <= 1)
51  m_ellipticAspect = ellipticAspect;
52  }
53 
54  void SetLegend(Legend *legend);
55 
56  //
57  // DatasetObserver
58  //
59  virtual void DatasetChanged(Dataset *dataset);
60 
61 protected:
62  virtual bool HasData();
63 
64  virtual void DrawData(ChartDC& cdc, wxRect rc);
65 
66  virtual void DrawBackground(ChartDC& cdc, wxRect rc) {}; // Does nothing in a pie plot?
67 
68 private:
69 
70  bool m_use3DView;
71  float m_ellipticAspect;
72 
73  wxFont m_labelsFont;
74  wxPen m_outlinePen;
75 
76  CategoryDataset *m_dataset;
77 
78  ColorScheme m_colorScheme;
79 
80  size_t m_serie;
81 
82  wxCoord m_legendPlotGap; // distance between plot and legend
83 
84  Legend *m_legend;
85 };
86 
87 #endif /*PIEPLOT_H_*/
Dataset for data values in form [category name, value].
Base class for all plots.
Definition: plot.h:31
DC that includes a flag to indicate antialiased drawing should be used where appropriate.
Definition: chartdc.h:18
Pie plot.
Definition: pieplot.h:27
Defines set of colors for use by PiePlots, etc...
Definition: colorscheme.h:21
virtual bool HasData()=0
Checks whether plot has data.
Legend.
Definition: legend.h:21
Base class for all datasets (XYDatasets, XYZDatasets, CategoryDatasets, OHLCDatasets, etc).
Definition: dataset.h:39
virtual void DrawBackground(ChartDC &cdc, wxRect rc)
Draw the plot&#39;s static items (e.g.
Definition: pieplot.h:66
virtual void DrawData(ChartDC &cdc, wxRect rc)=0
Draw the plot data, i.e.