[vtkusers] Show vtkQtLineChartView in Qt

Martijn Steenwijk martijnsteenwijk at gmail.com
Mon Mar 15 09:17:44 EDT 2010


Hi Jeff,

Thanks for your reply. I just figured out the thing you mentioned, I missed
the call to GetWidget() somehow earlier. 
Now the second step comes however: suppose that I have two charts with the
same content, which I want to have coupled like done in the example
mentioned before. 
How could I do that? I've set up a function like done in the example, but
can't get it to work:

Void ClassName::SetupSelectionLink()
{
  vtkSelectionLink *selectionLink = vtkSelectionLink::New();
  this->ChartView1->GetRepresentation()->SetSelectionLink(selectionLink);
  this->ChartView2->GetRepresentation()->SetSelectionLink(selectionLink);

  vtkViewUpdater *updater = vtkViewUpdater::New();
  updater->AddView(this->ChartView1);
  updater->AddView(this->ChartView2);

}

Any help would be appreciated,

Thanks in advance,
Martijn

---
Martijn Steenwijk
T 06 20693913
E martijnsteenwijk at gmail.com

-----Oorspronkelijk bericht-----
Van: Jeff Baumes [mailto:jeff.baumes at kitware.com] 
Verzonden: maandag 15 maart 2010 13:51
Aan: Martijn Steenwijk
CC: vtkusers at vtk.org
Onderwerp: Re: [vtkusers] Show vtkQtLineChartView in Qt

The following is defined in the superclass, vtkQtChartView:

  // Description:
  // Get the main container of this view (a  QWidget).
  // The application typically places the view with a call
  // to GetWidget(): something like this
  // this->ui->box->layout()->addWidget(this->View->GetWidget());
  virtual QWidget* GetWidget();

You do not need a QVTKWidget because these chart classes are not
rendered with a VTK render window.

That said, there are newer chart classes coming that will scale better
and will use VTK's OpenGL rendering. They are being actively worked on
in CVS head, and there will be limited access to these in the next VTK
release.

Jeff

On Mon, Mar 15, 2010 at 7:52 AM, Martijn Steenwijk
<martijnsteenwijk at gmail.com> wrote:
> Dear all,
>
>
>
> Suppose I have a vtkTable ‘table’ filled with data, which i want to
> visualize in within a linechart in a qt application, then my code is:
>
>
>
> vtkQtLineChartView *ChartView = vtkQtLineChartView::New();
>
> ChartView->SetupDefaultInteractor();
>
> ChartView->SetTitle(“Test”);
>
> ChartView->AddRepresentationFromInput(table);
>
>
>
> If I now call ‘ChartView->Show()’, the data is nicely plotted in a
separate
> window. When I try to integrate the view in my Qt application,  like the
way
> it’s done with the vtkGraphLayoutView in
> \Examples\InfoVis\Cxx\EasyView\EasyView.cxx, I would expect that I would
> need something like a QVTKWidget or vtkQtchartWidget in order to integrate
> the renderer in my Qt application, but, I’m not getting both options to
> work. Could anyone give me a hint to solve this?
>
>
>
> Best,
>
> Martijn
>
>
>
>
>
> ---
>
> Martijn Steenwijk
>
> T 06 20693913
>
> E martijnsteenwijk at gmail.com




More information about the vtkusers mailing list