[vtkusers] vtkChartXY picking

Eric E. Monson emonson at cs.duke.edu
Wed Dec 8 09:51:18 EST 2010


Hey Nicolas,

I'm not quite sure how to solve your problem, but I wanted to let you know that the 2D API classes (which includes the Charts like vtkChartXY) do not use the standard VTK interactors for their event handling, so that's why your tests with changing interactor style didn't work. The 2D API is based on items placed in a scene, and each of those items handles its own drawing and mouse events. The lines and marks on the plots, though, are just drawn with OpenGL, and are not items themselves that handle events. 

I'm not an expert in this, but to do what you want with the way the Charts and 2D API are implemented right now you might need to go into the classes themselves and add in custom events that fire when things like axes are hit. I'm not sure about things like line colors. There is already code in the charts that is used for tooltips that finds the closest points to the mouse, so that may be useful.

Sorry I couldn't be more direct help,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Dec 8, 2010, at 7:38 AM, nclemeur wrote:

> 
> Hello,
> 
> I am quite novice with vtk and I would like some advice on how to implement
> picking in a vtkChartXY.
> 
> For example I would like to select a plot when clicking on it and then
> hightlight it in a similar way as it is done when selecting a rectangular
> window. This would provides me with a way to popup a menu  (I am using
> wxWidgets) when the user then right click on the curve to customise the
> curve color,...
> 
> Ideally I would like to do something similar with the axes so that I can
> popup  a menu to change the ranges, and so on...
> 
> For the time being I am looking at the vtk side of it. I'll investigate the
> integration with wxWidgets later on.
> 
> I have already tried a few things like implementing my own InteractorStyle
> (based on vtkInteractorStyleRubberBand2D), attached SelectionChanged
> observers on the plots... Without a lot of success.
> 
> Any hints on that would be great.
> 
> Cheers
> 
> Nicolas
> -- 
> View this message in context: http://vtk.1045678.n5.nabble.com/vtkChartXY-picking-tp3297279p3297279.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list