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 SChartCandlestickPoint
00027 {
00028 SChartCandlestickPoint() { }
00029 SChartCandlestickPoint(double XValue, double LowVal,
00030 double HighVal, double OpenVal, double CloseVal):
00031 XVal(XValue), Low(LowVal), High(HighVal),
00032 Open(OpenVal), Close(CloseVal) { }
00033
00035 double XVal;
00037 double Low;
00039 double High;
00041 double Open;
00043 double Close;
00044
00046 double GetX() const { return XVal; }
00048 double GetY() const { return (Low+High)/2; }
00050 double GetXMin() const { return XVal; }
00052 double GetXMax() const { return XVal; }
00054 double GetYMin() const { return Low; }
00056 double GetYMax() const { return High; }
00057 };
00058
00060
00066 class CChartCandlestickSerie : public CChartSerieBase<SChartCandlestickPoint>
00067 {
00068 public:
00070 CChartCandlestickSerie(CChartCtrl* pParent);
00072 ~CChartCandlestickSerie();
00073
00075
00082 bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;
00083
00085
00097 void AddPoint(double XVal, double Low, double High,
00098 double Open, double Close);
00100 void SetWidth(int Width);
00102 int GetWidth() { return m_iCandlestickWidth; }
00103
00104 protected:
00106
00112 void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;
00113
00115
00121 void Draw(CDC* pDC);
00123
00127 void DrawAll(CDC *pDC);
00128
00129 private:
00131 void DrawCandleStick(CDC *pDC, SChartCandlestickPoint Point);
00132
00134 int m_iCandlestickWidth;
00135
00136
00137 mutable CBrush ShadowBrush;
00138 mutable CPen NewPen;
00139 mutable CPen ShadowPen;
00140 mutable CBrush BrushFill;
00141 mutable CBrush BrushEmpty;
00142 };