The timer I'm using to update a plot slows down or stalls when I mouse over a plot (not necessarily one it's updating). Basically as long as I move my mouse I can stall the timer, so I get delays of 3s+ easily. The timer is supposed to run every 30ms (it isn't, but that's probably a different problem).
I've disabled Toolbars, HitTest, Pickable Parts. I'm using set to update the plot. Do I need to disable something else?
This is what the plot axes properties shows:
AlignVertexCenters: off
Annotation: [1×1 matlab.graphics.eventdata.Annotation]
BeingDeleted: off
BusyAction: 'cancel'
ButtonDownFcn: ''
Children: [0×0 GraphicsPlaceholder]
Clipping: on
Color: [0 0.4470 0.7410]
ColorMode: 'auto'
ContextMenu: [0×0 GraphicsPlaceholder]
CreateFcn: ''
DataTipTemplate: [1×1 matlab.graphics.datatip.DataTipTemplate]
DeleteFcn: ''
DisplayName: ''
HandleVisibility: 'on'
HitTest: off
Interruptible: on
LineJoin: 'round'
LineStyle: '-'
LineStyleMode: 'auto'
LineWidth: 0.5000
Marker: 'none'
MarkerEdgeColor: 'auto'
MarkerFaceColor: 'none'
MarkerIndices: [1 2]
MarkerMode: 'auto'
MarkerSize: 6
Parent: [1×1 UIAxes]
PickableParts: 'none'
Selected: off
SelectionHighlight: on
SeriesIndex: 1
SourceTable: [0×0 table]
Tag: ''
Type: 'line'
UserData: []
Visible: on
XData: [1 2]
XDataMode: 'auto'
XDataSource: ''
XVariable: ''
YData: [0 0]
YDataMode: 'manual'
YDataSource: ''
YVariable: ''
ZData: [1×0 double]
ZDataMode: 'auto'
ZDataSource: ''
ZVariable: ''
This is what InstantPeriod shows for the timer. Right side is me moving the mouse.

 채택된 답변

Eric Delgado
Eric Delgado 2022년 9월 30일
편집: Eric Delgado 2022년 9월 30일

1 개 추천

uifigure is not the best idea if you are looking for performance... see other posts about it and maybe you gonna use the old figure. :)
Anyway... you going to have a significant improvement in performance by turning off the "DefaultInteractivity" (it's all fault of DataTip Interaction!), "XLimMode" and "YLimMode" properties and update only "YData". See attached app made on R2021b.
And you still will have the axes toolbar for interaction, but if you disable it, it's gonna be even better!
disableDefaultInteractivity(app.UIAxes)

댓글 수: 5

Jane Sprigg
Jane Sprigg 2022년 9월 30일
I forgot to list it but that's actually with DisableDefaultInteractivity and Toolbars off.
I did try setting XLimMode (and y and z) to manual but that didn't appear to have an effect.
I guess I was hoping I was missing something else to disable because I don't know what else it could be checking for when I mouse over the plot.
Eric Delgado
Eric Delgado 2022년 9월 30일
편집: Eric Delgado 2022년 9월 30일
Mouse over the plot will not affect the performance of the plot if you disable interactions.
Can you share some code? What Matlab release are you using?
Did you try to run the app that I sent to you? How was the performance of the plot with the mouse above the plot?
I'm running 2022a.2021b kept crashing on me. I didn't notice any pauses in your app.
Mine is updating with a timer and I've noticed that a mouse existing on the app (not interacting, just being on top of the app) will sometimes pause the timer for apparently no reason. I think that's a different problem though because this pause is specifically happening when I mouse over the plot (I think the data line on the plot).
This is how I initialize the plot in startup function:
app.Receive1Plot.Toolbar.Visible='Off';
disableDefaultInteractivity(app.Receive1Plot)
app.ImHandles.R1=plot([0,0],'Parent',app.Receive1Plot);
app.ImHandles.R1.BusyAction='cancel';
app.ImHandles.R1.Interruptible='on';
app.ImHandles.R1.HitTest='off';
app.ImHandles.R1.PickableParts="none";
and then the plot is updated in a script called by a timer with:
set(app.ImHandles.R1,'XData',1:xSize,'YData',ydata)
I tried setting the limits to manual but it didn't stop the pause I'm seeing, and was running a tiny bit slower, I guess because I was setting the limits every time I updated the plot. I don't know what the limits are so I can't set them to constant values.
I also tried setting HitTest and PickableParts to off every time in the set command, but that didn't seem to have any effect either.
You should use "hold" to keep DefaultInteractivity disable. Try this:
disableDefaultInteractivity(app.Receive1Plot)
hold(app.Receive1Plot, 'on')
Jane Sprigg
Jane Sprigg 2022년 9월 30일
Oh that's ridiculous. That did work, thanks!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 9월 29일

댓글:

2022년 9월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by