<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><br>Jothy<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">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>