High-speed-Charting-Control/ChartDemo/Doc/html/_chart_candlestick_serie_8h...

111 lines
15 KiB
HTML
Raw Permalink Normal View History

2020-06-10 10:11:21 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartCandlestickSerie.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
</ul>
</div>
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartCandlestickSerie.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * ChartCandlestickSerie.h</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * Written by C<>dric Moonen (cedric_moonen@hotmail.com)</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
<a name="l00013"></a>00013 <span class="comment"> * </span>
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
<a name="l00018"></a>00018 <span class="comment"> *</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> */</span>
<a name="l00021"></a>00021
<a name="l00022"></a>00022 <span class="preprocessor">#pragma once</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#include "ChartSerieBase.h"</span>
<a name="l00024"></a>00024
<a name="l00026"></a><a class="code" href="struct_s_chart_candlestick_point.html">00026</a> <span class="keyword">struct </span><a class="code" href="struct_s_chart_candlestick_point.html" title="Point structure used as template parameter for candlestick series.">SChartCandlestickPoint</a>
<a name="l00027"></a>00027 {
<a name="l00028"></a>00028 <a class="code" href="struct_s_chart_candlestick_point.html" title="Point structure used as template parameter for candlestick series.">SChartCandlestickPoint</a>() { }
<a name="l00029"></a>00029 <a class="code" href="struct_s_chart_candlestick_point.html" title="Point structure used as template parameter for candlestick series.">SChartCandlestickPoint</a>(<span class="keywordtype">double</span> XValue, <span class="keywordtype">double</span> LowVal,
<a name="l00030"></a>00030 <span class="keywordtype">double</span> HighVal, <span class="keywordtype">double</span> OpenVal, <span class="keywordtype">double</span> CloseVal):
<a name="l00031"></a>00031 <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>(XValue), <a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61" title="The low market price.">Low</a>(LowVal), <a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1" title="The high market price.">High</a>(HighVal),
<a name="l00032"></a>00032 <a class="code" href="struct_s_chart_candlestick_point.html#7943760bf7be7b2fa8989d31452a72d5" title="The open market price.">Open</a>(OpenVal), <a class="code" href="struct_s_chart_candlestick_point.html#00fb9c2c2cc1f90baf52729a8650466d" title="The close market price.">Close</a>(CloseVal) { }
<a name="l00033"></a>00033
<a name="l00035"></a><a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d">00035</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>;
<a name="l00037"></a><a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61">00037</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61" title="The low market price.">Low</a>;
<a name="l00039"></a><a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1">00039</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1" title="The high market price.">High</a>;
<a name="l00041"></a><a class="code" href="struct_s_chart_candlestick_point.html#7943760bf7be7b2fa8989d31452a72d5">00041</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#7943760bf7be7b2fa8989d31452a72d5" title="The open market price.">Open</a>;
<a name="l00043"></a><a class="code" href="struct_s_chart_candlestick_point.html#00fb9c2c2cc1f90baf52729a8650466d">00043</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#00fb9c2c2cc1f90baf52729a8650466d" title="The close market price.">Close</a>;
<a name="l00044"></a>00044
<a name="l00046"></a><a class="code" href="struct_s_chart_candlestick_point.html#288c201af466fc9dbf9b4f7bcfaa0859">00046</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#288c201af466fc9dbf9b4f7bcfaa0859" title="Returns the X value of the point.">GetX</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>; }
<a name="l00048"></a><a class="code" href="struct_s_chart_candlestick_point.html#cbc4b2866a0847368b0e3f293ff6dc45">00048</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#cbc4b2866a0847368b0e3f293ff6dc45" title="Returns the Y value of the point, which is the average between low and high.">GetY</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61" title="The low market price.">Low</a>+<a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1" title="The high market price.">High</a>)/2; }
<a name="l00050"></a><a class="code" href="struct_s_chart_candlestick_point.html#397cbaa6c52c2be644372b4ae5a8ca2c">00050</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#397cbaa6c52c2be644372b4ae5a8ca2c" title="Returns the minimum X value of the point.">GetXMin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>; }
<a name="l00052"></a><a class="code" href="struct_s_chart_candlestick_point.html#c19425e2021dc959e3cb9ece80a5e92e">00052</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#c19425e2021dc959e3cb9ece80a5e92e" title="Returns the maximum X value of the point.">GetXMax</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>; }
<a name="l00054"></a><a class="code" href="struct_s_chart_candlestick_point.html#3fa9f6146145b8a20329b0a532f16baa">00054</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#3fa9f6146145b8a20329b0a532f16baa" title="Returns the minimum Y value of the point (the low value).">GetYMin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61" title="The low market price.">Low</a>; }
<a name="l00056"></a><a class="code" href="struct_s_chart_candlestick_point.html#e2e520702fd471c5cb9cbf92ea3c7402">00056</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#e2e520702fd471c5cb9cbf92ea3c7402" title="Returns the maximum Y value of the point (the high value).">GetYMax</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1" title="The high market price.">High</a>; }
<a name="l00057"></a>00057 };
<a name="l00058"></a>00058
<a name="l00060"></a>00060
<a name="l00066"></a><a class="code" href="class_c_chart_candlestick_serie.html">00066</a> <span class="keyword">class </span><a class="code" href="class_c_chart_candlestick_serie.html" title="Specialization of a CChartSerieBase to display a candlestick series.">CChartCandlestickSerie</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_serie_base.html" title="Base class for all series of the control.">CChartSerieBase</a>&lt;SChartCandlestickPoint&gt;
<a name="l00067"></a>00067 {
<a name="l00068"></a>00068 <span class="keyword">public</span>:
<a name="l00070"></a>00070 <a class="code" href="class_c_chart_candlestick_serie.html#43f5d27027e3a611c28d6a4ef0e9c98b" title="Constructor.">CChartCandlestickSerie</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
<a name="l00072"></a>00072 <a class="code" href="class_c_chart_candlestick_serie.html#04b56e714d0015bd5a7ca2c4f46f36b7" title="Destructor.">~CChartCandlestickSerie</a>();
<a name="l00073"></a>00073
<a name="l00075"></a>00075
<a name="l00082"></a>00082 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_candlestick_serie.html#3f7b68f44e5ec0305992f4ff30d60b67" title="Tests if a certain screen point is on the series.">IsPointOnSerie</a>(<span class="keyword">const</span> CPoint&amp; screenPoint, <span class="keywordtype">unsigned</span>&amp; uIndex) <span class="keyword">const</span>;
<a name="l00083"></a>00083
<a name="l00085"></a>00085
<a name="l00097"></a>00097 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#342f777200b38e00523f825076d958e2" title="Adds a new point in the series.">AddPoint</a>(<span class="keywordtype">double</span> XVal, <span class="keywordtype">double</span> Low, <span class="keywordtype">double</span> High,
<a name="l00098"></a>00098 <span class="keywordtype">double</span> Open, <span class="keywordtype">double</span> Close);
<a name="l00100"></a>00100 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#0cbbf2ab644c1ebf3fcb861892f8b399" title="Sets the width (in pixels) of all candlestick points in the series.">SetWidth</a>(<span class="keywordtype">int</span> Width);
<a name="l00102"></a><a class="code" href="class_c_chart_candlestick_serie.html#87659b59d107206725a7014ec7ae545c">00102</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_candlestick_serie.html#87659b59d107206725a7014ec7ae545c" title="Returns the width (in pixels) of a point in the series.">GetWidth</a>() { <span class="keywordflow">return</span> m_iCandlestickWidth; }
<a name="l00103"></a>00103
<a name="l00104"></a>00104 <span class="keyword">protected</span>:
<a name="l00106"></a>00106
<a name="l00112"></a>00112 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#18a147258e21691b989cff0ad90269ee" title="Draws the legend icon for the series.">DrawLegend</a>(CDC* pDC, <span class="keyword">const</span> CRect&amp; rectBitmap) <span class="keyword">const</span>;
<a name="l00113"></a>00113
<a name="l00115"></a>00115
<a name="l00121"></a>00121 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#73544370476b42322e1c17edf580eb5a" title="Draws the most recent points of the series.">Draw</a>(CDC* pDC);
<a name="l00123"></a>00123
<a name="l00127"></a>00127 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#588ed1d8d6dd07f33d3cfce10289543f" title="Redraws the full series.">DrawAll</a>(CDC *pDC);
<a name="l00128"></a>00128
<a name="l00129"></a>00129 <span class="keyword">private</span>:
<a name="l00131"></a>00131 <span class="keywordtype">void</span> DrawCandleStick(CDC *pDC, <a class="code" href="struct_s_chart_candlestick_point.html" title="Point structure used as template parameter for candlestick series.">SChartCandlestickPoint</a> Point);
<a name="l00132"></a>00132
<a name="l00134"></a>00134 <span class="keywordtype">int</span> m_iCandlestickWidth;
<a name="l00135"></a>00135
<a name="l00136"></a>00136 <span class="comment">// Caches the pen and brushes to avoid creating them for each point</span>
<a name="l00137"></a>00137 <span class="keyword">mutable</span> CBrush ShadowBrush;
<a name="l00138"></a>00138 <span class="keyword">mutable</span> CPen NewPen;
<a name="l00139"></a>00139 <span class="keyword">mutable</span> CPen ShadowPen;
<a name="l00140"></a>00140 <span class="keyword">mutable</span> CBrush BrushFill;
<a name="l00141"></a>00141 <span class="keyword">mutable</span> CBrush BrushEmpty;
<a name="l00142"></a>00142 };
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>