<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I just advanced from where I was and I know have:<br class=""><div class=""><br class=""></div><div class="">
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><!--StartFragment--><span style=" color:#808000;" class="">void </span>pointSelected(<span style=" color:#800080;" class="">vtkObject</span>*<span style=" color:#c0c0c0;" class=""> </span>obj,<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#808000;" class="">unsigned</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#808000;" class="">long</span>,<span style=" color:#808000;" class="">void</span>*,<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#808000;" class="">void</span>*)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class="">    </span><span style=" color:#800080;" class="">std</span>::cout<span style=" color:#c0c0c0;" class=""> </span><<<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#008000;" class="">"\nPoint</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#008000;" class="">selected.\n"</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class="">    </span><span style=" color:#008000;" class="">//</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#008000;" class="">Print</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#008000;" class="">info</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#008000;" class="">of</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#008000;" class="">selected</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#008000;" class="">point</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">}<!--EndFragment--></pre><div class=""><br class=""></div></div><div class="">
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><!--StartFragment--><span style=" color:#808000;" class="">int</span><span style=" color:#c0c0c0;" class=""> </span>main()</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">{</pre></div><div class="">
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#800000;" class="">    chart</span>-><span style="font-style: italic;" class="">SetActionToButton</span>(<span style=" color:#800080;" class="">vtkChartXY</span>::<span style=" color:#800080;" class="">SELECT</span>,<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkContextMouseEvent</span>::<span style=" color:#800080;" class="">LEFT_BUTTON</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#800080;" class="">    vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkCallbackCommand</span>><span style=" color:#c0c0c0;" class=""> </span>keypressCallback<span style=" color:#c0c0c0;" class=""> </span>=<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkCallbackCommand</span>>::New();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">    keypressCallback-><span style="font-style: italic;" class="">SetCallback</span><span style=" color:#c0c0c0;" class=""> </span>(<span style=" color:#c0c0c0;" class=""> </span>pointSelected<span style=" color:#c0c0c0;" class=""> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#800000;" class="">    chart</span>->AddObserver(<span style=" color:#800080;" class="">vtkContextMouseEvent</span>::<span style=" color:#800080;" class="">LEFT_BUTTON</span>,<span style=" color:#c0c0c0;" class=""> </span>keypressCallback);<!--EndFragment--></pre><pre style="margin-top: 0px; margin-bottom: 0px;" class=""><pre style="margin-top: 0px; margin-bottom: 0px;" class="">}</pre><div class=""><br class=""></div></pre></div><div class="">And this works as expected; every time I left-click on a point, I cout “Point selected”.</div><div class=""><br class=""></div><div class="">My initial question is still stands: how do I get information on the selected point?</div><div class=""><br class=""></div><div class="">When plotting my points, they were part of a table. Could I get the table in question (there are multiple plots, so multiple tables), and then the index of the data point within the table? </div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Richard</div><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On 22 Apr 2016, at 16:05, Richard Brown <<a href="mailto:richard.j.brown@live.co.uk" class="">richard.j.brown@live.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Jeff,<div class=""><br class=""></div><div class="">So if I want my left button to select the point underneath it (I think the right button by default creates a box and selects points within that box but then does nothing with them…) and then, for example, print the information pertaining to that point, how would I go about that?</div><div class=""><br class=""></div><div class="">SetButtonToAction(vtkChartXY::SELECT, vtkContextMouseEvent::LEFT_MOUSE);</div><div class=""><br class=""></div><div class="">Do I then set up an observer for vtkChartXY::SELECT?</div><div class=""><br class=""></div><div class="">And from there, when I’m in the callback function, how do I get the information of the selected point?</div><div class=""><br class=""></div><div class="">Thanks in advance,</div><div class="">Richard</div><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 18 Apr 2016, at 13:54, Jeff Baumes <<a href="mailto:jeff.baumes@kitware.com" class="">jeff.baumes@kitware.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I think you want SetActionToButton() on vtkChart to change mouse bindings. You should be able to listen for a selection event once that is set up.<div class=""><br class=""></div><div class=""><a href="http://www.vtk.org/doc/nightly/html/classvtkChart.html#ac4162187f5f3ad97f0163a079e06f13d" class="">http://www.vtk.org/doc/nightly/html/classvtkChart.html#ac4162187f5f3ad97f0163a079e06f13d</a></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Apr 15, 2016 at 9:13 AM mbcx9rb9 <<a href="mailto:richard.j.brown@live.co.uk" class="">richard.j.brown@live.co.uk</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br class="">
<br class="">
I'd like to create a custom interactor for vtkChartXY (inherited from<br class="">
vtkContextInteractorStyle), but I can't figure out how to select single<br class="">
points with the left click of the mouse. Once I manage to that, I would need<br class="">
to return the index of the selected point.<br class="">
<br class="">
This seems very straightforward to me, but I haven't seen any concrete<br class="">
examples.<br class="">
<br class="">
Any pointers would be greatly appreciated.<br class="">
<br class="">
Regards,<br class="">
Richard<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
--<br class="">
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/vtkChartXY-picking-tp5737711.html" rel="noreferrer" target="_blank" class="">http://vtk.1045678.n5.nabble.com/vtkChartXY-picking-tp5737711.html</a><br class="">
Sent from the VTK - Users mailing list archive at <a href="http://nabble.com/" class="">Nabble.com</a>.<br class="">
_______________________________________________<br class="">
Powered by <a href="http://www.kitware.com/" rel="noreferrer" target="_blank" class="">www.kitware.com</a><br class="">
<br class="">
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank" class="">http://www.kitware.com/opensource/opensource.html</a><br class="">
<br class="">
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank" class="">http://www.vtk.org/Wiki/VTK_FAQ</a><br class="">
<br class="">
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank" class="">http://markmail.org/search/?q=vtkusers</a><br class="">
<br class="">
Follow this link to subscribe/unsubscribe:<br class="">
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank" class="">http://public.kitware.com/mailman/listinfo/vtkusers</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">Powered by <a href="http://www.kitware.com" class="">www.kitware.com</a><br class=""><br class="">Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" class="">http://www.kitware.com/opensource/opensource.html</a><br class=""><br class="">Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" class="">http://www.vtk.org/Wiki/VTK_FAQ</a><br class=""><br class="">Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" class="">http://markmail.org/search/?q=vtkusers</a><br class=""><br class="">Follow this link to subscribe/unsubscribe:<br class=""><a href="http://public.kitware.com/mailman/listinfo/vtkusers" class="">http://public.kitware.com/mailman/listinfo/vtkusers</a><br class=""></div></blockquote></div><br class=""></div></div></body></html>