Click here to Skip to main content
15,881,600 members
Articles / Desktop Programming / MFC

High-speed Charting Control

Rate me:
Please Sign up or sign in to vote.
4.95/5 (327 votes)
13 Jul 2010CPOL35 min read 4.2M   100.4K   787  
A flexible charting control to display 2D data
<!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/ChartCtrl.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/ChartCtrl.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"> *      ChartCtrl.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 
<a name="l00023"></a>00023 <span class="preprocessor">#pragma once</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#if _MSC_VER &gt;= 1000</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER &gt;= 1000</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="preprocessor">#include "ChartSerie.h"</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include "ChartAxis.h"</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include "ChartGrid.h"</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include "ChartLegend.h"</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include "ChartTitle.h"</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include "ChartGradient.h"</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include "ChartCursor.h"</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include "ChartMouseListener.h"</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include "ChartStandardAxis.h"</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include "ChartLogarithmicAxis.h"</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include "ChartDateTimeAxis.h"</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include "ChartCrossHairCursor.h"</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include "ChartDragLineCursor.h"</span>
<a name="l00042"></a>00042         
<a name="l00043"></a>00043 <span class="preprocessor">#include &lt;map&gt;</span>
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="keyword">class </span><a class="code" href="class_c_chart_standard_axis.html" title="Specialization of a CChartAxis class to display standard values.">CChartStandardAxis</a>;
<a name="l00047"></a>00047 <span class="keyword">class </span><a class="code" href="class_c_chart_logarithmic_axis.html" title="Specialization of a CChartAxis to display a logarithmic scale.">CChartLogarithmicAxis</a>;
<a name="l00048"></a>00048 <span class="keyword">class </span><a class="code" href="class_c_chart_date_time_axis.html" title="A specialization of the CChartAxis class for displaying date and time data.">CChartDateTimeAxis</a>;
<a name="l00049"></a>00049 <span class="keyword">class </span><a class="code" href="class_c_chart_cross_hair_cursor.html" title="Specialization of a CChartCursor class for a cross-hair cursor.">CChartCrossHairCursor</a>;
<a name="l00050"></a>00050 <span class="keyword">class </span><a class="code" href="class_c_chart_drag_line_cursor.html" title="Specialization of a CChartCursor class for a dragline cursor.">CChartDragLineCursor</a>;
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <span class="keyword">class </span><a class="code" href="class_c_chart_points_serie.html" title="Specialization of a CChartSerie to display a points series.">CChartPointsSerie</a>;
<a name="l00053"></a>00053 <span class="keyword">class </span><a class="code" href="class_c_chart_line_serie.html" title="Specialization of a CChartSerie to display a line series.">CChartLineSerie</a>;
<a name="l00054"></a>00054 <span class="keyword">class </span><a class="code" href="class_c_chart_surface_serie.html" title="Specialization of a CChartSerie to display a surface series.">CChartSurfaceSerie</a>;
<a name="l00055"></a>00055 <span class="keyword">class </span><a class="code" href="class_c_chart_bar_serie.html" title="Specialization of a CChartSerie to display a bars series.">CChartBarSerie</a>;
<a name="l00056"></a>00056 <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>;
<a name="l00057"></a>00057 <span class="keyword">class </span><a class="code" href="class_c_chart_gantt_serie.html" title="Specialization of a CChartSerieBase to display a gantt series.">CChartGanttSerie</a>;
<a name="l00058"></a>00058 
<a name="l00060"></a>00060 <span class="comment">// CChartCtrl window</span>
<a name="l00061"></a>00061 
<a name="l00063"></a>00063 
<a name="l00066"></a><a class="code" href="class_c_chart_ctrl.html">00066</a> <span class="keyword">class </span><a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a> : <span class="keyword">public</span> CWnd
<a name="l00067"></a>00067 {
<a name="l00068"></a>00068 
<a name="l00069"></a>00069 <span class="keyword">public</span>:
<a name="l00071"></a>00071 
<a name="l00074"></a>00074         CDC* <a class="code" href="class_c_chart_ctrl.html#7eb83f30c58c547003b8475e952f9dad" title="Retrieves de device context.">GetDC</a>();
<a name="l00076"></a><a class="code" href="class_c_chart_ctrl.html#6b37a22c4da3490d368363a83b2f6253">00076</a>         CRect <a class="code" href="class_c_chart_ctrl.html#6b37a22c4da3490d368363a83b2f6253" title="Retrieves the plotting rectangle.">GetPlottingRect</a>()<span class="keyword">  const </span>{ <span class="keywordflow">return</span> m_PlottingRect; }
<a name="l00077"></a>00077 
<a name="l00079"></a><a class="code" href="class_c_chart_ctrl.html#71b90984862569848a3a60210a5dc1a9">00079</a>         <a class="code" href="class_c_chart_legend.html" title="This class is responsible for the legend displayed on the control.">CChartLegend</a>* <a class="code" href="class_c_chart_ctrl.html#71b90984862569848a3a60210a5dc1a9" title="Returns a pointer to the legend object.">GetLegend</a>()<span class="keyword"> const  </span>{ <span class="keywordflow">return</span> m_pLegend; }
<a name="l00081"></a><a class="code" href="class_c_chart_ctrl.html#7f303be46f9fecae1ca6311dc5a17e98">00081</a>         <a class="code" href="class_c_chart_title.html" title="This class is responsible for the titles displayed on the control.">CChartTitle</a>*  <a class="code" href="class_c_chart_ctrl.html#7f303be46f9fecae1ca6311dc5a17e98" title="Returns a pointer to the title object.">GetTitle</a>()<span class="keyword">  const  </span>{ <span class="keywordflow">return</span> m_pTitles; }
<a name="l00082"></a>00082 
<a name="l00084"></a><a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419">00084</a>         <span class="keyword">enum</span> <a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a>
<a name="l00085"></a>00085         {
<a name="l00086"></a>00086                 LeftAxis = 0,
<a name="l00087"></a>00087                 BottomAxis,
<a name="l00088"></a>00088                 RightAxis,
<a name="l00089"></a>00089                 TopAxis
<a name="l00090"></a>00090         };
<a name="l00091"></a>00091 
<a name="l00093"></a>00093 
<a name="l00098"></a>00098         <a class="code" href="class_c_chart_standard_axis.html" title="Specialization of a CChartAxis class to display standard values.">CChartStandardAxis</a>* <a class="code" href="class_c_chart_ctrl.html#5ac2726eb8085645d4afa25f8d0e9153" title="Create and attach a standard axis to the control.">CreateStandardAxis</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos);
<a name="l00100"></a>00100 
<a name="l00105"></a>00105         <a class="code" href="class_c_chart_logarithmic_axis.html" title="Specialization of a CChartAxis to display a logarithmic scale.">CChartLogarithmicAxis</a>* <a class="code" href="class_c_chart_ctrl.html#e486f97544fc5c408e18daf0e6aafe68" title="Create and attach a logarithmic axis to the control.">CreateLogarithmicAxis</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos);
<a name="l00107"></a>00107 
<a name="l00112"></a>00112         <a class="code" href="class_c_chart_date_time_axis.html" title="A specialization of the CChartAxis class for displaying date and time data.">CChartDateTimeAxis</a>* <a class="code" href="class_c_chart_ctrl.html#139df86f220cc33e8661d012e4f39a38" title="Create and attach a date/time axis to the control.">CreateDateTimeAxis</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos);
<a name="l00114"></a>00114 
<a name="l00131"></a>00131         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#033fb8812e4df872c4ecae989f9a37eb" title="Attach a custom axis to the control.">AttachCustomAxis</a>(<a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* pAxis, <a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos);
<a name="l00132"></a>00132 
<a name="l00134"></a>00134 
<a name="l00144"></a>00144         <a class="code" href="class_c_chart_points_serie.html" title="Specialization of a CChartSerie to display a points series.">CChartPointsSerie</a>* <a class="code" href="class_c_chart_ctrl.html#12edc002960c38d129152c10e96cf81c" title="Create and attach a point series to the control.">CreatePointsSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
<a name="l00146"></a>00146 
<a name="l00158"></a>00158         <a class="code" href="class_c_chart_line_serie.html" title="Specialization of a CChartSerie to display a line series.">CChartLineSerie</a>* <a class="code" href="class_c_chart_ctrl.html#3e92e6744ffe32b53773cf547529c875" title="Create and attach a line series to the control.">CreateLineSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
<a name="l00160"></a>00160 
<a name="l00172"></a>00172         <a class="code" href="class_c_chart_surface_serie.html" title="Specialization of a CChartSerie to display a surface series.">CChartSurfaceSerie</a>* <a class="code" href="class_c_chart_ctrl.html#8e955846e668b3cb860d08550f995aa2" title="Create and attach a surface series to the control.">CreateSurfaceSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
<a name="l00174"></a>00174 
<a name="l00184"></a>00184         <a class="code" href="class_c_chart_bar_serie.html" title="Specialization of a CChartSerie to display a bars series.">CChartBarSerie</a>* <a class="code" href="class_c_chart_ctrl.html#c166a75bb6f77ee1855debe7d6cd3338" title="Create and attach a bar series to the control.">CreateBarSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
<a name="l00186"></a>00186 
<a name="l00196"></a>00196         <a class="code" href="class_c_chart_candlestick_serie.html" title="Specialization of a CChartSerieBase to display a candlestick series.">CChartCandlestickSerie</a>* <a class="code" href="class_c_chart_ctrl.html#d77ceffac6ea6ee9b5c682c833018221" title="Create and attach a candlestick series to the control.">CreateCandlestickSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
<a name="l00198"></a>00198 
<a name="l00208"></a>00208         <a class="code" href="class_c_chart_gantt_serie.html" title="Specialization of a CChartSerieBase to display a gantt series.">CChartGanttSerie</a>* <a class="code" href="class_c_chart_ctrl.html#570fba5a86bbbacb0c03f408ef767327" title="Create and attach a gantt series to the control.">CreateGanttSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
<a name="l00210"></a>00210 
<a name="l00227"></a>00227         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#5ab5b2ae76f9ad0130a164d28efb1f5b" title="Attaches a custom series to the chart.">AttachCustomSerie</a>(<a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &amp;quot;interface&amp;quot; for all series in the...">CChartSerie</a>* pNewSeries, <span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
<a name="l00229"></a>00229 
<a name="l00234"></a>00234         <a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &amp;quot;interface&amp;quot; for all series in the...">CChartSerie</a>* <a class="code" href="class_c_chart_ctrl.html#3c1119756906792a51ab691191e488af" title="Retrieves a specific series from the chart.">GetSerie</a>(<span class="keywordtype">unsigned</span> uSerieId) <span class="keyword">const</span>;
<a name="l00236"></a>00236 
<a name="l00240"></a>00240         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#8b7cd54df388e7a1dacb6b637f77551e" title="Removes a specific series from the chart.">RemoveSerie</a>(<span class="keywordtype">unsigned</span> uSerieId);
<a name="l00242"></a>00242         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#6fef22e15e44fa2fafe8f924498a81c9" title="Removes all the series from the chart.">RemoveAllSeries</a>();
<a name="l00244"></a>00244         <span class="keywordtype">size_t</span> <a class="code" href="class_c_chart_ctrl.html#d79d9e5978eb957366dbe3d4d71c4902" title="Returns the number of series in the chart.">GetSeriesCount</a>() <span class="keyword">const</span>;
<a name="l00245"></a>00245 
<a name="l00247"></a>00247 
<a name="l00258"></a>00258         <a class="code" href="class_c_chart_cross_hair_cursor.html" title="Specialization of a CChartCursor class for a cross-hair cursor.">CChartCrossHairCursor</a>* <a class="code" href="class_c_chart_ctrl.html#06f647456e4a0716355b6c79cacce71f" title="Create and attach a cross-hair cursor to the control.">CreateCrossHairCursor</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
<a name="l00260"></a>00260 
<a name="l00269"></a>00269         <a class="code" href="class_c_chart_drag_line_cursor.html" title="Specialization of a CChartCursor class for a dragline cursor.">CChartDragLineCursor</a>* <a class="code" href="class_c_chart_ctrl.html#fc19342eec58562148b11b255ede154e" title="Create and attach a drag-line cursor to the control.">CreateDragLineCursor</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> relatedAxis);
<a name="l00271"></a>00271 
<a name="l00277"></a>00277         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#81c624348084247a037e014ad2bd3a86" title="Attach a custom cursor to the control.">AttachCustomCursor</a>(<a class="code" href="class_c_chart_cursor.html" title="Base class for cursors which can be added to the chart control.">CChartCursor</a>* pCursor);
<a name="l00279"></a>00279 
<a name="l00284"></a>00284         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#dfbc638ec9af58004c98cba37b9d8b4c" title="Removes a cursor with a specific Id from the control.">RemoveCursor</a>(<span class="keywordtype">unsigned</span> cursorId);
<a name="l00285"></a>00285 
<a name="l00287"></a>00287         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#c291e28722ae86db4c721fa0dd6fb060" title="Shows/hides the mouse cursor when it is over the plotting area.">ShowMouseCursor</a>(<span class="keywordtype">bool</span> bShow);
<a name="l00288"></a>00288 
<a name="l00289"></a>00289         <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* GetBottomAxis() <span class="keyword">const</span>;
<a name="l00290"></a>00290         <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* GetLeftAxis() <span class="keyword">const</span>;
<a name="l00291"></a>00291         <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* GetTopAxis() <span class="keyword">const</span>;
<a name="l00292"></a>00292         <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* GetRightAxis() <span class="keyword">const</span>;
<a name="l00294"></a>00294 
<a name="l00299"></a><a class="code" href="class_c_chart_ctrl.html#f7283d9146c122e4580444355ea2951e">00299</a>         <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* <a class="code" href="class_c_chart_ctrl.html#f7283d9146c122e4580444355ea2951e" title="Returns a specific axis attached to the control.">GetAxis</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos)<span class="keyword"> const</span>
<a name="l00300"></a>00300 <span class="keyword">        </span>{
<a name="l00301"></a>00301                 <span class="keywordflow">return</span> m_pAxes[axisPos];
<a name="l00302"></a>00302         }
<a name="l00303"></a>00303 
<a name="l00305"></a><a class="code" href="class_c_chart_ctrl.html#58f25dcbd40c1e2ff76aabc3d7dd89a1">00305</a>         UINT <a class="code" href="class_c_chart_ctrl.html#58f25dcbd40c1e2ff76aabc3d7dd89a1" title="Returns the type of the edge used as border.">GetEdgeType</a>()<span class="keyword"> const        </span>{ <span class="keywordflow">return</span> EdgeType;    }
<a name="l00307"></a>00307 
<a name="l00312"></a><a class="code" href="class_c_chart_ctrl.html#563757fa50cbea7cf59f3198c488f099">00312</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#563757fa50cbea7cf59f3198c488f099" title="Sets the edge type.">SetEdgeType</a>(UINT NewEdge)  
<a name="l00313"></a>00313         { 
<a name="l00314"></a>00314                 EdgeType = NewEdge; 
<a name="l00315"></a>00315                 <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>();
<a name="l00316"></a>00316         }
<a name="l00317"></a>00317 
<a name="l00319"></a><a class="code" href="class_c_chart_ctrl.html#7b7896c0f8b00298b29da08d7af334c7">00319</a>         COLORREF <a class="code" href="class_c_chart_ctrl.html#7b7896c0f8b00298b29da08d7af334c7" title="Returns the background color.">GetBackColor</a>()<span class="keyword"> const                   </span>{ <span class="keywordflow">return</span> m_BackColor;   }
<a name="l00321"></a><a class="code" href="class_c_chart_ctrl.html#f5e0c98f70ec80366519cf4bb53b673a">00321</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#f5e0c98f70ec80366519cf4bb53b673a" title="Sets the background color.">SetBackColor</a>(COLORREF NewCol)              
<a name="l00322"></a>00322         { 
<a name="l00323"></a>00323                 m_BackColor = NewCol;  
<a name="l00324"></a>00324                 m_bBackGradient = <span class="keyword">false</span>; 
<a name="l00325"></a>00325                 <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>();
<a name="l00326"></a>00326         }
<a name="l00328"></a><a class="code" href="class_c_chart_ctrl.html#8761c0b97fc83ee817e5331cd6427640">00328</a>         COLORREF <a class="code" href="class_c_chart_ctrl.html#8761c0b97fc83ee817e5331cd6427640" title="Returns the color of the plotting area&amp;#39;s border.">GetBorderColor</a>()<span class="keyword"> const                 </span>{ <span class="keywordflow">return</span> m_BorderColor;   }
<a name="l00330"></a><a class="code" href="class_c_chart_ctrl.html#5ce83aa18830eb77fe86f6f0e9fbca5c">00330</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#5ce83aa18830eb77fe86f6f0e9fbca5c" title="Sets the color of the plotting area&amp;#39;s border.">SetBorderColor</a>(COLORREF NewCol)    { m_BorderColor = NewCol;       <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>(); }
<a name="l00332"></a><a class="code" href="class_c_chart_ctrl.html#16ad1084a1fc0b81fc5fbec67ac61225">00332</a>         COLORREF <a class="code" href="class_c_chart_ctrl.html#16ad1084a1fc0b81fc5fbec67ac61225" title="Returns the color of the zoom rectangle.">GetZoomRectColor</a>()<span class="keyword"> const               </span>{ <span class="keywordflow">return</span> m_ZoomRectColor;   }
<a name="l00334"></a><a class="code" href="class_c_chart_ctrl.html#7768a52e5e832e56d209d47c1d1d2353">00334</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#7768a52e5e832e56d209d47c1d1d2353" title="Sets the color of the zoom rectangle.">SetZoomRectColor</a>(COLORREF NewCol)  { m_ZoomRectColor = NewCol; <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>(); }
<a name="l00336"></a>00336 
<a name="l00348"></a>00348         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#eba2c09d64040effe8f34bb20be233b3" title="Sets a gradient background.">SetBackGradient</a>(COLORREF Col1, COLORREF Col2, EGradientType GradientType);
<a name="l00349"></a>00349 
<a name="l00351"></a><a class="code" href="class_c_chart_ctrl.html#90bdfd131496b3c57a35728cfea14555">00351</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#90bdfd131496b3c57a35728cfea14555" title="Enables/disables the pan feature.">SetPanEnabled</a>(<span class="keywordtype">bool</span> bEnabled)  { m_bPanEnabled = bEnabled;  }
<a name="l00353"></a><a class="code" href="class_c_chart_ctrl.html#284f24403873ab07b7269460edf17118">00353</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_ctrl.html#284f24403873ab07b7269460edf17118" title="Returns true if the pan feature is enabled.">GetPanEnabled</a>()<span class="keyword"> const                 </span>{ <span class="keywordflow">return</span> m_bPanEnabled;          }
<a name="l00355"></a><a class="code" href="class_c_chart_ctrl.html#0d48ddf5d039855f2ca492351b34e911">00355</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#0d48ddf5d039855f2ca492351b34e911" title="Enables/disables the zoom feature.">SetZoomEnabled</a>(<span class="keywordtype">bool</span> bEnabled) { m_bZoomEnabled = bEnabled; }
<a name="l00357"></a><a class="code" href="class_c_chart_ctrl.html#0c4353590178e76e508899344819049e">00357</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_ctrl.html#0c4353590178e76e508899344819049e" title="Returns true if the zoom feature is enabled.">GetZoomEnabled</a>()<span class="keyword"> const                </span>{ <span class="keywordflow">return</span> m_bZoomEnabled;         }
<a name="l00359"></a>00359         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#39a297d54bf34bcb0fb4b828144101c8" title="Undo all pan and zoom operations that were done on the chart.">UndoPanZoom</a>();
<a name="l00360"></a>00360 
<a name="l00362"></a>00362 
<a name="l00365"></a>00365         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>();
<a name="l00367"></a>00367 
<a name="l00374"></a>00374         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#8c888f1b6cfd77487dbad88707c449be" title="Enables/disables the refresh of the control.">EnableRefresh</a>(<span class="keywordtype">bool</span> bEnable);
<a name="l00376"></a>00376 
<a name="l00386"></a>00386         <span class="keywordtype">int</span> <a class="code" href="class_c_chart_ctrl.html#1508a990e3ee11b4eb295f1df6449c37" title="Creates the control dynamically.">Create</a>(CWnd* pParentWnd, <span class="keyword">const</span> RECT&amp; rect, UINT nID, DWORD dwStyle=WS_VISIBLE);
<a name="l00387"></a>00387         
<a name="l00389"></a>00389         <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_ctrl.html#5f04f51f5d74a29ba0e5d8100313c2f9" title="Helper function to convert a date to a double value.">DateToValue</a>(<span class="keyword">const</span> COleDateTime&amp; Date);
<a name="l00391"></a>00391         <span class="keyword">static</span> COleDateTime <a class="code" href="class_c_chart_ctrl.html#355792ea4e0bc6dda66910409d22a2d1" title="Helper function to convert a double value to a date.">ValueToDate</a>(<span class="keywordtype">double</span> Value);
<a name="l00392"></a>00392 
<a name="l00394"></a>00394 
<a name="l00401"></a>00401     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#1a1c8856c1153cf65dbf639256bf1f03" title="Print the chart.">Print</a>(<span class="keyword">const</span> TChartString&amp; strTitle, CPrintDialog* pPrntDialog = NULL);
<a name="l00402"></a>00402 
<a name="l00403"></a>00403 <span class="preprocessor">#if _MFC_VER &gt; 0x0600</span>
<a name="l00405"></a>00405 <span class="preprocessor"></span>
<a name="l00419"></a>00419 <span class="preprocessor">        void SaveAsImage(const TChartString&amp; strFilename, const CRect&amp; rect, </span>
<a name="l00420"></a>00420 <span class="preprocessor"></span>                        <span class="keywordtype">int</span> nBPP, REFGUID guidFileType= GUID_NULL);
<a name="l00421"></a>00421 <span class="preprocessor">#endif</span>
<a name="l00422"></a>00422 <span class="preprocessor"></span>
<a name="l00424"></a>00424     <a class="code" href="class_c_chart_ctrl.html#ac67bd59aadf956ea8fcf2b933ba13a9" title="Default constructor.">CChartCtrl</a>();       
<a name="l00426"></a>00426     <span class="keyword">virtual</span> <a class="code" href="class_c_chart_ctrl.html#e7683743f220c085fd43e1ab89f55c23" title="Default destructor.">~CChartCtrl</a>();
<a name="l00427"></a>00427 
<a name="l00429"></a>00429 
<a name="l00434"></a><a class="code" href="class_c_chart_ctrl.html#58213a4a92ca79f58bc1f4615a9a6b16">00434</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#58213a4a92ca79f58bc1f4615a9a6b16" title="Register a mouse listener with the control.">RegisterMouseListener</a>(<a class="code" href="class_c_chart_mouse_listener.html" title="Listener for mouse events occuring on the chart control.">CChartMouseListener</a>* pMouseListener) { m_pMouseListener = pMouseListener;}
<a name="l00435"></a>00435 
<a name="l00437"></a>00437 
<a name="l00441"></a>00441         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#df7e0680c430c94b490abca3601fe500" title="Tell the control to set the current series to the first series.">GoToFirstSerie</a>();
<a name="l00443"></a>00443 
<a name="l00452"></a>00452         <a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &amp;quot;interface&amp;quot; for all series in the...">CChartSerie</a>* <a class="code" href="class_c_chart_ctrl.html#79833e51527801b30cb26197b34c15d8" title="Returns the next series in the control.">GetNextSerie</a>();
<a name="l00453"></a>00453 
<a name="l00455"></a>00455         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#feb25bdbea159c7e89d3293ba80347d3" title="Refreshes all the axes which are automatic for the screen.">RefreshScreenAutoAxes</a>();
<a name="l00456"></a>00456 
<a name="l00457"></a>00457         <span class="comment">// Generated message map functions</span>
<a name="l00458"></a>00458 <span class="keyword">protected</span>:
<a name="l00459"></a>00459         <span class="comment">//{{AFX_MSG(CChartCtrl)</span>
<a name="l00460"></a>00460         afx_msg <span class="keywordtype">void</span> OnPaint();
<a name="l00461"></a>00461         afx_msg BOOL OnEraseBkgnd(CDC* pDC);
<a name="l00462"></a>00462         afx_msg <span class="keywordtype">void</span> OnSize(UINT nType, <span class="keywordtype">int</span> cx, <span class="keywordtype">int</span> cy);
<a name="l00463"></a>00463         afx_msg <span class="keywordtype">void</span> OnMouseMove(UINT nFlags, CPoint point);
<a name="l00464"></a>00464         afx_msg <span class="keywordtype">void</span> OnLButtonDown(UINT nFlags, CPoint point);
<a name="l00465"></a>00465         afx_msg <span class="keywordtype">void</span> OnLButtonUp(UINT nFlags, CPoint point);
<a name="l00466"></a>00466         afx_msg <span class="keywordtype">void</span> OnLButtonDblClk(UINT nFlags, CPoint point);
<a name="l00467"></a>00467         afx_msg <span class="keywordtype">void</span> OnRButtonDown(UINT nFlags, CPoint point);
<a name="l00468"></a>00468         afx_msg <span class="keywordtype">void</span> OnRButtonUp(UINT nFlags, CPoint point);
<a name="l00469"></a>00469         afx_msg <span class="keywordtype">void</span> OnRButtonDblClk(UINT nFlags, CPoint point);
<a name="l00470"></a>00470         afx_msg <span class="keywordtype">void</span> OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
<a name="l00471"></a>00471         afx_msg <span class="keywordtype">void</span> OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
<a name="l00472"></a>00472         <span class="comment">//}}AFX_MSG</span>
<a name="l00473"></a>00473         DECLARE_MESSAGE_MAP()
<a name="l00474"></a>00474         
<a name="l00475"></a>00475 protected:
<a name="l00476"></a>00476     virtual <span class="keywordtype">void</span> OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo);
<a name="l00477"></a>00477     virtual <span class="keywordtype">void</span> OnPrint(CDC *pDC, CPrintInfo *pInfo);
<a name="l00478"></a>00478     virtual <span class="keywordtype">void</span> OnEndPrinting(CDC *pDC, CPrintInfo *pInfo);
<a name="l00479"></a>00479 
<a name="l00480"></a>00480         <span class="comment">// This function can be called to draw the chart</span>
<a name="l00481"></a>00481         <span class="comment">// on the screen or for printing.</span>
<a name="l00482"></a>00482         virtual <span class="keywordtype">void</span> DrawChart(CDC* pDC, CRect ChartRect);
<a name="l00483"></a>00483         virtual <span class="keywordtype">void</span> DrawBackground(CDC* pDC, CRect ChartRect);
<a name="l00484"></a>00484 
<a name="l00485"></a>00485 private:
<a name="l00487"></a>00487         <span class="keywordtype">bool</span> RegisterWindowClass();
<a name="l00488"></a>00488 
<a name="l00490"></a>00490 
<a name="l00497"></a>00497         <span class="keywordtype">void</span> SendMouseEvent(<a class="code" href="class_c_chart_mouse_listener.html" title="Listener for mouse events occuring on the chart control.">CChartMouseListener</a>::MouseEvent mouseEvent, const CPoint&amp; screenPoint) const;
<a name="l00498"></a>00498 
<a name="l00500"></a>00500         <span class="keywordtype">int</span> m_iEnableRefresh ;
<a name="l00502"></a>00502 
<a name="l00506"></a>00506         <span class="keywordtype">bool</span> m_bPendingRefresh;
<a name="l00508"></a>00508         CDC m_BackgroundDC;     
<a name="l00510"></a>00510         <span class="keywordtype">bool</span> m_bMemDCCreated;
<a name="l00511"></a>00511 
<a name="l00513"></a>00513         <span class="keywordtype">bool</span> m_bBackGradient;   
<a name="l00515"></a>00515         COLORREF m_BackGradientCol1;
<a name="l00517"></a>00517         COLORREF m_BackGradientCol2;
<a name="l00519"></a>00519         EGradientType m_BackGradientType;
<a name="l00521"></a>00521         COLORREF m_BackColor;   
<a name="l00523"></a>00523         COLORREF m_BorderColor;
<a name="l00525"></a>00525         UINT EdgeType;          
<a name="l00526"></a>00526 
<a name="l00528"></a>00528         CRect m_PlottingRect;   
<a name="l00529"></a>00529 
<a name="l00530"></a>00530         typedef std::map&lt;<span class="keywordtype">unsigned</span>, <a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &amp;quot;interface&amp;quot; for all series in the...">CChartSerie</a>*&gt; TSeriesMap;
<a name="l00532"></a>00532         TSeriesMap m_mapSeries; 
<a name="l00534"></a>00534         <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* m_pAxes[4];
<a name="l00535"></a>00535 
<a name="l00537"></a>00537         <a class="code" href="class_c_chart_legend.html" title="This class is responsible for the legend displayed on the control.">CChartLegend</a>* m_pLegend;        
<a name="l00539"></a>00539         <a class="code" href="class_c_chart_title.html" title="This class is responsible for the titles displayed on the control.">CChartTitle</a>*  m_pTitles;        
<a name="l00540"></a>00540 
<a name="l00542"></a>00542         <span class="keywordtype">bool</span> m_bPanEnabled;
<a name="l00544"></a>00544         <span class="keywordtype">bool</span> m_bRMouseDown;             
<a name="l00546"></a>00546         CPoint m_PanAnchor;
<a name="l00547"></a>00547 
<a name="l00549"></a>00549         <span class="keywordtype">bool</span>  m_bZoomEnabled;
<a name="l00551"></a>00551         <span class="keywordtype">bool</span>  m_bLMouseDown;
<a name="l00553"></a>00553         CRect m_rectZoomArea;
<a name="l00555"></a>00555         COLORREF m_ZoomRectColor;
<a name="l00556"></a>00556 
<a name="l00558"></a>00558         <span class="keywordtype">bool</span> m_bToolBarCreated;
<a name="l00559"></a>00559 
<a name="l00561"></a>00561     CFont  m_PrinterFont;  
<a name="l00563"></a>00563     CSize m_LogicalPageSize;     
<a name="l00565"></a>00565     CSize m_PaperSize;    
<a name="l00566"></a>00566 
<a name="l00567"></a>00567         typedef std::map&lt;<span class="keywordtype">unsigned</span>, <a class="code" href="class_c_chart_cursor.html" title="Base class for cursors which can be added to the chart control.">CChartCursor</a>*&gt; TCursorMap;
<a name="l00569"></a>00569         TCursorMap m_mapCursors;
<a name="l00570"></a>00570 
<a name="l00572"></a>00572         <a class="code" href="class_c_chart_mouse_listener.html" title="Listener for mouse events occuring on the chart control.">CChartMouseListener</a>* m_pMouseListener;
<a name="l00573"></a>00573 
<a name="l00575"></a>00575         <span class="keywordtype">bool</span> m_bMouseVisible;
<a name="l00576"></a>00576 
<a name="l00577"></a>00577         typedef TSeriesMap::const_iterator TSeriesMapIter;
<a name="l00579"></a>00579         TSeriesMapIter m_currentSeries;
<a name="l00580"></a>00580 };
<a name="l00581"></a>00581 
<a name="l00583"></a>00583 
<a name="l00584"></a>00584 <span class="comment">//{{AFX_INSERT_LOCATION}}</span>
<a name="l00585"></a>00585 <span class="comment">// Microsoft Visual C++ will insert additional declarations immediately before the previous line.</span>
<a name="l00586"></a>00586 
</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>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer
Belgium Belgium
I am a 29 years old guy and I live with my girlfriend in Hoegaarden, little city from Belgium well known for its white beer Smile | :) .
I studied as an industrial engineer in electronics but I oriented myself more towards software development when I started to work.
Currently I am working in a research centre in mechatronica. I mainly develop in C++ but I also do a bit of Java.
When I have so spare time, I like to read (mainly fantasy) and play electric guitar.

Comments and Discussions