<div dir="ltr">Works with this<br><br><span style=" color:#808000;">this</span><span style=" color:#000000;">-&gt;</span>view<span style=" color:#000000;">-&gt;</span>SetInteractor<span style=" color:#000000;">(</span><span style=" color:#808000;">this</span><span style=" color:#000000;">-&gt;</span>ui<span style=" color:#000000;">-&gt;</span>chartWidget<span style=" color:#000000;">-&gt;</span>GetInteractor<span style=" color:#000000;">());</span>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">           </span><span style=" color:#808000;">this</span><span style=" color:#000000;">-&gt;</span>ui<span style=" color:#000000;">-&gt;</span>chartWidget<span style=" color:#000000;">-&gt;</span>SetRenderWindow<span style=" color:#000000;">(</span><span style=" color:#808000;">this</span><span style=" color:#000000;">-&gt;</span>view<span style=" color:#000000;">-&gt;</span>GetRenderWindow<span style=" color:#000000;">());</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">           </span><span style=" color:#808000;">this</span><span style=" color:#000000;">-&gt;</span>view<span style=" color:#000000;">-&gt;</span>GetInteractor<span style=" color:#000000;">()-&gt;</span>Initialize<span style=" color:#000000;">();</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">           </span><span style=" color:#808000;">this</span><span style=" color:#000000;">-&gt;</span>view<span style=" color:#000000;">-&gt;</span>GetInteractor<span style=" color:#000000;">()-&gt;</span>Start<span style=" color:#000000;">();<br>
<br>Jothy<br></span></pre><br><br><div class="gmail_quote">On Fri, Aug 12, 2011 at 11:39 AM, Jothy <span dir="ltr">&lt;<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div dir="ltr">Now, I have managed to get it rendered in QVTKWidget, but the interaction doesn&#39;t work.<br><br>How should I start the interactor? I tried the commented line in the below code<br><br><font size="4"><span style="color:rgb(0, 128, 0)">//</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 128, 0)">Add</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 128, 0)">multiple</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 128, 0)">line</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 128, 0)">plots,</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 128, 0)">setting</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 128, 0)">the</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 128, 0)">colors</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 128, 0)">etc</span>
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">           </span>vtkSmartPointer<span style="color:rgb(0, 0, 0)">&lt;</span>vtkChartXY<span style="color:rgb(0, 0, 0)">&gt;</span><span style="color:rgb(192, 192, 192)"> </span>chart<span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 0, 0)">=</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">             </span>vtkSmartPointer<span style="color:rgb(0, 0, 0)">&lt;</span>vtkChartXY<span style="color:rgb(0, 0, 0)">&gt;::</span>New<span style="color:rgb(0, 0, 0)">();</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">           </span>chart<span style="color:rgb(0, 0, 0)">-&gt;</span>GetAxis<span style="color:rgb(0, 0, 0)">(</span>vtkAxis<span style="color:rgb(0, 0, 0)">::</span>LEFT<span style="color:rgb(0, 0, 0)">)-&gt;</span>SetTitle<span style="color:rgb(0, 0, 0)">(</span><span style="color:rgb(0, 128, 0)">&quot;</span><span style="color:rgb(0, 128, 0)">yyy&quot;</span><span style="color:rgb(0, 0, 0)">);</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">           </span>chart<span style="color:rgb(0, 0, 0)">-&gt;</span>GetAxis<span style="color:rgb(0, 0, 0)">(</span>vtkAxis<span style="color:rgb(0, 0, 0)">::</span>BOTTOM<span style="color:rgb(0, 0, 0)">)-&gt;</span>SetTitle<span style="color:rgb(0, 0, 0)">(</span><span style="color:rgb(0, 128, 0)">&quot;xxx</span><span style="color:rgb(0, 128, 0)">&quot;</span><span style="color:rgb(0, 0, 0)">);</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">          </span><span style="color:rgb(128, 128, 0)">this</span><span style="color:rgb(0, 0, 0)">-&gt;</span>view<span style="color:rgb(0, 0, 0)">-&gt;</span>GetScene<span style="color:rgb(0, 0, 0)">()-&gt;</span>AddItem<span style="color:rgb(0, 0, 0)">(</span>chart<span style="color:rgb(0, 0, 0)">);</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">           </span>vtkPlot<span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 0, 0)">*</span>line<span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 0, 0)">=</span><span style="color:rgb(192, 192, 192)"> </span>chart<span style="color:rgb(0, 0, 0)">-&gt;</span>AddPlot<span style="color:rgb(0, 0, 0)">(</span>vtkChart<span style="color:rgb(0, 0, 0)">::</span>LINE<span style="color:rgb(0, 0, 0)">);</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">           </span>line<span style="color:rgb(0, 0, 0)">-&gt;</span>SetInput<span style="color:rgb(0, 0, 0)">(</span>table<span style="color:rgb(0, 0, 0)">,</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 0, 128)">0</span><span style="color:rgb(0, 0, 0)">,</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 0, 128)">1</span><span style="color:rgb(0, 0, 0)">);</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">           </span>line<span style="color:rgb(0, 0, 0)">-&gt;</span>SetColor<span style="color:rgb(0, 0, 0)">(</span><span style="color:rgb(0, 0, 128)">0</span><span style="color:rgb(0, 0, 0)">,</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 0, 128)">255</span><span style="color:rgb(0, 0, 0)">,</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 0, 128)">0</span><span style="color:rgb(0, 0, 0)">,</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 0, 128)">255</span><span style="color:rgb(0, 0, 0)">);</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">           </span>line<span style="color:rgb(0, 0, 0)">-&gt;</span>SetWidth<span style="color:rgb(0, 0, 0)">(</span><span style="color:rgb(0, 0, 128)">1.0</span><span style="color:rgb(0, 0, 0)">);</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(0, 128, 0)">//</span><span style="color:rgb(192, 192, 192)">           </span><span style="color:rgb(0, 128, 0)">this-&gt;view-&gt;GetRenderWindow()-&gt;SetMultiSamples(0);</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">           </span><span style="color:rgb(128, 128, 0)">this</span><span style="color:rgb(0, 0, 0)">-&gt;</span>ui<span style="color:rgb(0, 0, 0)">-&gt;</span>chartWidget<span style="color:rgb(0, 0, 0)">-&gt;</span>GetRenderWindow<span style="color:rgb(0, 0, 0)">()-&gt;</span>AddRenderer<span style="color:rgb(0, 0, 0)">(</span><span style="color:rgb(128, 128, 0)">this</span><span style="color:rgb(0, 0, 0)">-&gt;</span>view<span style="color:rgb(0, 0, 0)">-&gt;</span>GetRenderer<span style="color:rgb(0, 0, 0)">());</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(0, 128, 0)">//</span><span style="color:rgb(192, 192, 192)">           </span><span style="color:rgb(0, 128, 0)">vtkRenderWindowInteractor</span><span style="color:rgb(192, 192, 192)"> </span><span style="color:rgb(0, 128, 0)">*chartItr=vtkRenderWindowInteractor::New();</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(0, 128, 0)">//</span><span style="color:rgb(192, 192, 192)">           </span><span style="color:rgb(0, 128, 0)">this-&gt;ui-&gt;chartWidget-&gt;GetRenderWindow()-&gt;SetInteractor(chartItr);</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(0, 128, 0)">//</span><span style="color:rgb(192, 192, 192)">           </span><span style="color:rgb(0, 128, 0)">this-&gt;ui-&gt;chartWidget-&gt;GetInteractor()-&gt;Initialize();</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(0, 128, 0)">//</span><span style="color:rgb(192, 192, 192)">           </span><span style="color:rgb(0, 128, 0)">this-&gt;ui-&gt;chartWidget-&gt;GetInteractor()-&gt;Start();</span></font></pre>

<font size="4">
</font>
<pre style="margin:0px;text-indent:0px"><font size="4"><span style="color:rgb(192, 192, 192)">            </span><span style="color:rgb(128, 128, 0)">this</span><span style="color:rgb(0, 0, 0)">-&gt;</span>ui<span style="color:rgb(0, 0, 0)">-&gt;</span>chartWidget<span style="color:rgb(0, 0, 0)">-&gt;</span>show<span style="color:rgb(0, 0, 0)">();</span></font></pre>

<font size="4">
</font><pre style="margin:0px;text-indent:0px"><font size="4"><br></font></pre>Thanks<br><font color="#888888"><br>Jothy</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Fri, Aug 12, 2011 at 11:05 AM, Jothy <span dir="ltr">&lt;<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<br><br>I am trying to plot a 2D XY line plot using vtkChartXY by following this example <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Plotting/LinePlot" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Plotting/LinePlot</a>.<br>


<br>I can render using vtkRenderer and vtkRenderWindow, but I can&#39;t get it rendered in a QVTKWidget. How to link these two?<br><br>I tried using QVTkWidget-&gt;GetRenderWindow()-&gt;AddRenderer(vtkContextView-&gt;GetRenderer()).<br>


<br>Any suggestions?<br><br>Thanks<br><font color="#888888"><br>Jothy<br></font></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>