Path: news.mathworks.com!not-for-mail
From: "helper " <spamless@nospam.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Datatip (Datacursormode)
Date: Sun, 11 May 2008 02:58:03 +0000 (UTC)
Organization: Timothy S. Farajian, Inc.
Lines: 29
Message-ID: <g05nbr$kdi$1@fred.mathworks.com>
References: <g00qvj$4gu$1@fred.mathworks.com> <g016ot$gva$1@fred.mathworks.com> <g02208$r3i$1@fred.mathworks.com> <g02in1$mhk$1@fred.mathworks.com> <g03lef$c19$1@fred.mathworks.com>
Reply-To: "helper " <spamless@nospam.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210474683 20914 172.30.248.38 (11 May 2008 02:58:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 11 May 2008 02:58:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1272923
Xref: news.mathworks.com comp.soft-sys.matlab:467765


"Daphne " <daphnew_too_nospam@yahoo.com> wrote in message 
<g03lef$c19$1@fred.mathworks.com>...
> 
> This works great. Thanks!
> 
> Another small question. What I want to do, now the the 
> datatips are plotted, is let the user change their 
> locations manually, if needed. However, when I set the 
> datacursormode to on, and try to move one of the 
datatips, 
> it doesn't move to the next point on the plot, but falls 
> to the first one. Any ideas? 
> 

OK, I've added one more line to the 2nd FOR-loop.  I'll dig 
more and try to find the ideal way to actually do all of 
this rather than this hack.

I = [3 8];
for n = 1:length(I)
  h(n) = createDatatip(hDC, hPlot);
end
drawnow
for n = 1:length(I)
  set(h(n),'Position',[X(I(n)) Y(I(n))],...
    'String',sprintf('X: %s\nY: %s',...
    num2str(X(I(n))),num2str(Y(I(n)))));
   set(get(h(n),'DataCursor'),'DataIndex',I(n))
end