[vtkusers] How to select a VtkPlot object in a vtkChart?

Marcus D. Hanwell marcus.hanwell at kitware.com
Mon Dec 22 13:05:22 EST 2014

Hi Maarten,

On Mon, Dec 22, 2014 at 12:49 PM, Maarten Beek via vtkusers
<vtkusers at vtk.org> wrote:
> Hi all,
> I would like to know how I would select a vtkPlot (better: vtkPlotLine)
> object in a vtkChart (better: vtkChartXY)?
> I get the impression that only points can be selected in a vtkContextScene.
> However, I have two vertical lines each with two (bottom and top) points, to
> indicate a (threshold) range, and that I would like to move left and right
> with my mouse.
> Would this be possible (or should I go back to something like QCustomPlot)?
I worked on a somewhat similar type of chart in the tomviz project,
see vtkChartHistogram in the CentralWidget.cxx file (that needs to be
split out/refactored, but should illustrate). It has a vertical line
marking the selected isosurface value the user clicked on

I think we should make this simpler, when you add a plot you get its
index, you can create a vtkPlotLine, add it to the chart, maintain a
pointer to it, and update that object in your own code too.


More information about the vtkusers mailing list