wxFreeChart
legend.h
1 // Name: legend.h
3 // Purpose: Legend 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 LEGEND_H_
11 #define LEGEND_H_
12 
13 #include <wx/wxfreechartdefs.h>
14 #include <wx/dataset.h>
15 #include <wx/areadraw.h>
16 #include <wx/category/categorydataset.h>
21 class WXDLLIMPEXP_FREECHART Legend
22 {
23 public:
27  const static wxCoord labelsSpacing;
28 
37  Legend(int vertPosition, int horizPosition,
38  AreaDraw *background = new FillAreaDraw(), int symbolTextGap = 2, int margin = 2);
39 
40  virtual ~Legend();
41 
48  void Draw(wxDC &dc, wxRect rc, DatasetArray &datasets);
49  void Draw(wxDC &dc, wxRect rc, CategoryDataset &dataset);
50 
56  {
57  return m_vertPosition;
58  }
59 
65  {
66  return m_horizPosition;
67  }
68 
73  void SetTextFont(wxFont font)
74  {
75  m_font = font;
76  }
77 
82  wxFont GetTextFont()
83  {
84  return m_font;
85  }
86 
93  wxSize GetExtent(wxDC &dc, DatasetArray &datasets);
94  wxSize GetExtent(wxDC &dc, CategoryDataset &dataset);
95 
96 private:
97  int m_vertPosition;
98  int m_horizPosition;
99 
100  wxFont m_font;
101 
102  AreaDraw *m_background;
103 
104  int m_symbolTextGap;
105  int m_margin;
106 };
107 
108 #endif /*LEGEND_H_*/
int GetHorizPosition()
Returns legend horizontal position.
Definition: legend.h:64
Dataset for data values in form [category name, value].
static const wxCoord labelsSpacing
Space between serie labels.
Definition: legend.h:27
void SetTextFont(wxFont font)
Sets font to draw legend labels.
Definition: legend.h:73
int GetVertPosition()
Returns legend vertical position.
Definition: legend.h:55
Legend.
Definition: legend.h:21
Fills area with specified brush and draw outline of area with specified pen.
Definition: areadraw.h:55
Base class for drawing area background.
Definition: areadraw.h:22
wxFont GetTextFont()
Returns font to draw legend labels.
Definition: legend.h:82