reset pareto chart on App Designer
Show older comments
I am developing a GUI with App Designer. One of its components is a pareto chart which is created with the function
pareto(app.MassParetoChart,masas,names_comps,1)
where the app.MassParetoChart is an App Designer UIAxes. Whenever the user inputs data is modified and the user produces a new pareto chart with the new input data, first the following commands are employed to reset and clean the UIAxes:
cla(app.MassParetoChart); clf(app.MassParetoChart); reset(app.MassParetoChart);
% Replot with the new data:
pareto(app.MassParetoChart,masas,names_comps,1)
However, after a few runs, the plot somehow is not entirely reseted and older axes apparently remain as can be seen in this figure

Trying the variant:
cla(app.MassParetoChart,"reset"); clf(app.MassParetoChart,"reset"); reset(app.MassParetoChart,"reset");
also presents the same issue appart from opening a new figure window outside of the App Designer app window:

What would be the right approach to correctly address this issue?
Accepted Answer
More Answers (1)
Voss
on 31 Jan 2023
pareto creates a new axes and returns the two axes as the second output. You can store that new axes and cla(_,'reset') it along with your original uiaxes.
To demonstrate, step through this code in your command line:
f = uifigure('AutoResizeChildren',false);
ax = uiaxes(f);
[p,new_ax] = pareto(ax,rand(10,1)); % new_ax contains the original uiaxes ax and the new axes
cla(ax,'reset')
cla(new_ax(2),'reset')
Then adapt for use in your app.
1 Comment
CAME18
on 31 Jan 2023
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
