00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #if _MSC_VER > 1000
00025 #pragma once
00026 #endif // _MSC_VER > 1000
00027
00028 #include "ChartSerie.h"
00029 #include "ChartAxis.h"
00030 #include "ChartPointsArray.h"
00031 #include "ChartLabel.h"
00032 #include "ChartBalloonLabel.h"
00033 #include "ChartSeriesMouseListener.h"
00034
00035 #include <map>
00036 #include "ChartString.h"
00037 #include "PointsOrdering.h"
00038
00039 class CChartLegend;
00040
00041
00043
00050 template <class T>
00051 class CChartSerieBase : public CChartSerie
00052 {
00053 friend CChartCtrl;
00054 friend CChartLegend;
00055
00056 public:
00058 void AddPoint(const T& newPoint);
00060
00067 void AddPoints(T* pPoints, unsigned Count);
00069
00073 const T& GetPoint(unsigned index) const;
00075
00082 void SetPoints(T* pPoints, unsigned Count);
00084 void RemovePointsFromBegin(unsigned Count);
00086 void RemovePointsFromEnd(unsigned Count);
00088 void ClearSerie();
00089
00091 unsigned GetPointsCount() const { return m_vPoints.GetPointsCount(); }
00092
00094
00102 bool GetSerieYMinMax(double& Min, double& Max) const;
00104
00112 bool GetSerieXMinMax(double& Min, double& Max) const;
00114
00122 bool GetSerieXScreenMinMax(double& Min, double& Max) const;
00124
00132 bool GetSerieYScreenMinMax(double& Min, double& Max) const;
00133
00135
00143 CChartBalloonLabel<T>* CreateBalloonLabel(unsigned uPointIndex, const TChartString& strLabelText);
00145
00156 CChartBalloonLabel<T>* CreateBalloonLabel(unsigned uPointIndex, CChartLabelProvider<T>* pLabelProvider);
00158
00164 void AttachCustomLabel(unsigned uPointIndex, CChartLabel<T>* pLabel);
00165
00167 CChartSerieBase(CChartCtrl* pParent);
00169 virtual ~CChartSerieBase();
00170
00172
00179 virtual void SetSeriesOrdering(PointsOrdering newOrdering);
00180
00182
00187 CPoint GetPointScreenCoord(unsigned uPointIndex);
00188
00190
00194 void RegisterMouseListener(CChartSeriesMouseListener<T>* pListener);
00196 void UnregisterMouseListener();
00197
00198 protected:
00200
00208 bool GetVisiblePoints(unsigned& uFirst, unsigned& uLast) const;
00209
00211 bool OnMouseEvent(CChartMouseListener::MouseEvent mouseEvent,
00212 const CPoint& screenPoint);
00213
00215 CChartPointsArray<T> m_vPoints;
00217 unsigned m_uLastDrawnPoint;
00218
00219 private:
00221 void DrawLabels(CDC* pDC);
00222
00223 typedef std::map<unsigned, CChartLabel<T>*> TLabelMap;
00225 TLabelMap m_mapLabels;
00226
00227 CChartSeriesMouseListener<T>* m_pMouseListener;
00228 };
00229
00230 #include "ChartSerieBase.inl"
00231