00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(AFX_CHARTSERIE_H__FFCF0E32_10E7_4A4D_9FF3_3C6177EDE4B1__INCLUDED_)
00023 #define AFX_CHARTSERIE_H__FFCF0E32_10E7_4A4D_9FF3_3C6177EDE4B1__INCLUDED_
00024
00025 #if _MSC_VER > 1000
00026 #pragma once
00027 #endif // _MSC_VER > 1000
00028
00029
00030 #define INVALID_POINT UINT_MAX
00031
00032 #include "ChartAxis.h"
00033 #include "ChartSeriesMouseListener.h"
00034
00035 #include <map>
00036 #include "ChartString.h"
00037
00038 class CChartLegend;
00039 class CChartCtrl;
00040
00041 #define INVALID_POINT UINT_MAX
00042
00044
00054 class CChartSerie
00055 {
00056 friend CChartCtrl;
00057 friend CChartLegend;
00058
00059 public:
00061 virtual unsigned GetPointsCount() const = 0;
00062
00064 virtual CPoint GetPointScreenCoord(unsigned uPointIndex) = 0;
00065
00067
00075 virtual bool GetSerieYMinMax(double& Min, double& Max) const = 0;
00077
00085 virtual bool GetSerieXMinMax(double& Min, double& Max) const = 0;
00087
00095 virtual bool GetSerieXScreenMinMax(double& Min, double& Max) const = 0;
00097
00105 virtual bool GetSerieYScreenMinMax(double& Min, double& Max) const = 0;
00106
00108 void SetName(const TChartString& NewName);
00110 TChartString GetName() const { return m_strSerieName; }
00111
00113
00121 void ValueToScreen(double XValue, double YValue, CPoint& ScreenPoint) const;
00123 double YScreenToValue(long YScreenCoord) const;
00125 double XScreenToValue(long XScreenCoord) const;
00126
00128 CChartSerie(CChartCtrl* pParent);
00130 virtual ~CChartSerie();
00131
00133
00137 void SetVisible(bool bVisible);
00139 bool IsVisible() const { return m_bIsVisible; }
00140
00142 COLORREF GetColor() const { return m_SerieColor; }
00144 void SetColor(COLORREF NewColor);
00146 COLORREF GetShadowColor() const { return m_ShadowColor; }
00148 void SetShadowColor(COLORREF NewColor);
00150 void EnableShadow(bool bEnable);
00152 void SetShadowDepth(int Depth);
00153
00155
00163 virtual bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const = 0;
00164
00166 unsigned GetSerieId() const { return m_uSerieId; }
00168
00178 void EnableMouseNotifications(bool bClickEnabled, bool bMoveEnabled);
00179
00180 protected:
00182 void RefreshAutoAxes();
00184
00192 virtual bool GetVisiblePoints(unsigned& uFirst, unsigned& uLast) const = 0;
00193
00195
00202 virtual void DrawLegend(CDC* pDC, const CRect& rectBitmap) const =0;
00203
00205
00212 virtual void Draw(CDC* pDC) =0;
00214
00219 virtual void DrawAll(CDC *pDC) =0;
00221
00226 virtual void DrawLabels(CDC* pDC) =0;
00227
00229
00237 virtual bool OnMouseEvent(CChartMouseListener::MouseEvent mouseEvent,
00238 const CPoint& screenPoint) = 0;
00239
00241 bool NotifyMouseMoveEnabled() { return m_bMouseMoveNotifications; }
00243 bool NotifyMouseClickEnabled() { return m_bMouseClickNotifications; }
00244
00246 CChartCtrl* m_pParentCtrl;
00248 CChartAxis* m_pVerticalAxis;
00250 CChartAxis* m_pHorizontalAxis;
00251
00253 TChartString m_strSerieName;
00254
00256 bool m_bIsVisible;
00258 bool m_bShadow;
00260 COLORREF m_SerieColor;
00262 COLORREF m_ShadowColor;
00264 int m_iShadowDepth;
00266 CRect m_PlottingRect;
00267
00268 private:
00270 void SetPlottingRect(const CRect& plottingRect) { m_PlottingRect = plottingRect; }
00271
00273 static unsigned m_uNextFreeId;
00275 unsigned m_uSerieId;
00276
00278 bool m_bMouseClickNotifications;
00280 bool m_bMouseMoveNotifications;
00281 };
00282
00283 #endif // !defined(AFX_CHARTSERIE_H__FFCF0E32_10E7_4A4D_9FF3_3C6177EDE4B1__INCLUDED_)