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 "ChartXYSerie.h"
00024 #include "ChartGradient.h"
00025 #include <list>
00026
00028
00038 class CChartBarSerie : public CChartXYSerie
00039 {
00040 public:
00042 CChartBarSerie(CChartCtrl* pParent);
00044 ~CChartBarSerie();
00045
00047 void SetHorizontal(bool bHorizontal);
00049 bool GetHorizontal() const { return m_bHorizontal; }
00050
00052 void SetBorderColor(COLORREF BorderColor);
00054 COLORREF GetBorderColor() const { return m_BorderColor; }
00056 void SetBorderWidth(int Width);
00058 int GetBorderWidth() const { return m_iBorderWidth; }
00060 void SetBarWidth(int Width);
00062 int GetBarWidth() const { return m_iBarWidth; }
00063
00065
00069 void SetGroupId(unsigned GroupId);
00071 unsigned GetGroupId() const { return m_uGroupId; }
00072
00074
00079 void SetStacked(bool bStacked);
00081 bool IsStacked();
00082
00084 void ShowGradient(bool bShow);
00086
00093 void SetGradient(COLORREF GradientColor, EGradientType GradientType);
00094
00096 static void SetInterSpace(int Space) { m_iInterSpace = Space; }
00098 static int GetInterSpace() { return m_iInterSpace; }
00099
00101
00110 void SetBaseLine(bool bAutomatic, double dBaseLine)
00111 {
00112 m_bAutoBaseLine = bAutomatic;
00113 m_dBaseLine = dBaseLine;
00114 }
00115
00117
00127 bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;
00128
00129 private:
00130 typedef std::list<CChartBarSerie*> TBarSeriesList;
00131
00133
00140 void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;
00141
00143
00150 void Draw(CDC* pDC);
00152
00157 void DrawAll(CDC *pDC);
00158
00159 void DrawBar(CDC* pDC, CBrush* pFillBrush, CBrush* pBorderBrush,
00160 CRect BarRect);
00161
00162
00163
00164
00165 int GetMinorOffset() const;
00166 CRect GetBarRectangle(unsigned uPointIndex, int minorOffset) const;
00167
00168 void RefreshStackedCache() const;
00169
00170
00172 static int m_iInterSpace;
00174 static TBarSeriesList m_lstBarSeries;
00175
00177 bool m_bHorizontal;
00178
00179
00180
00181
00182 double m_dBaseLine;
00183 bool m_bAutoBaseLine;
00184
00185
00186
00187 unsigned m_uGroupId;
00188
00189 int m_iBarWidth;
00190 int m_iBorderWidth;
00191 COLORREF m_BorderColor;
00192
00193 bool m_bGradient;
00194 COLORREF m_GradientColor;
00195 EGradientType m_GradientType;
00196
00197
00198
00199 bool m_bStacked;
00200
00201
00202 mutable TBarSeriesList m_lstStackedSeries;
00203 };