Click here to Skip to main content
15,881,172 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/ChartAxis.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/ChartAxis.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"> *      ChartAxis.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">#ifndef _CHARTAXIS_H_</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTAXIS_H_</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "ChartScrollBar.h"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "ChartString.h"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;afx.h&gt;</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;list&gt;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="keyword">class </span><a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
<a name="l00032"></a>00032 <span class="keyword">class </span><a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>;
<a name="l00033"></a>00033 <span class="keyword">class </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>;
<a name="l00034"></a>00034 <span class="keyword">class </span><a class="code" href="class_c_chart_axis_label.html" title="Draws the label of an axis.">CChartAxisLabel</a>;
<a name="l00035"></a>00035    
<a name="l00037"></a>00037 
<a name="l00049"></a><a class="code" href="class_c_chart_axis.html">00049</a> <span class="keyword">class </span><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 name="l00050"></a>00050 {
<a name="l00051"></a>00051         <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
<a name="l00052"></a>00052         <span class="keyword">friend</span> <a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>;
<a name="l00053"></a>00053         <span class="keyword">friend</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>;
<a name="l00054"></a>00054         <span class="keyword">friend</span> <a class="code" href="class_c_chart_scroll_bar.html" title="Class which manages the interaction with the axis scroll bar.">CChartScrollBar</a>;
<a name="l00055"></a>00055 
<a name="l00056"></a>00056 <span class="keyword">public</span>:
<a name="l00058"></a>00058         <a class="code" href="class_c_chart_axis.html#c917fa1081c59c2a896877e96db8a654" title="Default constructor.">CChartAxis</a>();
<a name="l00060"></a>00060         <span class="keyword">virtual</span> <a class="code" href="class_c_chart_axis.html#2fd6614c7bece2b705d21ed384c78928" title="Default destructor.">~CChartAxis</a>();
<a name="l00061"></a>00061 
<a name="l00063"></a>00063         <span class="keywordtype">int</span> <a class="code" href="class_c_chart_axis.html#64a6ddeff5c34376d461c5bd5c6177dc" title="Retrieves the position (in %) of the axis.">GetPosition</a>();
<a name="l00064"></a>00064 
<a name="l00066"></a>00066 
<a name="l00072"></a>00072         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#e28da3bb1baa1938e70d0f25c02c3798" title="Sets the axis in reverse.">SetInverted</a>(<span class="keywordtype">bool</span> bInverted);
<a name="l00074"></a><a class="code" href="class_c_chart_axis.html#0fd782ffe225b9a639a3880691b6e2ff">00074</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#0fd782ffe225b9a639a3880691b6e2ff" title="Retrieves if the axis is inverted or not.">IsInverted</a>()<span class="keyword"> const  </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#bf01a1fb475970963e8c71bff67720b2" title="Indicates if the axis is inverted.">m_bIsInverted</a>; }
<a name="l00075"></a>00075         
<a name="l00077"></a>00077 
<a name="l00084"></a>00084         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#053e50c1db5a5f96c5543b81d90ec048" title="Sets the axis in automatic or manual mode.">SetAutomatic</a>(<span class="keywordtype">bool</span> bAutomatic); 
<a name="l00086"></a>00086 
<a name="l00089"></a><a class="code" href="class_c_chart_axis.html#70c25c84b78ac9d349e1b30162bf88ce">00089</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#70c25c84b78ac9d349e1b30162bf88ce" title="Returns true if an automatic mode has been set on this axis.">IsAutomatic</a>()<span class="keyword">  const  </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#ab7d8484805306c90d550313535981bb" title="Indicates if the axis is automatic.">m_AutoMode</a> != <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162c238e209352b6df80689cd7febd452a2" title="The axis min and max values are set manually.">NotAutomatic</a>; }
<a name="l00090"></a>00090 
<a name="l00092"></a><a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162">00092</a>         <span class="keyword">enum</span> <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162" title="The different modes of automatic modes for an axis.">EAxisAutoModes</a> 
<a name="l00093"></a>00093         {
<a name="l00095"></a><a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162c238e209352b6df80689cd7febd452a2">00095</a>                 <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162c238e209352b6df80689cd7febd452a2" title="The axis min and max values are set manually.">NotAutomatic</a>,
<a name="l00097"></a><a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162d8bbaa0f333ec3bed105282c270d95d7">00097</a>                 <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162d8bbaa0f333ec3bed105282c270d95d7" title="The axis min and max values of the axis are the min and max values of all series...">FullAutomatic</a>,
<a name="l00099"></a><a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac4972831626e6e92f41d3fc547aaaa6e35e6ad5290">00099</a>                 <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac4972831626e6e92f41d3fc547aaaa6e35e6ad5290" title="The axis min and max values of the axis are the visible min and max values of all...">ScreenAutomatic</a>
<a name="l00100"></a>00100         };
<a name="l00101"></a>00101 
<a name="l00103"></a>00103         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#c8c07c4ad50ff449f557ab57232f8a81" title="Sets the automatic mode of the axis.">SetAutomaticMode</a>(<a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162" title="The different modes of automatic modes for an axis.">EAxisAutoModes</a> AutoMode); 
<a name="l00105"></a><a class="code" href="class_c_chart_axis.html#a2f448f32ecbf2406adbc987c2e354ef">00105</a>         <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162" title="The different modes of automatic modes for an axis.">EAxisAutoModes</a> <a class="code" href="class_c_chart_axis.html#a2f448f32ecbf2406adbc987c2e354ef" title="Gets the automatic type of the axis.">GetAutomaticMode</a>()<span class="keyword">  const  </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#ab7d8484805306c90d550313535981bb" title="Indicates if the axis is automatic.">m_AutoMode</a>; }
<a name="l00106"></a>00106 
<a name="l00108"></a>00108         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#8108cb56f8a1e6b2688a429158ce38e3" title="Sets the axis visible/invisible.">SetVisible</a>(<span class="keywordtype">bool</span> bVisible); 
<a name="l00110"></a><a class="code" href="class_c_chart_axis.html#9e7bf4eec0e4a881f9ef869e3e12cd2e">00110</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#9e7bf4eec0e4a881f9ef869e3e12cd2e" title="Retrieves the axis automatic mode.">IsVisible</a>()<span class="keyword">  const  </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#4fa87c936a3fc43345159691be8de282" title="Indicates if the axis is visible or not.">m_bIsVisible</a>; }
<a name="l00111"></a>00111 
<a name="l00113"></a>00113 
<a name="l00121"></a>00121         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#308cfb9fa31478e1689807693ee79f87" title="Sets the axis min and max values.">SetMinMax</a>(<span class="keywordtype">double</span> Minimum, <span class="keywordtype">double</span> Maximum);
<a name="l00123"></a><a class="code" href="class_c_chart_axis.html#72dcb666db261ed42c3bf81a928f3a89">00123</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#72dcb666db261ed42c3bf81a928f3a89" title="Gets the min anx max values of the axis.">GetMinMax</a>(<span class="keywordtype">double</span>&amp; Minimum, <span class="keywordtype">double</span>&amp; Maximum)<span class="keyword"> const</span>
<a name="l00124"></a>00124 <span class="keyword">        </span>{
<a name="l00125"></a>00125                 Minimum = <a class="code" href="class_c_chart_axis.html#21beddc72ca06eb4057ff8b22176bc56" title="The axis min value.">m_MinValue</a>;
<a name="l00126"></a>00126                 Maximum = <a class="code" href="class_c_chart_axis.html#d983f570d89221b662818a4d32b1d79f" title="The axis max value.">m_MaxValue</a>;
<a name="l00127"></a>00127         }
<a name="l00128"></a>00128 
<a name="l00130"></a>00130         <span class="keywordtype">void</span>     <a class="code" href="class_c_chart_axis.html#f4930424d5142658710116b971ece619" title="Sets the axis color.">SetAxisColor</a>(COLORREF NewColor);
<a name="l00132"></a>00132         <span class="keywordtype">void</span>     <a class="code" href="class_c_chart_axis.html#6cb9a7c906010039c8d2b23d4cb2a9ef" title="Sets the tick labels color.">SetTextColor</a>(COLORREF NewColor);
<a name="l00134"></a><a class="code" href="class_c_chart_axis.html#f682fbf0598b0e268fbbb2d5106f3516">00134</a>         COLORREF <a class="code" href="class_c_chart_axis.html#f682fbf0598b0e268fbbb2d5106f3516" title="Gets the tick labels color.">GetTextColor</a>()<span class="keyword"> const           </span>{ <span class="keywordflow">return</span> m_TextColor;           }
<a name="l00136"></a>00136 
<a name="l00142"></a>00142         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#3fa54ecfefdfe6ebdfe3f2adce0a6bfb" title="Sets the tick labels font.">SetFont</a>(<span class="keywordtype">int</span> nPointSize, <span class="keyword">const</span> TChartString&amp; strFaceName);
<a name="l00143"></a>00143 
<a name="l00145"></a><a class="code" href="class_c_chart_axis.html#4417f35b4d3f19e282d80f6bb09daa5f">00145</a>         <a class="code" href="class_c_chart_axis_label.html" title="Draws the label of an axis.">CChartAxisLabel</a>* <a class="code" href="class_c_chart_axis.html#4417f35b4d3f19e282d80f6bb09daa5f" title="Retrieves the chart axis label object.">GetLabel</a>()<span class="keyword"> const       </span>{ <span class="keywordflow">return</span> m_pAxisLabel; }
<a name="l00147"></a><a class="code" href="class_c_chart_axis.html#74b26b2b6d797991ee74120594e04f3d">00147</a>         <a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>*              <a class="code" href="class_c_chart_axis.html#74b26b2b6d797991ee74120594e04f3d" title="Retrieves the chart axis grid object.">GetGrid</a>()<span class="keyword">      const   </span>{ <span class="keywordflow">return</span> m_pAxisGrid;  }
<a name="l00148"></a>00148 
<a name="l00150"></a>00150 
<a name="l00158"></a>00158         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#e16cf020349a4b6d7ef484edde4347ba" title="Sets the margin size.">SetMarginSize</a>(<span class="keywordtype">bool</span> bAuto, <span class="keywordtype">int</span> iNewSize);
<a name="l00159"></a>00159 
<a name="l00161"></a><a class="code" href="class_c_chart_axis.html#0100cbb22d10c56eb7bc07cc62db0b36">00161</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#0100cbb22d10c56eb7bc07cc62db0b36" title="Enable the pan and zoom for this axis.">SetPanZoomEnabled</a>(<span class="keywordtype">bool</span> bEnabled)   { m_bZoomEnabled = bEnabled; }
<a name="l00163"></a>00163 
<a name="l00166"></a><a class="code" href="class_c_chart_axis.html#cb3b5a6071ebd6fe2cbd19cd9094fa7f">00166</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#cb3b5a6071ebd6fe2cbd19cd9094fa7f" title="Sets the zoom limit.">SetZoomLimit</a>(<span class="keywordtype">double</span> dLimit)                { m_dZoomLimit = dLimit; }
<a name="l00167"></a>00167 
<a name="l00169"></a>00169         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#f2f3caee0c87708cf40518ed07ae7808" title="Enables/disables the scroll bar.">EnableScrollBar</a>(<span class="keywordtype">bool</span> bEnabled);
<a name="l00171"></a><a class="code" href="class_c_chart_axis.html#e60ca9c4f27472b7d60a87d49ce5040b">00171</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#e60ca9c4f27472b7d60a87d49ce5040b" title="Retrieves if the scroll bar is enabled or not.">ScrollBarEnabled</a>()<span class="keyword"> const  </span>
<a name="l00172"></a>00172 <span class="keyword">        </span>{ 
<a name="l00173"></a>00173                 <span class="keywordflow">if</span> (m_pScrollBar)
<a name="l00174"></a>00174                         <span class="keywordflow">return</span> (m_pScrollBar-&gt;<a class="code" href="class_c_chart_scroll_bar.html#f71fa8b4d24a4b5d8ae6577b0a4691f5" title="Returns true if the scroll bar is enabled.">GetEnabled</a>()); 
<a name="l00175"></a>00175                 <span class="keywordflow">else</span>
<a name="l00176"></a>00176                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00177"></a>00177         }
<a name="l00179"></a>00179 
<a name="l00183"></a>00183         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#64e03f4cbe792f05772159ef7ed9e2e8" title="Specifies if the scroll bar is in auto-hide mode.">SetAutoHideScrollBar</a>(<span class="keywordtype">bool</span> bAutoHide);
<a name="l00185"></a>00185         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#b30b762fd016500a992a6095c63b648f" title="Retrieves if the scroll bar is in auto-hide mode.">GetAutoHideScrollBar</a>() <span class="keyword">const</span>;
<a name="l00186"></a>00186 
<a name="l00188"></a>00188 
<a name="l00201"></a>00201         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#1f7c1f1d63f629cc91694735e085ff72" title="Sets the axis in discrete mode.">SetDiscrete</a>(<span class="keywordtype">bool</span> bDiscrete);
<a name="l00202"></a>00202 
<a name="l00204"></a>00204 
<a name="l00212"></a>00212     <span class="keywordtype">long</span> <a class="code" href="class_c_chart_axis.html#e9bff492d909eb9d86f1b95d0cff9c45" title="Converts a value on the axis to a screen position.">ValueToScreen</a>(<span class="keywordtype">double</span> Value) <span class="keyword">const</span>;
<a name="l00214"></a>00214 
<a name="l00225"></a>00225    <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#474712f8b4f24920304443cbe6d3821d" title="Converts a screen position to a value on the axis.">ScreenToValue</a>(<span class="keywordtype">long</span> ScreenVal) <span class="keyword">const</span>;
<a name="l00226"></a>00226 
<a name="l00228"></a><a class="code" href="class_c_chart_axis.html#635f5e389dadc7f59b81ce6b0a4529f9">00228</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#635f5e389dadc7f59b81ce6b0a4529f9" title="Returns true if the axis is horizontal.">IsHorizontal</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#ed506671697ff705f470d1a2c7b036e2" title="Indicates if this is an horizontal or vertical axis.">m_bIsHorizontal</a>; } 
<a name="l00229"></a>00229 
<a name="l00231"></a>00231         BOOL <a class="code" href="class_c_chart_axis.html#2ebc8ea10c41e4b635e097469f56f313" title="Returns true if a screen point is in the region of the axis.">IsPointInside</a>(<span class="keyword">const</span> CPoint&amp; screenPoint) <span class="keyword">const</span>;
<a name="l00232"></a>00232 
<a name="l00233"></a>00233 <span class="keyword">protected</span>:
<a name="l00235"></a>00235 
<a name="l00239"></a>00239         <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#3c38b9980d4a3c999b03443193df6006" title="Returns the first tick value.">GetFirstTickValue</a>() <span class="keyword">const</span> = 0;
<a name="l00241"></a>00241 
<a name="l00250"></a>00250         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#88f7d87dffd2c1ef7ed5a3f4edd4a004" title="Retrieves the next tick value after a given tick.">GetNextTickValue</a>(<span class="keywordtype">double</span> dCurrentTick, <span class="keywordtype">double</span>&amp; dNextTick) <span class="keyword">const</span> = 0;
<a name="l00252"></a>00252 
<a name="l00260"></a>00260         <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="class_c_chart_axis.html#bc9379bae77cf45f3f5010a247a5b8b2" title="Retrieves the screen position of a certain tick.">GetTickPos</a>(<span class="keywordtype">double</span> Value) <span class="keyword">const</span> = 0;
<a name="l00262"></a>00262 
<a name="l00270"></a>00270         <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="class_c_chart_axis.html#9cf74d600feed2f9a214644b97632829" title="Converts a value on the axis to a screen position.">ValueToScreenDiscrete</a>(<span class="keywordtype">double</span> Value) <span class="keyword">const</span> = 0;
<a name="l00272"></a>00272 
<a name="l00280"></a>00280         <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="class_c_chart_axis.html#4262b15c1564b6dd8220afbe62ae966b" title="Converts a value on the axis to a screen position.">ValueToScreenStandard</a>(<span class="keywordtype">double</span> Value) <span class="keyword">const</span>;
<a name="l00281"></a>00281 
<a name="l00283"></a>00283 
<a name="l00290"></a>00290         <span class="keyword">virtual</span> TChartString <a class="code" href="class_c_chart_axis.html#d7a3eac8b9db57f066f52074a56d8ec7" title="Retrieves the label for a specific tick.">GetTickLabel</a>(<span class="keywordtype">double</span> TickValue) <span class="keyword">const</span> = 0;
<a name="l00291"></a>00291 
<a name="l00293"></a>00293         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#720800eaa24e5d2fd14a44d2e823f8c2" title="Forces a recalculation of the tick increment.">RefreshTickIncrement</a>() = 0;
<a name="l00295"></a>00295         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#d90be3be952a70b66471b59cd008c21f" title="Forces a recalculation of the first tick value.">RefreshFirstTick</a>() = 0;
<a name="l00296"></a>00296 
<a name="l00298"></a>00298 
<a name="l00307"></a>00307         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#cadb566b32dd7cb52fd29d50eda6974f" title="Retrieves the step information related to the scrollbar.">GetScrollbarSteps</a>(<span class="keywordtype">int</span>&amp; iTotalSteps, <span class="keywordtype">int</span>&amp; iCurrentStep);
<a name="l00309"></a>00309 
<a name="l00320"></a>00320         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#be54a513053538716155409cdaf2ac68" title="Sets the axis to the specified scrollbar step.">SetAxisToScrollStep</a>(<span class="keywordtype">int</span> iPreviousStep, <span class="keywordtype">int</span> iCurrentStep, <span class="keywordtype">bool</span> bScrollInverted);
<a name="l00321"></a>00321 
<a name="l00323"></a>00323 
<a name="l00331"></a>00331         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#b890a71d7893431f7651d0fbb9352705" title="Pan the axis.">PanAxis</a>(<span class="keywordtype">long</span> PanStart, <span class="keywordtype">long</span> PanEnd);
<a name="l00333"></a>00333         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#7202c1f22e3e0c678def008f19c53e19" title="Sets the min and max values of the axis due to a zoom operation.">SetZoomMinMax</a>(<span class="keywordtype">double</span> Minimum, <span class="keywordtype">double</span> Maximum);
<a name="l00335"></a>00335         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#933b0071a04af914af06ec03e7a0b250" title="Reverts the zoom and pan settings.">UndoZoom</a>();
<a name="l00336"></a>00336 
<a name="l00338"></a>00338     <span class="keywordtype">long</span>  <a class="code" href="class_c_chart_axis.html#da7fa85a04f2430e5e293c248d87998f" title="Retrieves the lenght (in pixels) of the axis.">GetAxisLenght</a>() <span class="keyword">const</span>;
<a name="l00340"></a>00340         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#3e6094a0885da791201677702e2a9989" title="Retrieves the min and max values for all the series related to this axis.">GetSeriesMinMax</a>(<span class="keywordtype">double</span>&amp; Minimum, <span class="keywordtype">double</span>&amp; Maximum);
<a name="l00342"></a>00342         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#c2336f30ca4bcbf3ece50d1c741990dd" title="Retrieves the screen min and max values for all the series related to this axis.">GetSeriesScreenMinMax</a>(<span class="keywordtype">double</span>&amp; Minimum, <span class="keywordtype">double</span>&amp; Maximum);
<a name="l00343"></a>00343 
<a name="l00344"></a>00344 <span class="keyword">private</span>:
<a name="l00346"></a>00346 
<a name="l00349"></a>00349         <span class="keywordtype">bool</span> RefreshAutoAxis();
<a name="l00351"></a>00351 
<a name="l00354"></a>00354         <span class="keywordtype">bool</span> RefreshScreenAutoAxis();
<a name="l00355"></a>00355 
<a name="l00357"></a>00357 
<a name="l00362"></a>00362         CSize GetLargestTick(CDC* pDC);
<a name="l00363"></a>00363 
<a name="l00365"></a>00365 
<a name="l00369"></a>00369         <span class="keywordtype">void</span> SetSecondary(<span class="keywordtype">bool</span> bSecondary)      { <a class="code" href="class_c_chart_axis.html#c42a13ee6fb3823fa963f084d30c85a6" title="Specifies if the axis is secondary.">m_bIsSecondary</a> = bSecondary; }
<a name="l00371"></a>00371         <span class="keywordtype">bool</span> IsSecondary()<span class="keyword"> const                        </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#c42a13ee6fb3823fa963f084d30c85a6" title="Specifies if the axis is secondary.">m_bIsSecondary</a>; }
<a name="l00373"></a>00373         <span class="keywordtype">void</span> SetHorizontal(<span class="keywordtype">bool</span> bHorizontal);
<a name="l00374"></a>00374 
<a name="l00376"></a>00376 
<a name="l00380"></a>00380         <span class="keywordtype">void</span> Draw(CDC* pDC);
<a name="l00382"></a>00382 
<a name="l00386"></a>00386         <span class="keywordtype">void</span> DrawLabel(CDC* pDC);
<a name="l00388"></a>00388 
<a name="l00396"></a>00396         <span class="keywordtype">void</span> DrawTick(CDC* pDC, <span class="keywordtype">double</span> dTickVal);
<a name="l00398"></a>00398 
<a name="l00404"></a>00404         <span class="keywordtype">bool</span> IsLabelOnAxis(<span class="keywordtype">double</span> TickVal);
<a name="l00405"></a>00405 
<a name="l00407"></a>00407 
<a name="l00410"></a>00410         <span class="keywordtype">void</span> RegisterSeries(<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>* pSeries);
<a name="l00412"></a>00412         <span class="keywordtype">void</span> UnregisterSeries(<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>* pSeries);
<a name="l00413"></a>00413 
<a name="l00415"></a>00415         <span class="keywordtype">void</span> CreateScrollBar();
<a name="l00417"></a>00417         <span class="keywordtype">void</span> UpdateScrollBarPos();
<a name="l00419"></a>00419         <span class="keywordtype">void</span> RefreshScrollBar();
<a name="l00420"></a>00420 
<a name="l00422"></a>00422         <span class="keywordtype">void</span> SetParent(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
<a name="l00423"></a>00423 
<a name="l00425"></a>00425 
<a name="l00431"></a>00431         <span class="keywordtype">void</span> SetAxisSize(<span class="keyword">const</span> CRect&amp; ControlRect, <span class="keyword">const</span> CRect&amp; MarginRect);
<a name="l00433"></a>00433 
<a name="l00441"></a>00441         <span class="keywordtype">int</span> ClipMargin(CRect ControlRect,CRect&amp; MarginRect,CDC* pDC);   
<a name="l00443"></a>00443 
<a name="l00447"></a>00447         <span class="keywordtype">void</span> Recalculate();
<a name="l00448"></a>00448 
<a name="l00449"></a>00449 <span class="keyword">protected</span>:
<a name="l00451"></a><a class="code" href="class_c_chart_axis.html#e2c8a1607523b37f4fd11ec35e113856">00451</a>         <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* <a class="code" href="class_c_chart_axis.html#e2c8a1607523b37f4fd11ec35e113856" title="The parent chart control.">m_pParentCtrl</a>;
<a name="l00452"></a>00452 
<a name="l00454"></a><a class="code" href="class_c_chart_axis.html#ed506671697ff705f470d1a2c7b036e2">00454</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#ed506671697ff705f470d1a2c7b036e2" title="Indicates if this is an horizontal or vertical axis.">m_bIsHorizontal</a>;     
<a name="l00456"></a><a class="code" href="class_c_chart_axis.html#bf01a1fb475970963e8c71bff67720b2">00456</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#bf01a1fb475970963e8c71bff67720b2" title="Indicates if the axis is inverted.">m_bIsInverted</a>;     
<a name="l00458"></a>00458 <span class="comment">//      bool m_bIsAutomatic;  </span>
<a name="l00460"></a><a class="code" href="class_c_chart_axis.html#ab7d8484805306c90d550313535981bb">00460</a> <span class="comment"></span>        <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162" title="The different modes of automatic modes for an axis.">EAxisAutoModes</a> <a class="code" href="class_c_chart_axis.html#ab7d8484805306c90d550313535981bb" title="Indicates if the axis is automatic.">m_AutoMode</a>;
<a name="l00461"></a>00461 
<a name="l00463"></a><a class="code" href="class_c_chart_axis.html#4fa87c936a3fc43345159691be8de282">00463</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#4fa87c936a3fc43345159691be8de282" title="Indicates if the axis is visible or not.">m_bIsVisible</a>;
<a name="l00464"></a>00464 
<a name="l00466"></a>00466 
<a name="l00470"></a><a class="code" href="class_c_chart_axis.html#c42a13ee6fb3823fa963f084d30c85a6">00470</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#c42a13ee6fb3823fa963f084d30c85a6" title="Specifies if the axis is secondary.">m_bIsSecondary</a>;    
<a name="l00471"></a>00471 
<a name="l00473"></a><a class="code" href="class_c_chart_axis.html#d983f570d89221b662818a4d32b1d79f">00473</a>         <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#d983f570d89221b662818a4d32b1d79f" title="The axis max value.">m_MaxValue</a>;              
<a name="l00475"></a><a class="code" href="class_c_chart_axis.html#21beddc72ca06eb4057ff8b22176bc56">00475</a>         <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#21beddc72ca06eb4057ff8b22176bc56" title="The axis min value.">m_MinValue</a>;      
<a name="l00477"></a><a class="code" href="class_c_chart_axis.html#0ef1ca7f15e14d313fa3bfb89e6d8634">00477</a>         <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#0ef1ca7f15e14d313fa3bfb89e6d8634" title="Min value of the axis before it has been zoomed.">m_UnzoomMin</a>;             
<a name="l00479"></a><a class="code" href="class_c_chart_axis.html#b59aae9335438f4013b7cfa6663631f5">00479</a>         <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#b59aae9335438f4013b7cfa6663631f5" title="Max value of the axis before it has been zoomed.">m_UnzoomMax</a>;             
<a name="l00480"></a>00480 
<a name="l00482"></a><a class="code" href="class_c_chart_axis.html#709a22de2a236d99371e6a4b5a9abebb">00482</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#709a22de2a236d99371e6a4b5a9abebb" title="Specify if the tick increment is manual or automatic.">m_bAutoTicks</a>;      
<a name="l00484"></a><a class="code" href="class_c_chart_axis.html#47312e5e307faab0c07d4524d971803c">00484</a>         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#47312e5e307faab0c07d4524d971803c" title="Specify if the axis has to be in discrete mode or not.">m_bDiscrete</a>;
<a name="l00485"></a>00485 
<a name="l00487"></a><a class="code" href="class_c_chart_axis.html#3e31b004cf574ede66a8b069086b4236">00487</a>         <span class="keywordtype">int</span> <a class="code" href="class_c_chart_axis.html#3e31b004cf574ede66a8b069086b4236" title="Start position of the axis (in pixels).">m_StartPos</a>;
<a name="l00489"></a><a class="code" href="class_c_chart_axis.html#a7d85a34e4dc88016775771bf9acc926">00489</a>         <span class="keywordtype">int</span> <a class="code" href="class_c_chart_axis.html#a7d85a34e4dc88016775771bf9acc926" title="End position of the axis (in pixels).">m_EndPos</a>;
<a name="l00491"></a><a class="code" href="class_c_chart_axis.html#a33ee78a82bfa536959c1daaadd6dca6">00491</a>         CRect <a class="code" href="class_c_chart_axis.html#a33ee78a82bfa536959c1daaadd6dca6" title="The rectangle in which the axis is contained.">m_AxisRect</a>;
<a name="l00492"></a>00492 
<a name="l00493"></a>00493 <span class="keyword">private</span>:
<a name="l00495"></a>00495         <span class="keywordtype">int</span>  m_nFontSize;               
<a name="l00497"></a>00497         TChartString m_strFontName;
<a name="l00499"></a>00499         COLORREF m_TextColor;
<a name="l00501"></a>00501         COLORREF m_AxisColor;
<a name="l00502"></a>00502 
<a name="l00504"></a>00504         <a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>*                     m_pAxisGrid;
<a name="l00506"></a>00506         <a class="code" href="class_c_chart_axis_label.html" title="Draws the label of an axis.">CChartAxisLabel</a>*        m_pAxisLabel;
<a name="l00507"></a>00507 
<a name="l00508"></a>00508         <span class="keyword">typedef</span> std::list&lt;CChartSerie*&gt; SeriesList;
<a name="l00510"></a>00510         SeriesList m_pRelatedSeries;            
<a name="l00511"></a>00511 
<a name="l00513"></a>00513         <span class="keywordtype">bool</span> m_bAutoMargin;
<a name="l00515"></a>00515         <span class="keywordtype">int</span> m_iMarginSize;
<a name="l00516"></a>00516 
<a name="l00518"></a>00518         <span class="keywordtype">bool</span> m_bZoomEnabled;
<a name="l00520"></a>00520         <span class="keywordtype">double</span> m_dZoomLimit;
<a name="l00521"></a>00521 
<a name="l00523"></a>00523         <a class="code" href="class_c_chart_scroll_bar.html" title="Class which manages the interaction with the axis scroll bar.">CChartScrollBar</a>* m_pScrollBar;
<a name="l00524"></a>00524 };
<a name="l00525"></a>00525 
<a name="l00526"></a>00526 <span class="preprocessor">#endif  // _CHARTAXIS_H_</span>
</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