DataTip functionality in MATLAB when using multiple tabs with separate plots

34 次查看(过去 30 天)
I'm encountering a problem with the DataTip functionality in MATLAB when using multiple tabs with separate plots.
I have two tabs, each containing a single axis. I have separate functions for loading or creating plots on both tabs. Additionally, I've implemented two different DataCursor modes to customize the data tips for each axis.
The issue arises when:
  1. I load the first axis and the data tip works perfectly for the first plot.
  2. I then load the second axis on the second tab, and the data tip still functions correctly for the second plot.
  3. However, when I switch back to the first tab to view the first plot, the data tip fails to update. Instead, it displays the error message: "Cannot update the data tip using the custom data tip function."
I've checked my code thoroughly, but I can't seem to pinpoint the cause of this issue. Any help or guidance would be greatly appreciated.
  2 个评论
Abhinand
Abhinand 2025-10-16
1)if ~strcmpi(app.PlottingToolPlotTypeDropDown.Value, 'Line Plot')
% Use custom datacursormode for non-line plots
dcm_obj = datacursormodeCustom(app.ToolMainApp);
else
% Use default datacursormode for line plots
dcm_obj = datacursormode(app.ToolMainApp);
end
Here, datacursormodeCustom is a custom function that configures the data cursor mode for certain plot types, while the default datacursormode is used for line plots.
2)% Set up data cursor mode for the time series plot in the second tab
dcm = datacursormode(app.ToolMainApp);
dcm.UpdateFcn = @(src, event) app.customDataTipText(src, event);
In this snippet, the default data cursor mode is activated for the time series plot, and a custom update function customDataTipText is assigned to control the content of the data tip.
As per the Security Reasons I cannot fully share the code details but please raise questions on this if u have any doubt .

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by