Path: news.mathworks.com!not-for-mail
From: "helper " <spamless@nospam.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Datatip (Datacursormode)
Date: Fri, 9 May 2008 09:50:21 +0000 (UTC)
Organization: Timothy S. Farajian, Inc.
Lines: 52
Message-ID: <g016ot$gva$1@fred.mathworks.com>
References: <g00qvj$4gu$1@fred.mathworks.com>
Reply-To: "helper " <spamless@nospam.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210326621 17386 172.30.248.35 (9 May 2008 09:50:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 9 May 2008 09:50:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1272923
Xref: news.mathworks.com comp.soft-sys.matlab:467565


"Daphne " <daphnew_too_nospam@yahoo.com> wrote in message 
<g00qvj$4gu$1@fred.mathworks.com>...

> I would like to mark the start and end of those lines 
> with data tips programmatically. 

Good question.  I don't think you can do this.  I will 
investigate more and get back to you if I find a way, 
though.

> Another related question, is there a way to move the data 
> tips' flag to the bottom right position programmatically? 

You can do this by setting the "DisplayStyle" property of 
the datacursor mode to "window".

dcm_obj = datacursormode;
set(dcm_obj,'DisplayStyle','window')


Note, however, that you can only display one data point at 
a time using "window".  This conflicts with your desire to 
have 2 data points (start and end).


> Last question, can I limit the datacursormode to the 
> specific axes, so that the user doesn't, by mistake, 
click 
> on something in one of the other axes? 


You cannot eliminate use of the datacursor from a specific 
axes directly.  You can, however, eliminate use of the 
datacursor on specific plots by setting the "HitTest" 
property of the line object to "off".

For example:

hPlot = plot(1:10);
set(hPlot,'HitTest','off')

I suppose you can FINDALL objects on a specific axes 
of "Type" "line" and set their properties using:

hPlots = findall(h,'type','line');
set(hPlots,'hittest','off')

where "h" is the handle to the axes.  However, you will 
need to reissue this command whenever a new plot is placed 
on that axes.

Good luck