Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > b3a1f4d91c26f535919e39e25606614a > files > 461

wt-doc-3.2.3-1.fc18.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Wt examples: ScatterPlotExample Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Wt examples
   &#160;<span id="projectnumber">3.2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</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 id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">ScatterPlotExample Class Reference<div class="ingroups"><a class="el" href="group__chartsexample.html">Charts example</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="ScatterPlotExample" --><!-- doxytag: inherits="Wt::WContainerWidget" -->
<p>A Widget that demonstrates a scatter plot.  
 <a href="classScatterPlotExample.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="ChartsExample_8h_source.html">ChartsExample.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for ScatterPlotExample:</div>
<div class="dyncontent">
<div class="center"><img src="classScatterPlotExample__inherit__graph.png" border="0" usemap="#ScatterPlotExample_inherit__map" alt="Inheritance graph"/></div>
<map name="ScatterPlotExample_inherit__map" id="ScatterPlotExample_inherit__map">
<area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html" title="Wt::WContainerWidget" alt="" coords="5,304,160,331"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html" title="Wt::WInteractWidget" alt="" coords="11,229,155,256"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html" title="Wt::WWebWidget" alt="" coords="19,155,147,181"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html" title="Wt::WWidget" alt="" coords="33,80,132,107"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html" title="Wt::WObject" alt="" coords="35,5,131,32"/></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="classScatterPlotExample-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScatterPlotExample.html#a75f30afe584a342437d901217fd232db">ScatterPlotExample</a> (<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">Wt::WContainerWidget</a> *<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a3461e31818c4d2f516641bdaf508312a">parent</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates the scatter plot example.  <a href="#a75f30afe584a342437d901217fd232db"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A Widget that demonstrates a scatter plot. </p>

<p>Definition at line <a class="el" href="ChartsExample_8h_source.html#l00049">49</a> of file <a class="el" href="ChartsExample_8h_source.html">ChartsExample.h</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a75f30afe584a342437d901217fd232db"></a><!-- doxytag: member="ScatterPlotExample::ScatterPlotExample" ref="a75f30afe584a342437d901217fd232db" args="(Wt::WContainerWidget *parent)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ScatterPlotExample::ScatterPlotExample </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">Wt::WContainerWidget</a> *&#160;</td>
          <td class="paramname"><em>parent</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates the scatter plot example. </p>

<p>Definition at line <a class="el" href="ChartsExample_8C_source.html#l00252">252</a> of file <a class="el" href="ChartsExample_8C_source.html">ChartsExample.C</a>.</p>
<div class="fragment"><pre class="fragment">                                                              :
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a520ba6e52a36a7f2efbef1a31a69e898">WContainerWidget</a>(parent)
{
  <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(WString::tr(<span class="stringliteral">&quot;scatter plot 2&quot;</span>), <span class="keyword">this</span>);

  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">WStandardItemModel</a> *model = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">WStandardItemModel</a>(40, 2, <span class="keyword">this</span>);
  model-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a57f5d417f933440db0d38ece7dd370f4">setHeaderData</a>(0, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a>(<span class="stringliteral">&quot;X&quot;</span>));
  model-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a57f5d417f933440db0d38ece7dd370f4">setHeaderData</a>(1, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a>(<span class="stringliteral">&quot;Y = sin(X)&quot;</span>));

  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; 40; ++i) {
    <span class="keywordtype">double</span> x = (<span class="keyword">static_cast&lt;</span><span class="keywordtype">double</span><span class="keyword">&gt;</span>(i) - 20) / 4;

    model-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a70856db8c322be8c7f397a932165a943">setData</a>(i, 0, x);
    model-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a70856db8c322be8c7f397a932165a943">setData</a>(i, 1, sin(x));
  }
 
  <span class="comment">/*</span>
<span class="comment">   * Create the scatter plot.</span>
<span class="comment">   */</span>
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html">WCartesianChart</a> *chart = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html">WCartesianChart</a>(<span class="keyword">this</span>);
  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WAbstractChart.html#aa23d116689e939301470398df8ad5c8b">setModel</a>(model);        <span class="comment">// set the model</span>
  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#a6c954fa4ed6d73f00ee973bfe3af5ed0">setXSeriesColumn</a>(0);    <span class="comment">// set the column that holds the X data</span>
  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#a26c3d97f4884da079e01e7b50447a915">setLegendEnabled</a>(<span class="keyword">true</span>); <span class="comment">// enable the legend</span>

  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#a02775290965d59ffba03da574925e387">setType</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__charts.html#gga8d63464f873580c77508e1c0c26cbfeaa6ddab43d32242eb28831938a1e469a1f">ScatterPlot</a>);   <span class="comment">// set type to ScatterPlot</span>

  <span class="comment">// Typically, for mathematical functions, you want the axes to cross</span>
  <span class="comment">// at the 0 mark:</span>
  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#af966d6ee6b2e43e6b26e794459005375">axis</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__charts.html#ggaddb678f67fbd9f374fcee0922f158c9fa2a592919e6cbd94bf09e1259559499b5">XAxis</a>).<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WAxis.html#a6dab2f46117b85a4a6f439e4f194ee82">setLocation</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__charts.html#gga77eb6d0cefa4a012950ea972b471b849af2e58ce3483a5ec496f65fb808ce72b9">ZeroValue</a>);
  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#af966d6ee6b2e43e6b26e794459005375">axis</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__charts.html#ggaddb678f67fbd9f374fcee0922f158c9fa2e1017fdef77b4663715c3d7663a4db4">YAxis</a>).<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WAxis.html#a6dab2f46117b85a4a6f439e4f194ee82">setLocation</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__charts.html#gga77eb6d0cefa4a012950ea972b471b849af2e58ce3483a5ec496f65fb808ce72b9">ZeroValue</a>);

  <span class="comment">// Provide space for the X and Y axis and title. </span>
  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WAbstractChart.html#ace6ea85014f731c7034e4215710a8a48">setPlotAreaPadding</a>(80, Left);
  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WAbstractChart.html#ace6ea85014f731c7034e4215710a8a48">setPlotAreaPadding</a>(40, Top | Bottom);

  <span class="comment">// Add the curves</span>
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WDataSeries.html">WDataSeries</a> s(1, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__charts.html#gga44d64e4a9d08c7ef69648f4a9c3e4053a805880e23c0292fb7a66b2cda2a2f5bf">CurveSeries</a>);
  s.setShadow(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WShadow.html">WShadow</a>(3, 3, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WColor.html">WColor</a>(0, 0, 0, 127), 3));
  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#afa4ac6588e6e2e0dd93320c3a0541d46">addSeries</a>(s);

  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPaintedWidget.html#aa57b940110d240951d0e3a6d03390319">resize</a>(800, 300); <span class="comment">// WPaintedWidget must be given explicit size</span>

  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a9795c18e926b26b97fcbabc62a1dd4e3">setMargin</a>(10, Top | Bottom);            <span class="comment">// add margin vertically</span>
  chart-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a9795c18e926b26b97fcbabc62a1dd4e3">setMargin</a>(WLength::Auto, Left | Right); <span class="comment">// center horizontally</span>

  <a class="code" href="classChartConfig.html" title="A class that allows configuration of a cartesian chart.">ChartConfig</a> *config = <span class="keyword">new</span> <a class="code" href="classChartConfig.html" title="A class that allows configuration of a cartesian chart.">ChartConfig</a>(chart, <span class="keyword">this</span>);
  config-&gt;<a class="code" href="classChartConfig.html#a5f4ddb33c53dc6907dcf73c2598ad0fa">setValueFill</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__charts.html#gga7236e5b04bdb6f393162842982b4d1a0a50b16db97a187f9acccdbeecf8732ff0">ZeroValueFill</a>);
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/home/koen/project/wt/public-git/wt/examples/charts/<a class="el" href="ChartsExample_8h_source.html">ChartsExample.h</a></li>
<li>/home/koen/project/wt/public-git/wt/examples/charts/<a class="el" href="ChartsExample_8C_source.html">ChartsExample.C</a></li>
</ul>
</div>
<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Thu Nov 1 2012 for <a href="http://www.webtoolkit.eu/wt">the
C++ Web Toolkit (Wt)</a> by&nbsp;<a
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
alt="doxygen" border="0" style="vertical-align: middle; display:
inline-block; height: 2em"></a> 1.7.5.1</small></address>
</body>
</html>