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 #include "ChartSerieBase.h"
00024
00026 struct SChartGanttPoint
00027 {
00029 SChartGanttPoint() : StartTime(0.0), EndTime(0.0), YValue(0.0) { }
00031 SChartGanttPoint(double Start, double End, double YVal)
00032 : StartTime(Start), EndTime(End), YValue(YVal) { }
00033
00035 double StartTime;
00037 double EndTime;
00039 double YValue;
00040
00042 double GetX() const { return (EndTime-StartTime)/2; }
00044 double GetY() const { return YValue; }
00046 double GetXMin() const { return StartTime; }
00048 double GetXMax() const { return EndTime; }
00050 double GetYMin() const { return YValue; }
00052 double GetYMax() const { return YValue; }
00053 };
00054
00056
00063 class CChartGanttSerie : public CChartSerieBase<SChartGanttPoint>
00064 {
00065 public:
00067 CChartGanttSerie(CChartCtrl* pParent);
00069 ~CChartGanttSerie();
00070
00072
00080 void AddPoint(double StartTime, double EndTime, double YValue);
00081
00083
00090 bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;
00091
00093 void SetBorderColor(COLORREF BorderColor);
00095 COLORREF GetBorderColor() const { return m_BorderColor; }
00097 void SetBorderWidth(int Width);
00099 int GetBorderWidth() const { return m_iBorderWidth; }
00101 void SetBarWidth(int Width);
00103 int GetBarWidth() const { return m_iBarWidth; }
00104
00106 void ShowGradient(bool bShow);
00108
00115 void SetGradient(COLORREF GradientColor, EGradientType GradientType);
00116
00117 protected:
00119
00125 void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;
00126
00128
00134 void Draw(CDC* pDC);
00136
00140 void DrawAll(CDC *pDC);
00141
00142 private:
00144 CRect GetBarRectangle(unsigned uPointIndex) const;
00145
00146 void DrawBar(CDC* pDC, CBrush* pFillBrush, CBrush* pBorderBrush,
00147 CRect BarRect);
00148
00150 int m_iBarWidth;
00152 int m_iBorderWidth;
00154 COLORREF m_BorderColor;
00155
00157 bool m_bGradient;
00159 COLORREF m_GradientColor;
00161 EGradientType m_GradientType;
00162 };