Click here to Skip to main content
15,886,660 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.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: E:/Sources Misc/ChartDemo/ChartCtrl/ChartPointsSerie.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/ChartPointsSerie.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"> *      ChartPointsSerie.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">#if !defined(AFX_CHARTPOINTSSERIE_H__F66C180F_F04C_4E2D_878C_08BDBCE91863__INCLUDED_)</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTPOINTSSERIE_H__F66C180F_F04C_4E2D_878C_08BDBCE91863__INCLUDED_</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 "ChartXYSerie.h"</span>
<a name="l00030"></a>00030 
<a name="l00032"></a>00032 
<a name="l00035"></a><a class="code" href="class_c_chart_points_serie.html">00035</a> <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> : <span class="keyword">public</span> <a class="code" href="class_c_chart_x_y_serie.html" title="Specialization of a CChartSerieBase for series having data with an X and an Y value...">CChartXYSerie</a>  
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037 <span class="keyword">public</span>:
<a name="l00039"></a><a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8">00039</a>         <span class="keyword">enum</span> <a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8" title="The different point shapes.">PointType</a>
<a name="l00040"></a>00040         {
<a name="l00041"></a>00041                 ptEllipse=0,
<a name="l00042"></a>00042                 ptRectangle=1,
<a name="l00043"></a>00043                 ptTriangle=2
<a name="l00044"></a>00044         };
<a name="l00045"></a>00045 
<a name="l00047"></a>00047         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_serie.html#d83eb64abdf71a9a2eb36033cc97a32b" title="Sets the width and height of each points.">SetPointSize</a>(<span class="keywordtype">int</span> XSize, <span class="keywordtype">int</span> YSize);
<a name="l00049"></a><a class="code" href="class_c_chart_points_serie.html#bc86737dbc712394282675bfd0e2eae0">00049</a>         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_serie.html#bc86737dbc712394282675bfd0e2eae0" title="Retrieves the width and height of each points.">GetPointSize</a>(<span class="keywordtype">int</span>&amp; XSize, <span class="keywordtype">int</span>&amp; YSize)<span class="keyword"> const</span>
<a name="l00050"></a>00050 <span class="keyword">        </span>{
<a name="l00051"></a>00051         XSize = m_iXPointSize;
<a name="l00052"></a>00052         YSize = m_iYPointSize;
<a name="l00053"></a>00053     }
<a name="l00055"></a>00055         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_serie.html#78e263b62e046ae765f5cdf3b7760442" title="Sets the points shape.">SetPointType</a>(<a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8" title="The different point shapes.">PointType</a> Type);
<a name="l00057"></a><a class="code" href="class_c_chart_points_serie.html#3522a357f3af5a82ad5f5950a9b8eb68">00057</a>         <a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8" title="The different point shapes.">PointType</a> <a class="code" href="class_c_chart_points_serie.html#3522a357f3af5a82ad5f5950a9b8eb68" title="Returns the points shape.">GetPointType</a>()<span class="keyword"> const     </span>{ <span class="keywordflow">return</span> m_iPointType; }
<a name="l00058"></a>00058 
<a name="l00060"></a>00060         <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_serie.html#4c114ea9ddbf680f2ade770755bbb4e1" title="Sets the border color of the points.">SetBorderColor</a>(COLORREF Color);
<a name="l00062"></a><a class="code" href="class_c_chart_points_serie.html#a2a8c39d30f8556e595cf1184ef10eb0">00062</a>         COLORREF <a class="code" href="class_c_chart_points_serie.html#a2a8c39d30f8556e595cf1184ef10eb0" title="Returns the border color of the points.">GetBorderColor</a>()       { <span class="keywordflow">return</span> m_colBorder; }
<a name="l00063"></a>00063 
<a name="l00065"></a>00065         <a class="code" href="class_c_chart_points_serie.html#f26f71f622ad00186992c17cdc7c8164" title="Constructor.">CChartPointsSerie</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
<a name="l00067"></a>00067         <span class="keyword">virtual</span> <a class="code" href="class_c_chart_points_serie.html#443840d759ffcde1c40fd95ca9951788" title="Destructor.">~CChartPointsSerie</a>();
<a name="l00068"></a>00068         
<a name="l00070"></a>00070 
<a name="l00077"></a>00077         <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_points_serie.html#da57c96010550fa96a65a803644e3521" title="Check whether a screen point is on the series.">IsPointOnSerie</a>(<span class="keyword">const</span> CPoint&amp; screenPoint, <span class="keywordtype">unsigned</span>&amp; uIndex) <span class="keyword">const</span>;
<a name="l00078"></a>00078 
<a name="l00079"></a>00079 <span class="keyword">private</span>:
<a name="l00081"></a>00081 
<a name="l00088"></a>00088     <span class="keywordtype">void</span> DrawLegend(CDC* pDC, <span class="keyword">const</span> CRect&amp; rectBitmap) <span class="keyword">const</span>;
<a name="l00089"></a>00089 
<a name="l00091"></a>00091 
<a name="l00098"></a>00098         <span class="keywordtype">void</span> Draw(CDC* pDC);
<a name="l00100"></a>00100 
<a name="l00105"></a>00105         <span class="keywordtype">void</span> DrawAll(CDC *pDC);
<a name="l00106"></a>00106 
<a name="l00108"></a>00108         <span class="keywordtype">int</span> m_iXPointSize;              
<a name="l00110"></a>00110         <span class="keywordtype">int</span> m_iYPointSize;      
<a name="l00112"></a>00112         <a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8" title="The different point shapes.">PointType</a> m_iPointType;
<a name="l00114"></a>00114         COLORREF m_colBorder;
<a name="l00115"></a>00115 };
<a name="l00116"></a>00116 
<a name="l00117"></a>00117 <span class="preprocessor">#endif // !defined(AFX_CHARTPOINTSSERIE_H__F66C180F_F04C_4E2D_878C_08BDBCE91863__INCLUDED_)</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:10 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