Click here to Skip to main content
15,861,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.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: CChartLegend 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>CChartLegend Class Reference</h1><!-- doxytag: class="CChartLegend" -->This class is responsible for the legend displayed on the control.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="_chart_legend_8h-source.html">ChartLegend.h</a>&gt;</code>
<p>

<p>
<a href="class_c_chart_legend-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_legend.html#b638f2259d00f46816a5c0bba7529a54">DockSide</a> { <b>dsDockRight</b>, 
<b>dsDockLeft</b>, 
<b>dsDockTop</b>, 
<b>dsDockBottom</b>
 }</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Enumeration specifying on which side of the control the legend is docked. <br></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="a23df25eefd5506133162db7b291fdfe"></a><!-- doxytag: member="CChartLegend::SetFont" ref="a23df25eefd5506133162db7b291fdfe" args="(int iPointSize, const TChartString &amp;strFaceName)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#a23df25eefd5506133162db7b291fdfe">SetFont</a> (int iPointSize, const TChartString &amp;strFaceName)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the font used to display the series names. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="37edaeb7516a4c0e0473f30afd211aec"></a><!-- doxytag: member="CChartLegend::DockLegend" ref="37edaeb7516a4c0e0473f30afd211aec" args="(DockSide dsSide)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#37edaeb7516a4c0e0473f30afd211aec">DockLegend</a> (<a class="el" href="class_c_chart_legend.html#b638f2259d00f46816a5c0bba7529a54">DockSide</a> dsSide)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Dock the legend on a specific side of the control. Default is right. <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_legend.html#398a83f500e7d3ec88b53baac0caa8f9">UndockLegend</a> (int iLeftPos, int iTopPos)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Undock the legend.  <a href="#398a83f500e7d3ec88b53baac0caa8f9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="316543887a3a6af4a4133049a6574130"></a><!-- doxytag: member="CChartLegend::SetTransparent" ref="316543887a3a6af4a4133049a6574130" args="(bool bTransparent)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#316543887a3a6af4a4133049a6574130">SetTransparent</a> (bool bTransparent)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the background of the legend transparent. <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_legend.html#0bb7fb625a300c260390c96422db725b">SetHorizontalMode</a> (bool bHorizontal)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the legend in horizontal/vertical mode.  <a href="#0bb7fb625a300c260390c96422db725b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ea145cd45c337496e726a9a958205f1b"></a><!-- doxytag: member="CChartLegend::SetVisible" ref="ea145cd45c337496e726a9a958205f1b" args="(bool bVisible)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#ea145cd45c337496e726a9a958205f1b">SetVisible</a> (bool bVisible)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the legend visible/invisible. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b2c65ac7823a1551eff83709f4310ddf"></a><!-- doxytag: member="CChartLegend::IsVisible" ref="b2c65ac7823a1551eff83709f4310ddf" args="() const " -->
bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#b2c65ac7823a1551eff83709f4310ddf">IsVisible</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns true if the legend is visible. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="03431c7ae2764527fead0db1f129c187"></a><!-- doxytag: member="CChartLegend::GetBackColor" ref="03431c7ae2764527fead0db1f129c187" args="() const " -->
COLORREF&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#03431c7ae2764527fead0db1f129c187">GetBackColor</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the back color of the legend. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="949ef9f6d4d372efec72017fa5d101d6"></a><!-- doxytag: member="CChartLegend::SetBackColor" ref="949ef9f6d4d372efec72017fa5d101d6" args="(COLORREF NewColor)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#949ef9f6d4d372efec72017fa5d101d6">SetBackColor</a> (COLORREF NewColor)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the back color of the legend. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="89ee10fed100ff1b19c16908bc79491d"></a><!-- doxytag: member="CChartLegend::GetShadowColor" ref="89ee10fed100ff1b19c16908bc79491d" args="() const " -->
COLORREF&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#89ee10fed100ff1b19c16908bc79491d">GetShadowColor</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the shadow color. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="db9a437ec8a341503bcf03ad8f04b780"></a><!-- doxytag: member="CChartLegend::SetShadowColor" ref="db9a437ec8a341503bcf03ad8f04b780" args="(COLORREF NewColor)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#db9a437ec8a341503bcf03ad8f04b780">SetShadowColor</a> (COLORREF NewColor)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the shadow color. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3e492ab1e36f3e861b82dd688f35ab2b"></a><!-- doxytag: member="CChartLegend::EnableShadow" ref="3e492ab1e36f3e861b82dd688f35ab2b" args="(bool bEnable)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#3e492ab1e36f3e861b82dd688f35ab2b">EnableShadow</a> (bool bEnable)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Enables/disables the shadow. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4fe2a3537a6f8474cd2fe5010ecb0dcc"></a><!-- doxytag: member="CChartLegend::SetShadowDepth" ref="4fe2a3537a6f8474cd2fe5010ecb0dcc" args="(int Depth)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#4fe2a3537a6f8474cd2fe5010ecb0dcc">SetShadowDepth</a> (int Depth)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the shadow depth (in pixels). <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="de42499c29132ecdda476afb6a9b366c"></a><!-- doxytag: member="CChartLegend::IsPointInside" ref="de42499c29132ecdda476afb6a9b366c" args="(const CPoint &amp;screenPoint) const " -->
BOOL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_chart_legend.html#de42499c29132ecdda476afb6a9b366c">IsPointInside</a> (const CPoint &amp;screenPoint) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns true if the screen point is on the legend region. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This class is responsible for the legend displayed on the control. 
<p>
Series which are named will be displayed in the legend. The legend object is retrieved by calling the GetLegend() function on the <a class="el" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a> class. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="0bb7fb625a300c260390c96422db725b"></a><!-- doxytag: member="CChartLegend::SetHorizontalMode" ref="0bb7fb625a300c260390c96422db725b" args="(bool bHorizontal)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CChartLegend::SetHorizontalMode           </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>bHorizontal</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the legend in horizontal/vertical mode. 
<p>
In horizontal mode, the names are drawn next to each other instead of on top of each other. 
</div>
</div><p>
<a class="anchor" name="398a83f500e7d3ec88b53baac0caa8f9"></a><!-- doxytag: member="CChartLegend::UndockLegend" ref="398a83f500e7d3ec88b53baac0caa8f9" args="(int iLeftPos, int iTopPos)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CChartLegend::UndockLegend           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>iLeftPos</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>iTopPos</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Undock the legend. 
<p>
When the legend is undocked (floating), it doesn't take any margin size but is drawn on top of the control at the specified location (it can be above the plotting area for instance). <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>iLeftPos</em>&nbsp;</td><td>The left position of the legend, in pixels (from the left of the control) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>iTopPos</em>&nbsp;</td><td>The top position of the legend, in pixels (from the top of the control) </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_legend_8h-source.html">ChartLegend.h</a><li>E:/Sources Misc/ChartDemo/ChartCtrl/ChartLegend.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