필터 지우기
필터 지우기

UIAxes Data Tip interaction

조회 수: 18 (최근 30일)
Daniele Crimella
Daniele Crimella 2022년 10월 31일
댓글: Kevin Holly 2022년 10월 31일
Hello, I recently updated from 2019b (2021b now) and I wanted to use the new support for datacursormode in UIAxes.
With a standard figure I can move the data tip label around the point snapped (NE, NW, SW, SE) and I can also drag the data tip along the plotted curve to adjust its position.
Is it possible to replicate this behavior for UIAxes plots?
I can only enable datacursormode in UIAxes but then I can produce data tips that can only be deleted and repositioned and not interactively dragged along the curve.
Also:
I would like to change the pointer from standard "arrow" to "circle" when inside the uiAxes, I did it with enter/exit function, but the datacursor mode overwrites the bavior and displays the standard "cross"
The code looks like this
function startupFcn(app)
datacursormode(app.MyApp, 'on');
pm.enterFcn = @(~,~) set(app.MyApp, 'Pointer', 'circle');
pm.exitFcn = @(~,~) set(app.MyApp, 'Pointer', 'arrow');
pm.traverseFcn = [];
iptSetPointerBehavior(app.UIAxes, pm)
iptPointerManager(app.MyApp,'enable');
end
with no datacursor mode it works, with datacursor 'on' it displays "cross"
Thanks

채택된 답변

Kevin Holly
Kevin Holly 2022년 10월 31일
편집: Kevin Holly 2022년 10월 31일
You could change line 450 in datacursormode
from
setptr(gcf,'datacursor')
to
setptr(gcf,'circle')
or just comment out the line.
Edit: As for moving/repositioning the datatips, it works for me in R2022b, but I have the same issue in R2021b.
  댓글 수: 2
Daniele Crimella
Daniele Crimella 2022년 10월 31일
Thanks for the answer. This does solve the problem on my machine, but how about sharing the app as standalone with other users, will they still see the "arrow" cursor?
I could insert a copy of datacursor function (datacursorMOD for example) inside my app and call that instead of the native one, but it seems a bit too extreme to do that only modify a cursor (if it is the only way, I will do that for sure).
Thanks for the investigation on R2021b so I won't loose time searching for a fix as it seems to be related to the release itself.
Kevin Holly
Kevin Holly 2022년 10월 31일
Creating a modified copy of the datacursor function was the route I would have recommended. Generally, the standalone executable should have the same functionality as before you compiled.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by