00001 #ifndef wx_chart_h
00002 #define wx_chart_h
00003
00004
00005
00006 #ifdef __GNUG__
00007 #pragma interface "chart.h"
00008 #endif
00009
00010 #ifdef __BORLANDC__
00011 #pragma hdrstop
00012 #endif
00013
00014
00015 #include "wx/wxprec.h"
00016 #ifndef WX_PRECOMP
00017 #include "wx/wx.h"
00018 #endif
00019
00020
00021
00022 #define MAX_DATASET 10
00023 #define MAX_ITEM 50
00024 #define MARGE 5
00025 #define MINOR_STEP 10
00026 #define MAJOR_STEP 5
00027 #define MAX_PER 200
00028 #define MINOR_PER 25
00029 #define MAJOR_PER 50
00030
00031 enum
00032 {
00033 wxArea = 0,
00034 wxPerimeter = 1,
00035 wxDiameterArea = 2,
00036 wxDiameterPerimeter = 3,
00037 wxMinimumDiameter = 4,
00038 wxMaximumDiameter = 5,
00039 wxAverageDiameter = 6,
00040 wxStenosis = 7
00041 };
00042
00043
00044
00045 class wxDataSet: public wxObject
00046 {
00047 protected:
00048 wxBrush *m_dataStyle;
00049 wxPen *m_lineStyle;
00050 wxString *m_text;
00051 int m_dataWidth;
00052 int m_lineWidth;
00053 int m_pointMark;
00054 int m_displayValues;
00055 bool m_display;
00056
00057 public:
00058 wxList *m_rowsList;
00059
00060 public :
00061
00062 wxDataSet(wxPen *lStype, wxBrush *dStyle,
00063 int dWidth, int lWidth, int dGap, int pMark,
00064 int disValues);
00065 wxDataSet(wxPen *lStype, wxBrush *dStyle,
00066 wxString *lText, bool lDisplay=false);
00067 wxDataSet();
00068 ~wxDataSet();
00069
00070
00071 void SetDataStyle(wxBrush* brush) { m_dataStyle = brush;}
00072 void SetDataWidth(int width) { m_dataWidth = width;}
00073 void SetLineStyle(wxPen* style) { m_lineStyle = style;}
00074 void SetPointMark(int mark) { m_pointMark = mark; }
00075 void SetText(wxString* string) { m_text = string; }
00076 void Show(bool show) { m_display=show; }
00077
00078
00079 bool GetShow() { return m_display; }
00080 wxBrush* GetDataStyle() { return m_dataStyle; }
00081 int GetDataWidth() { return m_dataWidth; }
00082 wxPen* GetLineStyle() { return m_lineStyle; }
00083 int GetPointMark() { return m_pointMark; }
00084 wxString* GetText() { return m_text; }
00085
00086 };
00087
00088
00089
00090 class Table
00091 {
00092 public :
00093 double x,y;
00094 bool empty;
00095 };
00096
00097
00098 class wxChart: public wxWindow
00099 {
00100 private:
00101
00102 int m_NumDataSet;
00103 int m_NumItem;
00104 Table m_table[MAX_DATASET][MAX_ITEM];
00105 wxDataSet *m_dataSetArray[MAX_DATASET];
00106
00107 double m_MinX, m_MaxX;
00108 double m_InfX, m_SupX, m_SupY;
00109
00110 double m_StepSizeX, m_StepSizeY, m_StepSizePer;
00111 double m_MaxValue;
00112
00113 int m_ValueCol;
00114 bool m_ShowPer;
00115
00116 int m_MaxHauteur, m_MaxLargeur;
00117 int m_CenterX, m_CenterY;
00118 int m_EdgeTop, m_EdgeBottom, m_EdgeLeft, m_EdgeRight;
00119 int m_Top,m_Bottom, m_Left, m_Right;
00120
00121 int m_EdgeTopLegend, m_EdgeBottomLegend, m_EdgeLeftLegend, m_EdgeRightLegend;
00122 int m_TopLegend, m_BottomLegend, m_LeftLegend, m_RightLegend;
00123
00124 double m_MinorIncX, m_MajorIncX;
00125 double m_MinorIncY, m_MajorIncY;
00126
00127 void DrawLine(wxDC &dc, int a);
00128 void DrawFond(wxDC& dc);
00129 void DrawAxe(wxDC& dc);
00130 void DrawAxePer(wxDC& dc);
00131 void DrawLegend(wxDC& dc, int nbr);
00132 void DrawGrille(wxDC& dc);
00133 void SetInitEdge();
00134 void SetChartBounds();
00135 void SetChartBoundsLegend();
00136 void SetCadreLegend(int nbr, int* bottom);
00137 void InitDataSet();
00138 void InitData();
00139 double MaxValue();
00140 double MinCol(double inf);
00141 double MaxCol(double sup);
00142 void SetInfX(double sup);
00143 void SetSupX(double sup);
00144 void SetSupY(double sup);
00145 void InitChart();
00146 int GetShow();
00147
00148 public:
00149
00150 wxChart(wxFrame *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
00151 const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE,
00152 const wxString& name = wxPanelNameStr);
00153 ~wxChart();
00154
00155 void OnPaint(wxPaintEvent& event);
00156 void OnLeftClick(wxDC &dc, double x, double y, int keys);
00157 void OnRightClick(wxDC &dc, double x, double y, int keys);
00158
00159 void Draw(wxDC& dc);
00160 bool IsEmpty(int a, int item);
00161 double GetDataX(int a, int item);
00162 double GetDataY(int a, int item);
00163 void SetData(int a, int item, double x, double y);
00164
00165 void SetMinX(double MinX);
00166 void SetMaxX(double MaxX);
00167 void SetMaxWidthHeight(int x,int y);
00168 void SetCenterChart(int x, int y);
00169 void SetShowPer(bool per);
00170 void SetMaxValue(double max);
00171 void SetStepSizeX(double sizeX);
00172 void SetStepSizeY(double sizeY);
00173 void SetStepSizePer(double sizePer);
00174 void SetNumDataSet(int NumDataSet);
00175 void SetNumItem(int NumItem);
00176 void SetIncAxisX(double minor, double major);
00177 void SetIncAxisY(double minor, double major);
00178 void SetEdgeTop(int top);
00179 void SetEdgeBottom(int bottom);
00180 void SetEdgeLeft(int left);
00181 void SetEdgeRight(int right);
00182 void SetEdgeTopLegend(int top);
00183 void SetEdgeBottomLegend(int bottom);
00184 void SetEdgeLeftLegend(int left);
00185 void SetEdgeRightLegend(int right);
00186 void ShowDataSet(bool show,int dataset);
00187
00188 double GetMinX() { return m_MinX; }
00189 double GetMaxX() { return m_MaxX; }
00190 int GetMaxValue() { return m_MaxValue; }
00191 double GetStepSizeX() { return m_StepSizeX; }
00192 double GetStepSizeY() { return m_StepSizeY; }
00193 double GetStepSizePer() { return m_StepSizePer;}
00194 int GetValueCol() { return m_ValueCol; }
00195 int GetNumDataSet() { return m_NumDataSet; }
00196 int GetNumItem() { return m_NumItem; }
00197 bool GetShowPer() { return m_ShowPer; }
00198 int GetLargeur() { return m_MaxLargeur; }
00199 int GetHauteur() { return m_MaxHauteur; }
00200 int GetEdgeTop() { return m_EdgeTop; }
00201 int GetEdgeBottom() { return m_EdgeBottom; }
00202 int GetEdgeLeft() { return m_EdgeLeft; }
00203 int GetEdgeRight() { return m_EdgeRight; }
00204 int GetEdgeTopLegend() { return m_EdgeTopLegend; }
00205 int GetEdgeBottomLegend() { return m_EdgeBottomLegend; }
00206 int GetEdgeLeftLegend() { return m_EdgeLeftLegend; }
00207 int GetEdgeRightLegend() { return m_EdgeRightLegend; }
00208 bool GetShowDataSet(int dataset);
00209
00210 DECLARE_EVENT_TABLE()
00211 };
00212
00213 #endif // wx_chart_h