Click here to Skip to main content
15,860,844 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.1M   99.5K   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: CChartDateTimeAxis Class Reference</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 class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>CChartDateTimeAxis Class Reference</h1><!-- doxytag: class="CChartDateTimeAxis" --><!-- doxytag: inherits="CChartAxis" -->A specialization of the <a class="el" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a> class for displaying date and time data.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="_chart_date_time_axis_8h-source.html">ChartDateTimeAxis.h</a>&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for CChartDateTimeAxis:</div>
<div class="dynsection">

<p><center><img src="class_c_chart_date_time_axis.png" usemap="#CChartDateTimeAxis_map" border="0" alt=""></center>
<map name="CChartDateTimeAxis_map">
<area href="class_c_chart_axis.html" alt="CChartAxis" shape="rect" coords="0,0,128,24">
</map>
</div>

<p>
<a href="class_c_chart_date_time_axis-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_date_time_axis.html#783a3bd7291b25d95d05514150434c8f">TimeInterval</a> { <br>
&nbsp;&nbsp;<b>tiSecond</b>, 
<b>tiMinute</b>, 
<b>tiHour</b>, 
<b>tiDay</b>, 
<br>
&nbsp;&nbsp;<b>tiMonth</b>, 
<b>tiYear</b>
<br>
 }</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Enum listing the different base intervals. <br></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_date_time_axis.html#fc19163a7fa7d95276852c0b6c58af7e">SetTickIncrement</a> (bool bAuto, <a class="el" href="class_c_chart_date_time_axis.html#783a3bd7291b25d95d05514150434c8f">TimeInterval</a> Interval, int Multiplier)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the tick increment.  <a href="#fc19163a7fa7d95276852c0b6c58af7e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_date_time_axis.html#9cdd6aa9c910a7ff159e07387fb5e06a">SetTickLabelFormat</a> (bool bAutomatic, const TChartString &amp;strFormat)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the format of the tick labels.  <a href="#9cdd6aa9c910a7ff159e07387fb5e06a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_date_time_axis.html#672859f53992cf52e6763661c2271a85">SetReferenceTick</a> (COleDateTime referenceTick)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the reference tick.  <a href="#672859f53992cf52e6763661c2271a85"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A specialization of the <a class="el" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a> class for displaying date and time data. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="672859f53992cf52e6763661c2271a85"></a><!-- doxytag: member="CChartDateTimeAxis::SetReferenceTick" ref="672859f53992cf52e6763661c2271a85" args="(COleDateTime referenceTick)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CChartDateTimeAxis::SetReferenceTick           </td>
          <td>(</td>
          <td class="paramtype">COleDateTime&nbsp;</td>
          <td class="paramname"> <em>referenceTick</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the reference tick. 
<p>
The reference tick is a date/time which specifies a tick which should always be displayed on the axis. This is needed when the tick interval multiplier is not 1 (e.g. the interval between two ticks is 3 months). In that specific case, there is no way for the control to know which ticks should be displayed (in our example, the chart doesn't know if the first tick will be january, february or march). This is particularly annoying when the axis is panned (in that case, if we always take the first month on the axis as first tick, the ticks will always switch from one month to another). By having a refence tick, this forces the control to calculate all tick intervals based on this reference. It is set to January 1st 2000 by default. 
</div>
</div><p>
<a class="anchor" name="fc19163a7fa7d95276852c0b6c58af7e"></a><!-- doxytag: member="CChartDateTimeAxis::SetTickIncrement" ref="fc19163a7fa7d95276852c0b6c58af7e" args="(bool bAuto, TimeInterval Interval, int Multiplier)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CChartDateTimeAxis::SetTickIncrement           </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>bAuto</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_c_chart_date_time_axis.html#783a3bd7291b25d95d05514150434c8f">TimeInterval</a>&nbsp;</td>
          <td class="paramname"> <em>Interval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>Multiplier</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the tick increment. 
<p>
The tick increment is the value between two adjacents ticks on the axis. In case of a date time axis, the interval is specified by a time period because this interval might not be constant (for instance, if a tick interval of one month is specified, the distance between two adjacents ticks is not constant: it depends on the number of days in the month). The full tick interval is made of a base interval (day, month, hour, ...) and a multiplier, that is applied to this base interval. So, for an interval of three months between two ticks, you have to specify tiMonth for the interval and 3 for the multiplier. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>bAuto</em>&nbsp;</td><td>Specifies if the tick increment is automatically calculated. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>Interval</em>&nbsp;</td><td>The base interval. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>Multiplier</em>&nbsp;</td><td>The multiplier applied to the base interval. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="9cdd6aa9c910a7ff159e07387fb5e06a"></a><!-- doxytag: member="CChartDateTimeAxis::SetTickLabelFormat" ref="9cdd6aa9c910a7ff159e07387fb5e06a" args="(bool bAutomatic, const TChartString &amp;strFormat)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CChartDateTimeAxis::SetTickLabelFormat           </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>bAutomatic</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const TChartString &amp;&nbsp;</td>
          <td class="paramname"> <em>strFormat</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the format of the tick labels. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>bAutomatic</em>&nbsp;</td><td>Specifies if the format is calculated automatically. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>strFormat</em>&nbsp;</td><td>The format to apply to the tick label if bAutomatic is false. <br>
Check the documentation of the COleDateTime::Format function on MSDN for more information about the format string. </td></tr>
  </table>
</dl>

</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li>E:/Sources Misc/ChartDemo/ChartCtrl/<a class="el" href="_chart_date_time_axis_8h-source.html">ChartDateTimeAxis.h</a><li>E:/Sources Misc/ChartDemo/ChartCtrl/ChartDateTimeAxis.cpp</ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:11 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