Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

High-speed Charting Control

, 13 Jul 2010
A flexible charting control to display 2D data
chartcrtl_src.zip
ChartCtrl_demo.zip
ChartDemo
ChartCtrl
.svn
all-wcprops
entries
format
prop-base
props
text-base
ChartAxis.cpp.svn-base
ChartAxis.h.svn-base
ChartAxisLabel.cpp.svn-base
ChartAxisLabel.h.svn-base
ChartBalloonLabel.h.svn-base
ChartBalloonLabel.inl.svn-base
ChartBarSerie.cpp.svn-base
ChartBarSerie.h.svn-base
ChartCandlestickSerie.cpp.svn-base
ChartCandlestickSerie.h.svn-base
ChartCrossHairCursor.cpp.svn-base
ChartCrossHairCursor.h.svn-base
ChartCtrl.cpp.svn-base
ChartCtrl.h.svn-base
ChartCursor.cpp.svn-base
ChartCursor.h.svn-base
ChartDateTimeAxis.cpp.svn-base
ChartDateTimeAxis.h.svn-base
ChartDragLineCursor.cpp.svn-base
ChartDragLineCursor.h.svn-base
ChartFont.cpp.svn-base
ChartFont.h.svn-base
ChartGanttSerie.cpp.svn-base
ChartGanttSerie.h.svn-base
ChartGradient.cpp.svn-base
ChartGradient.h.svn-base
ChartGrid.cpp.svn-base
ChartGrid.h.svn-base
ChartLabel.h.svn-base
ChartLabel.inl.svn-base
ChartLegend.cpp.svn-base
ChartLegend.h.svn-base
ChartLineSerie.cpp.svn-base
ChartLineSerie.h.svn-base
ChartLogarithmicAxis.cpp.svn-base
ChartLogarithmicAxis.h.svn-base
ChartMouseListener.h.svn-base
ChartPointsArray.h.svn-base
ChartPointsArray.inl.svn-base
ChartPointsSerie.cpp.svn-base
ChartPointsSerie.h.svn-base
ChartScrollBar.cpp.svn-base
ChartScrollBar.h.svn-base
ChartSerie.cpp.svn-base
ChartSerie.h.svn-base
ChartSerieBase.h.svn-base
ChartSerieBase.inl.svn-base
ChartSeriesMouseListener.h.svn-base
ChartStandardAxis.cpp.svn-base
ChartStandardAxis.h.svn-base
ChartString.h.svn-base
ChartSurfaceSerie.cpp.svn-base
ChartSurfaceSerie.h.svn-base
ChartTitle.cpp.svn-base
ChartTitle.h.svn-base
ChartXYSerie.cpp.svn-base
ChartXYSerie.h.svn-base
PointsOrdering.h.svn-base
tmp
prop-base
props
text-base
ChartBalloonLabel.inl
ChartCtrl_source.zip
ChartLabel.inl
ChartPointsArray.inl
ChartSerieBase.inl
ChartDemo.dsp
ChartDemo.dsw
ColourPicker
.svn
entries
format
prop-base
props
text-base
ColourPicker.cpp.svn-base
ColourPicker.h.svn-base
ColourPopup.cpp.svn-base
ColourPopup.h.svn-base
tmp
prop-base
props
text-base
Doc
html
class_c_chart_axis.png
class_c_chart_balloon_label.png
class_c_chart_bar_serie.png
class_c_chart_candlestick_serie.png
class_c_chart_cross_hair_cursor.png
class_c_chart_cursor.png
class_c_chart_date_time_axis.png
class_c_chart_drag_line_cursor.png
class_c_chart_gantt_serie.png
class_c_chart_label.png
class_c_chart_line_serie.png
class_c_chart_logarithmic_axis.png
class_c_chart_points_serie.png
class_c_chart_serie.png
class_c_chart_serie_base.png
class_c_chart_standard_axis.png
class_c_chart_surface_serie.png
class_c_chart_x_y_serie.png
doxygen.png
tab_b.gif
tab_l.gif
tab_r.gif
res
ChartDemo.ico
ChartCtrl_doxygen.zip
html
class_c_chart_axis.png
class_c_chart_balloon_label.png
class_c_chart_bar_serie.png
class_c_chart_candlestick_serie.png
class_c_chart_cross_hair_cursor.png
class_c_chart_cursor.png
class_c_chart_date_time_axis.png
class_c_chart_drag_line_cursor.png
class_c_chart_gantt_serie.png
class_c_chart_label.png
class_c_chart_line_serie.png
class_c_chart_logarithmic_axis.png
class_c_chart_points_serie.png
class_c_chart_serie.png
class_c_chart_serie_base.png
class_c_chart_standard_axis.png
class_c_chart_surface_serie.png
class_c_chart_x_y_serie.png
doxygen.png
tab_b.gif
tab_l.gif
tab_r.gif
ChartCtrl_source.zip
ChartLabel.inl
ChartPointsArray.inl
ChartSerieBase.inl
ChartBalloonLabel.inl
chartctrl_src.zip
chartctr_demo.zip
ChartDemo.clw
ChartDemo.dsp
ChartDemo.dsw
res
ChartDemo.ico
<!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: CChartCursor 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>CChartCursor Class Reference</h1><!-- doxytag: class="CChartCursor" -->Base class for cursors which can be added to the chart control.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="_chart_cursor_8h-source.html">ChartCursor.h</a>&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for CChartCursor:</div>
<div class="dynsection">

<p><center><img src="class_c_chart_cursor.png" usemap="#CChartCursor_map" border="0" alt=""></center>
<map name="CChartCursor_map">
<area href="class_c_chart_cross_hair_cursor.html" alt="CChartCrossHairCursor" shape="rect" coords="0,56,148,80">
<area href="class_c_chart_drag_line_cursor.html" alt="CChartDragLineCursor" shape="rect" coords="158,56,306,80">
</map>
</div>

<p>
<a href="class_c_chart_cursor-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 Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bd4387de9a97c4469f78c86e04dd2e69"></a><!-- doxytag: member="CChartCursor::SetColor" ref="bd4387de9a97c4469f78c86e04dd2e69" args="(COLORREF cursorColor)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#bd4387de9a97c4469f78c86e04dd2e69">SetColor</a> (COLORREF cursorColor)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the cursor color. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4b2f24e0bbbfb236c52b94050d2f5a07"></a><!-- doxytag: member="CChartCursor::GetCursorId" ref="4b2f24e0bbbfb236c52b94050d2f5a07" args="() const " -->
unsigned&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#4b2f24e0bbbfb236c52b94050d2f5a07">GetCursorId</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Retrieves the cursor Id. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="93f4600582c8942db0b01eee3c882a3f"></a><!-- doxytag: member="CChartCursor::RegisterListener" ref="93f4600582c8942db0b01eee3c882a3f" args="(CChartCursorListener *pListener)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#93f4600582c8942db0b01eee3c882a3f">RegisterListener</a> (<a class="el" href="class_c_chart_cursor_listener.html">CChartCursorListener</a> *pListener)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Registers a cursor listener with this cursor. <br></td></tr>
<tr><td colspan="2"><br><h2>Protected Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c9cfaeff5d25373e8e0a0f3e91fb027b"></a><!-- doxytag: member="CChartCursor::TListenerList" ref="c9cfaeff5d25373e8e0a0f3e91fb027b" args="" -->
typedef std::list<br class="typebreak">
&lt; <a class="el" href="class_c_chart_cursor_listener.html">CChartCursorListener</a> * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><b>TListenerList</b></td></tr>

<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="255fd9c02744eab27d12551a218c19d8"></a><!-- doxytag: member="CChartCursor::CChartCursor" ref="255fd9c02744eab27d12551a218c19d8" args="(CChartCtrl *pParent)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#255fd9c02744eab27d12551a218c19d8">CChartCursor</a> (<a class="el" href="class_c_chart_ctrl.html">CChartCtrl</a> *pParent)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ed9723360dfa27567b8dfb34f4bd6ca9"></a><!-- doxytag: member="CChartCursor::~CChartCursor" ref="ed9723360dfa27567b8dfb34f4bd6ca9" args="()" -->
virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#ed9723360dfa27567b8dfb34f4bd6ca9">~CChartCursor</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default destructor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#fe447ebc13060419ef7b60410ba5532b">OnMouseMove</a> (CPoint mousePoint)=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pure virtual function that is called when the mouse moved on the plot area.  <a href="#fe447ebc13060419ef7b60410ba5532b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#bd95379b8f28b93191de1bf5e02a0126">OnMouseButtonDown</a> (CPoint)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Virtual function that is called when the left mouse button is pressed.  <a href="#bd95379b8f28b93191de1bf5e02a0126"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#93394fc366bf6f76aa0f4cea0858a8f1">OnMouseButtonUp</a> (CPoint)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Virtual function that is called when the left mouse button is released.  <a href="#93394fc366bf6f76aa0f4cea0858a8f1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="122c0784ebeec719cf040692fe218f09"></a><!-- doxytag: member="CChartCursor::Draw" ref="122c0784ebeec719cf040692fe218f09" args="(CDC *pDC)=0" -->
virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#122c0784ebeec719cf040692fe218f09">Draw</a> (CDC *pDC)=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pure virtual function that draws the cursor. <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_cursor.html#99684299e615294469bfb4f0c6079dc8">CursorMoved</a> (double newXValue, double newYValue)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Function that is called by the child classes when the cursor has been moved.  <a href="#99684299e615294469bfb4f0c6079dc8"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="82f0fae88de7676e725cb394c7350bbe"></a><!-- doxytag: member="CChartCursor::m_colCursor" ref="82f0fae88de7676e725cb394c7350bbe" args="" -->
COLORREF&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#82f0fae88de7676e725cb394c7350bbe">m_colCursor</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The color of the cursor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c913e38511292baeb5b8f1ae26e32444"></a><!-- doxytag: member="CChartCursor::m_pParentCtrl" ref="c913e38511292baeb5b8f1ae26e32444" args="" -->
<a class="el" href="class_c_chart_ctrl.html">CChartCtrl</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#c913e38511292baeb5b8f1ae26e32444">m_pParentCtrl</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The parent charting control. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="634c001d77168bbe68963644774eac4e"></a><!-- doxytag: member="CChartCursor::m_uCursorId" ref="634c001d77168bbe68963644774eac4e" args="" -->
unsigned&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#634c001d77168bbe68963644774eac4e">m_uCursorId</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The Id of this curosr. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="fbe312c829d2bbcdd73ce92211e1614c"></a><!-- doxytag: member="CChartCursor::m_lstListeners" ref="fbe312c829d2bbcdd73ce92211e1614c" args="" -->
TListenerList&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#fbe312c829d2bbcdd73ce92211e1614c">m_lstListeners</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">List of all listeners registered with this cursor. <br></td></tr>
<tr><td colspan="2"><br><h2>Static Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a60c63b9ba30caae2c4d4971a2d617af"></a><!-- doxytag: member="CChartCursor::m_uNextFreeId" ref="a60c63b9ba30caae2c4d4971a2d617af" args="" -->
static unsigned&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_cursor.html#a60c63b9ba30caae2c4d4971a2d617af">m_uNextFreeId</a> = 0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Static variable holding the next free cursor Id. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Base class for cursors which can be added to the chart control. 
<p>
This class must be overriden for specific cursor types. This is already done for a cross-hair cursor and a dragline cursor. Each cursor is assigned an Id when it is added to the control. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="99684299e615294469bfb4f0c6079dc8"></a><!-- doxytag: member="CChartCursor::CursorMoved" ref="99684299e615294469bfb4f0c6079dc8" args="(double newXValue, double newYValue)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CChartCursor::CursorMoved           </td>
          <td>(</td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>newXValue</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>newYValue</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Function that is called by the child classes when the cursor has been moved. 
<p>
This will notify all the listeners registered with the cursor. 
</div>
</div><p>
<a class="anchor" name="bd95379b8f28b93191de1bf5e02a0126"></a><!-- doxytag: member="CChartCursor::OnMouseButtonDown" ref="bd95379b8f28b93191de1bf5e02a0126" args="(CPoint)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CChartCursor::OnMouseButtonDown           </td>
          <td>(</td>
          <td class="paramtype">CPoint&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline, protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Virtual function that is called when the left mouse button is pressed. 
<p>
This function can be overriden by child classes to take appropriate actions on the mouse click event. 
<p>Reimplemented in <a class="el" href="class_c_chart_drag_line_cursor.html#1b397fe1c95e3b5f2b901f9728d3a58d">CChartDragLineCursor</a>.</p>

</div>
</div><p>
<a class="anchor" name="93394fc366bf6f76aa0f4cea0858a8f1"></a><!-- doxytag: member="CChartCursor::OnMouseButtonUp" ref="93394fc366bf6f76aa0f4cea0858a8f1" args="(CPoint)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CChartCursor::OnMouseButtonUp           </td>
          <td>(</td>
          <td class="paramtype">CPoint&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline, protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Virtual function that is called when the left mouse button is released. 
<p>
This function can be overriden by child classes to take appropriate actions on the mouse click event. 
<p>Reimplemented in <a class="el" href="class_c_chart_drag_line_cursor.html#e4b7d1c533b38e06186305d4a28d1a9c">CChartDragLineCursor</a>.</p>

</div>
</div><p>
<a class="anchor" name="fe447ebc13060419ef7b60410ba5532b"></a><!-- doxytag: member="CChartCursor::OnMouseMove" ref="fe447ebc13060419ef7b60410ba5532b" args="(CPoint mousePoint)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CChartCursor::OnMouseMove           </td>
          <td>(</td>
          <td class="paramtype">CPoint&nbsp;</td>
          <td class="paramname"> <em>mousePoint</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected, pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Pure virtual function that is called when the mouse moved on the plot area. 
<p>
This function must be overriden by child classes to take appropriate actions on the mouse move event. 
<p>Implemented in <a class="el" href="class_c_chart_cross_hair_cursor.html#94b2631efaf940e76aeb5dfc71135641">CChartCrossHairCursor</a>, and <a class="el" href="class_c_chart_drag_line_cursor.html#c844f049640ccc6d73d4cb21b6ae8c63">CChartDragLineCursor</a>.</p>

</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_cursor_8h-source.html">ChartCursor.h</a><li>E:/Sources Misc/ChartDemo/ChartCtrl/ChartCursor.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)

Share

About the Author

Cedric Moonen
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.

| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 13 Jul 2010
Article Copyright 2006 by Cedric Moonen
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid