wxFreeChart
xylinerenderer.h
1 // Name: xylinerenderer.h
3 // Purpose: xy line renderer 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 XYLINERENDERER_H_
11 #define XYLINERENDERER_H_
12 
13 #include <wx/xy/xyrenderer.h>
14 #include <wx/art.h>
15 
16 class WXDLLIMPEXP_FREECHART XYLineRendererBase : public XYRenderer
17 {
18  DECLARE_CLASS(XYLineRendererBase)
19 public:
20  XYLineRendererBase(bool drawSymbols, bool drawLines, int defaultWidth = 2, wxPenStyle defaultStyle = wxPENSTYLE_SOLID);
21  virtual ~XYLineRendererBase();
22 
28  virtual void SetSerieColour(size_t serie, wxColour *colour);
29 
35  virtual wxColour GetSerieColour(size_t serie);
36 
42  void SetSeriePen(size_t serie, wxPen *pen);
43 
49  wxPen *GetSeriePen(size_t serie);
50 
51  virtual void Draw(wxDC &dc, wxRect rc, Axis *horizAxis, Axis *vertAxis, XYDataset *dataset);
52 
53  //
54  // Renderer
55  //
56  virtual void DrawLegendSymbol(wxDC &dc, wxRect rcSymbol, size_t serie);
57 
58 protected:
59  virtual void DrawLines(wxDC &dc, wxRect rc, Axis *horizAxis, Axis *vertAxis, XYDataset *dataset) = 0;
60  virtual void DrawSymbols(wxDC &dc, wxRect rc, Axis *horizAxis, Axis *vertAxis, XYDataset *dataset);
61 
62  bool m_drawSymbols;
63  bool m_drawLines;
64 
65 private:
66  PenMap m_seriePens;
67 
68  int m_defaultPenWidth;
69  wxPenStyle m_defaultPenStyle;
70 };
71 
75 class WXDLLIMPEXP_FREECHART XYLineRenderer : public XYLineRendererBase
76 {
77  DECLARE_CLASS(XYLineRenderer)
78 public:
86  XYLineRenderer(bool drawSymbols = false, bool drawLines = true, int defaultWidth = 2, wxPenStyle defaultStyle = wxPENSTYLE_SOLID);
87  virtual ~XYLineRenderer();
88 
89 
90 protected:
91  virtual void DrawLines(wxDC &dc, wxRect rc, Axis *horizAxis, Axis *vertAxis, XYDataset *dataset);
92 };
93 
99 class WXDLLIMPEXP_FREECHART XYLineStepRenderer : public XYLineRendererBase
100 {
101  DECLARE_CLASS(XYLineStepRenderer)
102 public:
103  XYLineStepRenderer(int defaultWidth = 1, wxPenStyle defaultStyle = wxPENSTYLE_SOLID);
104  virtual ~XYLineStepRenderer();
105 
106 
107 protected:
108  virtual void DrawLines(wxDC &dc, wxRect rc, Axis *horizAxis, Axis *vertAxis, XYDataset *dataset);
109 
110 private:
111  size_t GetFirstVisibleIndex(Axis *horizAxis, Axis *vertAxis, XYDataset *dataset, size_t serie);
112 };
113 
114 #endif /*XYLINERENDERER_H_*/
virtual void Draw(wxDC &dc, wxRect rc, Axis *horizAxis, Axis *vertAxis, XYDataset *dataset)=0
Draws dataset.
virtual void SetSerieColour(size_t serie, wxColour *color)
Sets color for serie.
Base class for all XYDataset renderers.
Definition: xyrenderer.h:20
Renderer for drawing lines from xy datasets.
Base class for all axes.
Definition: axis.h:39
virtual wxColour GetSerieColour(size_t serie)
Returns serie color.
Renderer for xy datasets, where next x coordinate is always greater than previous.
Base class for XY datasets.
Definition: xydataset.h:21
virtual void DrawLegendSymbol(wxDC &dc, wxRect rcSymbol, size_t serie)
Draws legend symbol.