DataTip functionality in MATLAB when using multiple tabs with separate plots

36 views (last 30 days)
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 Comments
Abhinand
Abhinand on 16 Oct 2025
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 .

Sign in to comment.

Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!