wxFreeChart
plot.h
1 // Name: plot.h
3 // Purpose: plot base class 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 PLOT_H_
11 #define PLOT_H_
12 
13 #include <wx/wxfreechartdefs.h>
14 #include <wx/areadraw.h>
15 #include <wx/chartdc.h>
16 
17 class WXDLLIMPEXP_FREECHART Plot;
18 class WXDLLIMPEXP_FREECHART wxChartPanel;
19 
20 enum PlotDrawMode
21 {
22  PLOT_DRAW_BACKGROUND,
23  PLOT_DRAW_DATA,
24  PLOT_DRAW_ALL
25 };
26 
31 class WXDLLIMPEXP_FREECHART Plot
32 {
33 public:
34  Plot();
35  virtual ~Plot();
36 
42  virtual void Draw(ChartDC &cdc, wxRect rc, PlotDrawMode mode = PLOT_DRAW_ALL);
43 
50  virtual void DrawNoDataMessage(wxDC &dc, wxRect rc);
51 
52  void SetChartPanel(wxChartPanel *chartPanel);
53 
58  wxChartPanel *GetChartPanel();
59 
60 
65  void SetBackground(AreaDraw *background)
66  {
67  wxREPLACE(m_background, background);
68  }
69 
74  void SetTextNoData(const wxString &textNoData)
75  {
76  m_textNoData = textNoData;
77  }
78 
79 protected:
85  virtual bool HasData() = 0;
86 
93  virtual void DrawData(ChartDC& cdc, wxRect rc) = 0;
94 
101  virtual void DrawBackground(ChartDC& cdc, wxRect rc) = 0;
102 
108  virtual void ChartPanelChanged(wxChartPanel *oldPanel, wxChartPanel *newPanel);
109 
110  AreaDraw *m_background;
111 
112 private:
113  wxFont m_textNoDataFont;
114  wxString m_textNoData;
115 
116  wxChartPanel *m_chartPanel;
117 };
118 
119 #endif /*PLOT_H_*/
Base class for all plots.
Definition: plot.h:31
ChartPanel is wxWidgets panel for displaying chart.
Definition: chartpanel.h:34
DC that includes a flag to indicate antialiased drawing should be used where appropriate.
Definition: chartdc.h:18
void SetTextNoData(const wxString &textNoData)
Sets text message drawn, when plot has no data to draw.
Definition: plot.h:74
void SetBackground(AreaDraw *background)
Sets plot background.
Definition: plot.h:65
Base class for drawing area background.
Definition: areadraw.h:22