DataTip functionality in MATLAB when using multiple tabs with separate plots

34 ビュー (過去 30 日間)
Abhinand
Abhinand 2025 年 10 月 14 日
コメント済み: Abhinand 2025 年 10 月 16 日
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 件のコメント
Christopher Stapels
Christopher Stapels 2025 年 10 月 15 日
maybe share some of the code for your implementations?
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 Center および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by