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