1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt examples: TimeSeriesExample Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main 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 class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>TimeSeriesExample Class Reference<br>
<small>
[<a class="el" href="group__chartsexample.html">Charts example</a>]</small>
</h1><!-- doxytag: class="TimeSeriesExample" --><!-- doxytag: inherits="Wt::WContainerWidget" -->A widget that demonstrates a times series chart.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="ChartsExample_8h-source.html">ChartsExample.h</a>></code>
<p>
<div class="dynheader">
Inheritance diagram for TimeSeriesExample:</div>
<div class="dynsection">
<p><center><img src="classTimeSeriesExample__inherit__graph.png" border="0" usemap="#TimeSeriesExample__inherit__map" alt="Inheritance graph"></center>
<map name="TimeSeriesExample__inherit__map">
<area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html" title="Wt::WContainerWidget" alt="" coords="5,304,157,331"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html" title="Wt::WInteractWidget" alt="" coords="11,229,152,256"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html" title="Wt::WWebWidget" alt="" coords="20,155,143,181"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html" title="Wt::WWidget" alt="" coords="33,80,129,107"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WObject.html" title="Wt::WObject" alt="" coords="33,5,129,32"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
<p>
<a href="classTimeSeriesExample-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"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeSeriesExample.html#696c3e952d1f9b4ed3bdbf415f1634a5">TimeSeriesExample</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#3461e31818c4d2f516641bdaf508312a">parent</a>)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates the time series scatter plot example. <a href="#696c3e952d1f9b4ed3bdbf415f1634a5"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A widget that demonstrates a times series chart.
<p>Definition at line <a class="el" href="ChartsExample_8h-source.html#l00029">29</a> of file <a class="el" href="ChartsExample_8h-source.html">ChartsExample.h</a>.</p>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="696c3e952d1f9b4ed3bdbf415f1634a5"></a><!-- doxytag: member="TimeSeriesExample::TimeSeriesExample" ref="696c3e952d1f9b4ed3bdbf415f1634a5" args="(Wt::WContainerWidget *parent)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">TimeSeriesExample::TimeSeriesExample </td>
<td>(</td>
<td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">Wt::WContainerWidget</a> * </td>
<td class="paramname"> <em>parent</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates the time series scatter plot example.
<p>
<p>Definition at line <a class="el" href="ChartsExample_8C-source.html#l00128">128</a> of file <a class="el" href="ChartsExample_8C-source.html">ChartsExample.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00128"></a>00128 :
<a name="l00129"></a>00129 <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#520ba6e52a36a7f2efbef1a31a69e898">WContainerWidget</a>(parent)
<a name="l00130"></a>00130 {
<a name="l00131"></a>00131 <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">"scatter plot"</span>), <span class="keyword">this</span>);
<a name="l00132"></a>00132
<a name="l00133"></a>00133 <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WAbstractItemModel.html">WAbstractItemModel</a> *model = <a class="code" href="ChartsExample_8C.html#ffec5e7d98eb601a40bf039d67cd7982">readCsvFile</a>(<span class="stringliteral">"timeseries.csv"</span>, <span class="keyword">this</span>);
<a name="l00134"></a>00134
<a name="l00135"></a>00135 <span class="keywordflow">if</span> (!model)
<a name="l00136"></a>00136 <span class="keywordflow">return</span>;
<a name="l00137"></a>00137
<a name="l00138"></a>00138 <span class="comment">/*</span>
<a name="l00139"></a>00139 <span class="comment"> * Parse the first column as dates</span>
<a name="l00140"></a>00140 <span class="comment"> */</span>
<a name="l00141"></a>00141 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < model-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WAbstractItemModel.html#b0709a8f71fd5df882f29bb29fd055f0">rowCount</a>(); ++i) {
<a name="l00142"></a>00142 <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WString.html">WString</a> s = asString(model-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WAbstractItemModel.html#9112b74d160f916ef75fb6c1c09dd8fe">data</a>(i, 0));
<a name="l00143"></a>00143 <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WDate.html">WDate</a> d = WDate::fromString(s, <span class="stringliteral">"dd/MM/yy"</span>);
<a name="l00144"></a>00144 model-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WAbstractItemModel.html#70856db8c322be8c7f397a932165a943">setData</a>(i, 0, boost::any(d));
<a name="l00145"></a>00145 }
<a name="l00146"></a>00146
<a name="l00147"></a>00147 <span class="comment">/*</span>
<a name="l00148"></a>00148 <span class="comment"> * Create the scatter plot.</span>
<a name="l00149"></a>00149 <span class="comment"> */</span>
<a name="l00150"></a>00150 <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>);
<a name="l00151"></a>00151 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WAbstractChart.html#a23d116689e939301470398df8ad5c8b">setModel</a>(model); <span class="comment">// set the model</span>
<a name="l00152"></a>00152 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#6c954fa4ed6d73f00ee973bfe3af5ed0">setXSeriesColumn</a>(0); <span class="comment">// set the column that holds the X data</span>
<a name="l00153"></a>00153 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#26c3d97f4884da079e01e7b50447a915">setLegendEnabled</a>(<span class="keyword">true</span>); <span class="comment">// enable the legend</span>
<a name="l00154"></a>00154
<a name="l00155"></a>00155 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#02775290965d59ffba03da574925e387">setType</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/group__charts.html#gg8d63464f873580c77508e1c0c26cbfea6ddab43d32242eb28831938a1e469a1f">ScatterPlot</a>); <span class="comment">// set type to ScatterPlot</span>
<a name="l00156"></a>00156 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#f966d6ee6b2e43e6b26e794459005375">axis</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/group__charts.html#ggddb678f67fbd9f374fcee0922f158c9f2a592919e6cbd94bf09e1259559499b5">XAxis</a>).<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WAxis.html#b067037b83d1d663535250968a1776d8">setScale</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/group__charts.html#ggdfcaed8cd6ff52f5747f7df48f2eeab6aa627030efa552170a889d7a80a65a12">DateScale</a>); <span class="comment">// set scale of X axis to DateScale</span>
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <span class="comment">// Provide space for the X and Y axis and title. </span>
<a name="l00159"></a>00159 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WAbstractChart.html#ce6ea85014f731c7034e4215710a8a48">setPlotAreaPadding</a>(100, Left);
<a name="l00160"></a>00160 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WAbstractChart.html#ce6ea85014f731c7034e4215710a8a48">setPlotAreaPadding</a>(50, Top | Bottom);
<a name="l00161"></a>00161
<a name="l00162"></a>00162 <span class="comment">/*</span>
<a name="l00163"></a>00163 <span class="comment"> * Add first two columns as line series</span>
<a name="l00164"></a>00164 <span class="comment"> */</span>
<a name="l00165"></a>00165 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i < 3; ++i) {
<a name="l00166"></a>00166 <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WDataSeries.html">WDataSeries</a> s(i, <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/group__charts.html#gg44d64e4a9d08c7ef69648f4a9c3e40532582c20d00d806d8a175e2f5c0207591">LineSeries</a>);
<a name="l00167"></a>00167 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));
<a name="l00168"></a>00168 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1Chart_1_1WCartesianChart.html#fa4ac6588e6e2e0dd93320c3a0541d46">addSeries</a>(s);
<a name="l00169"></a>00169 }
<a name="l00170"></a>00170
<a name="l00171"></a>00171 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WPaintedWidget.html#a57b940110d240951d0e3a6d03390319">resize</a>(800, 400); <span class="comment">// WPaintedWidget must be given explicit size</span>
<a name="l00172"></a>00172
<a name="l00173"></a>00173 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#07719d06da0dd17af2381c663e8fb0b7">setMargin</a>(10, Top | Bottom); <span class="comment">// add margin vertically</span>
<a name="l00174"></a>00174 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#07719d06da0dd17af2381c663e8fb0b7">setMargin</a>(WLength::Auto, Left | Right); <span class="comment">// center horizontally</span>
<a name="l00175"></a>00175
<a name="l00176"></a>00176 <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>);
<a name="l00177"></a>00177 }
</pre></div>
<p>
</div>
</div><p>
<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>/home/koen/project/wt/public-git/wt/examples/charts/<a class="el" href="ChartsExample_8C-source.html">ChartsExample.C</a></ul>
</div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:12 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>
|