1 /*=========================================================================
4 Module: $RCSfile: wxChart.h,v $
6 Date: $Date: 2009/05/14 13:54:57 $
7 Version: $Revision: 1.1 $
9 Copyright: (c) 2002, 2003
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notice for more information.
16 =========================================================================*/
18 #ifndef __WX__MARACAS__CHART__HXX__
19 #define __WX__MARACAS__CHART__HXX__
23 //---------------------------------------------------------------------
24 #define MAX_DATASET 10
38 wxDiameterPerimeter = 3,
39 wxMinimumDiameter = 4,
40 wxMaximumDiameter = 5,
41 wxAverageDiameter = 6,
46 //-------------------------------------------------------------------
47 class wxDataSet: public wxObject
53 int m_dataWidth; // Scaled|Fixed
56 int m_displayValues; // def=NONE |IN | OUT
63 // Constructor & Destructor
64 wxDataSet(wxPen *lStype, wxBrush *dStyle,
65 int dWidth, int lWidth, int dGap, int pMark,
67 wxDataSet(wxPen *lStype, wxBrush *dStyle,
68 wxString *lText, bool lDisplay=false);
73 void SetDataStyle(wxBrush* brush) { m_dataStyle = brush; }
74 void SetDataWidth(int width) { m_dataWidth = width; }
75 void SetLineStyle(wxPen* style) { m_lineStyle = style; }
76 void SetPointMark(int mark) { m_pointMark = mark; }
77 void SetText(wxString* string) { m_text = string;}
78 void Show(bool show) { m_display = show; }
81 bool GetShow() { return m_display; }
82 wxBrush* GetDataStyle() { return m_dataStyle; }
83 int GetDataWidth() { return m_dataWidth; }
84 wxPen* GetLineStyle() { return m_lineStyle; }
85 int GetPointMark() { return m_pointMark; }
86 wxString* GetText() { return m_text; }
89 //---------------------------------------------------------------
99 //----------------------------------------------------------------------
100 class wxChart: public wxPanel
106 Table m_table[MAX_DATASET][MAX_ITEM];
107 wxDataSet *m_dataSetArray[MAX_DATASET];
109 double m_MinX, m_MaxX;
110 double m_InfX, m_SupX, m_SupY;
112 double m_StepSizeX, m_StepSizeY, m_StepSizePer;
115 double m_MinorIncX, m_MajorIncX;
116 double m_MinorIncY, m_MajorIncY;
122 int m_MaxHauteur, m_MaxLargeur;
123 int m_CenterX, m_CenterY;
124 int m_EdgeTop, m_EdgeBottom, m_EdgeLeft, m_EdgeRight;
125 int m_Top,m_Bottom, m_Left, m_Right;
127 int m_EdgeTopLegend, m_EdgeBottomLegend, m_EdgeLeftLegend, m_EdgeRightLegend;
128 int m_TopLegend, m_BottomLegend, m_LeftLegend, m_RightLegend;
130 void DrawLine(wxDC &dc, int a);
131 void DrawFond(wxDC& dc);
132 void DrawAxe(wxDC& dc);
133 void DrawAxePer(wxDC& dc);
134 void DrawLegend(wxDC& dc, int nbr);
135 void DrawGrille(wxDC& dc);
137 void SetChartBounds();
138 void SetChartBoundsLegend();
139 void SetCadreLegend(int nbr, int* bottom);
143 double MinCol(double inf);
144 double MaxCol(double sup);
145 void SetInfX(double sup);
146 void SetSupX(double sup);
147 void SetSupY(double sup);
152 // Constructor et Destructor
153 wxChart(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
154 const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE,
155 const wxString& name = wxPanelNameStr);
158 void OnPaint(wxPaintEvent& event);
159 void OnLeftClick(wxDC &dc, double x, double y, int keys);
160 void OnRightClick(wxDC &dc, double x, double y, int keys);
163 bool IsEmpty(int a, int item);
164 double GetDataX(int a, int item);
165 double GetDataY(int a, int item);
166 void SetData(int a, int item, double x, double y);
168 void SetMinX(double MinX);
169 void SetMaxX(double MaxX);
170 void SetMaxWidthHeight(int x,int y);
171 void SetCenterChart(int x, int y);
172 void SetShowPer(bool per);
173 void SetMaxValue(double max);
174 void SetStepSizeX(double sizeX);
175 void SetStepSizeY(double sizeY);
176 void SetStepSizePer(double sizePer);
177 void SetNumDataSet(int NumDataSet);
178 void SetNumItem(int NumItem);
179 void SetIncAxisX(double minor, double major);
180 void SetIncAxisY(double minor, double major);
181 void SetEdgeTop(int top);
182 void SetEdgeBottom(int bottom);
183 void SetEdgeLeft(int left);
184 void SetEdgeRight(int right);
185 void SetEdgeTopLegend(int top);
186 void SetEdgeBottomLegend(int bottom);
187 void SetEdgeLeftLegend(int left);
188 void SetEdgeRightLegend(int right);
189 void ShowDataSet(bool show,int dataset);
191 bool GetShowDataSet(int dataset);
192 double GetMinX() { return m_MinX; }
193 double GetMaxX() { return m_MaxX; }
194 int GetMaxValue() { return (int)m_MaxValue; }
195 double GetStepSizeX() { return m_StepSizeX; }
196 double GetStepSizeY() { return m_StepSizeY; }
197 double GetStepSizePer() { return m_StepSizePer; }
198 int GetValueCol() { return m_ValueCol; }
199 int GetNumDataSet() { return m_NumDataSet; }
200 int GetNumItem() { return m_NumItem; }
201 bool GetShowPer() { return m_ShowPer; }
202 int GetLargeur() { return m_MaxLargeur; }
203 int GetHauteur() { return m_MaxHauteur; }
204 int GetEdgeTop() { return m_EdgeTop; }
205 int GetEdgeBottom() { return m_EdgeBottom; }
206 int GetEdgeLeft() { return m_EdgeLeft; }
207 int GetEdgeRight() { return m_EdgeRight; }
208 int GetEdgeTopLegend() { return m_EdgeTopLegend; }
209 int GetEdgeBottomLegend() { return m_EdgeBottomLegend; }
210 int GetEdgeLeftLegend() { return m_EdgeLeftLegend; }
211 int GetEdgeRightLegend() { return m_EdgeRightLegend; }
213 DECLARE_EVENT_TABLE()