How can I get the datatip to display its tag?
1 次查看(过去 30 天)
显示 更早的评论
I've tried
output_txt = {[event_obj.Target.Tag]};
but frustratingly, Target gets the whole image rather than the datatip.
0 个评论
采纳的回答
Shantanu Thatte
2021-6-25
Hi Andrew,
It seems like you are trying to show the Tag of the target object in the data tip. One possible solution is to customize DataTipTemplate property of the chart object. Here is an example:
l = plot(1:10,"Tag","I am tag");
% Customize the content of data tip
l.DataTipTemplate.DataTipRows = dataTipTextRow("Tag",repmat(string(l.Tag),numel(l.XData),1));
% Create data tip at index 2 or click to create data tip interactively
d = datatip(l,"DataIndex",2)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!