Effacer les filtres
Effacer les filtres

App designer zoom problems: when i use the zoom the axis position/size change

13 vues (au cours des 30 derniers jours)
My problem occurs when I zoom using the toolbar on the graph. I want that when I zoom the graph stays fixed in its position. Instead it is not clear why it moves. I tried to change all possible settings but nothing. Please, help me. Thanks!

Réponse acceptée

Ayush
Ayush le 20 Juil 2023
Hi MEP
I understand that you don't want the graph to move when you zoom the graph.
In order to resolve the issue please try out the following -
In App Designer, you can use the `axis` function in MATLAB to control the behavior of the graph when zooming. By setting the `axis` limits and mode appropriately, you can ensure that the graph stays fixed in its position when zooming.
1. Open your App Designer project and locate the graph component in the UI.
2. In the "Code View" of App Designer, find the callback function associated with the toolbar zoom action. This function is typically named `zoomButtonValueChanged` or similar.
3. Inside the zoom callback function, add the following code to control the behavior of the graph:
function zoomButtonValueChanged(app, event)
% Get the current axis limits
xLimits = app.GraphName.XLim;
yLimits = app.GraphName.YLim;
% Apply the zoom action
zoom(app.GraphName, event.Value);
% Restore the original axis limits
app.GraphName.XLim = xLimits;
app.GraphName.YLim = yLimits;
% Disable zoom mode to prevent accidental zooming
zoom(app.GraphName, 'off');
end
Replace `GraphName` with the actual name of your graph component in App Designer.
4. Save the changes and run your App Designer application. When you zoom using the toolbar on the graph, the graph should stay fixed in its position.

Plus de réponses (0)

Catégories

En savoir plus sur Visual Exploration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by