<div dir="ltr">Works with this<br><br><span style=" color:#808000;">this</span><span style=" color:#000000;">-></span>view<span style=" color:#000000;">-></span>SetInteractor<span style=" color:#000000;">(</span><span style=" color:#808000;">this</span><span style=" color:#000000;">-></span>ui<span style=" color:#000000;">-></span>chartWidget<span style=" color:#000000;">-></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;">-></span>ui<span style=" color:#000000;">-></span>chartWidget<span style=" color:#000000;">-></span>SetRenderWindow<span style=" color:#000000;">(</span><span style=" color:#808000;">this</span><span style=" color:#000000;">-></span>view<span style=" color:#000000;">-></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;">-></span>view<span style=" color:#000000;">-></span>GetInteractor<span style=" color:#000000;">()-></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;">-></span>view<span style=" color:#000000;">-></span>GetInteractor<span style=" color:#000000;">()-></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"><<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>></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'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)"><</span>vtkChartXY<span style="color:rgb(0, 0, 0)">></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)"><</span>vtkChartXY<span style="color:rgb(0, 0, 0)">>::</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)">-></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)">)-></span>SetTitle<span style="color:rgb(0, 0, 0)">(</span><span style="color:rgb(0, 128, 0)">"</span><span style="color:rgb(0, 128, 0)">yyy"</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)">-></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)">)-></span>SetTitle<span style="color:rgb(0, 0, 0)">(</span><span style="color:rgb(0, 128, 0)">"xxx</span><span style="color:rgb(0, 128, 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(192, 192, 192)"> </span><span style="color:rgb(128, 128, 0)">this</span><span style="color:rgb(0, 0, 0)">-></span>view<span style="color:rgb(0, 0, 0)">-></span>GetScene<span style="color:rgb(0, 0, 0)">()-></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)">-></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)">-></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)">-></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)">-></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->view->GetRenderWindow()->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)">-></span>ui<span style="color:rgb(0, 0, 0)">-></span>chartWidget<span style="color:rgb(0, 0, 0)">-></span>GetRenderWindow<span style="color:rgb(0, 0, 0)">()-></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)">-></span>view<span style="color:rgb(0, 0, 0)">-></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->ui->chartWidget->GetRenderWindow()->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->ui->chartWidget->GetInteractor()->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->ui->chartWidget->GetInteractor()->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)">-></span>ui<span style="color:rgb(0, 0, 0)">-></span>chartWidget<span style="color:rgb(0, 0, 0)">-></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"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>></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't get it rendered in a QVTKWidget. How to link these two?<br><br>I tried using QVTkWidget->GetRenderWindow()->AddRenderer(vtkContextView->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>