I am unable to see datatips on my UIaxes in matlab app and the app is blurry, how do i fix this?

2 次查看(过去 30 天)
app.station_times=cell2mat(app.station(app.index,:))/60;
disp(app.station_times)
disp(app.station)
plot(app.UIAxes,app.xaxis,app.station_times)
hold(app.UIAxes,'on');
plot(app.UIAxes,app.xaxis,repelem(mean(app.station_times),length(app.xaxis)),'--','LineWidth',1.5,'Color', [0.8500, 0.3250, 0.0980] )
hold(app.UIAxes,'on');
s=plot(app.UIAxes,app.xaxis,app.station_times,'o','MarkerFaceColor',[0 0 0],'MarkerSize',4.7,...
'Marker','o',...
'LineStyle','none');
hold(app.UIAxes);
fitResults1 = spline(app.xaxis,app.station_times);
% Evaluate piecewise polynomial
yplot1 = ppval(fitResults1,app.xaxis);
hold(app.UIAxes,'on');
% Plot the fit
fitLine1 = plot(app.UIAxes,app.xaxis,yplot1,'DisplayName',' spline','Tag','spline',...
'MarkerFaceColor',[1 1 1],...
'MarkerEdgeColor',[0.149019607843137 0.149019607843137 0.149019607843137],...
'LineWidth',2,...
'Color',[0.074509803921569 0.623529411764706 1]);
%axis( app.UIAxes,'tight')
yyaxis(app.UIAxes,'left')
ylim(app.UIAxes,[ min(min(app.station_times))-1 max(max(app.station_times))+1])
set(app.UIAxes,'Ytick',(min(min(app.station_times))-1:0.5:max(app.station_times))+1)
% hold on
s.DataTipTemplate.DataTipRows(1).Label = 'Time (HR)';
s.DataTipTemplate.DataTipRows(2).Label = 'Cycle Time';
%Add a new row to the data tip. For the label, use State. For the value, use the state names contained in the statelabel variable in your workspace.
xlabel(app.UIAxes,' TIME (HR) ','FontSize',15,'FontWeight','bold');
ylabel(app.UIAxes,'CYCLETIME(MINUTES)','FontSize',11,'FontWeight','bold','Color',[0 0.447058823529412 0.741176470588235])
h=get(app.UIAxes,'YLabel');
set(h,'rotation',0,'HorizontalAlignment','left','position', get(h,'position')-[5.9,-0.8,0])
% hold on
hold(app.UIAxes,'on');
% % hold on
% ax=gca;
% Set the remaining axes properties
set(app.UIAxes,'AmbientLightColor',[0.8 0.8 0.8],'GridAlpha',0.7,'GridColor',...
[0.501960784313725 0.501960784313725 0.501960784313725],'GridLineStyle',...
'--','MinorGridColor',...
[0.501960784313725 0.501960784313725 0.501960784313725],...
'MinorGridLineStyle','-','XColor',...
[0.33,0.52,0.07],'XTickLabelRotation',25,'YColor',[0.07,0.62,1.00],...
'YGrid','on');
yyaxis(app.UIAxes,'right')
disp( repelem(app.result{2,app.index}(2,1),length(app.xaxis)))
plot(app.UIAxes,app.xaxis,repelem(cell2mat(app.result{2,app.index}(2,1)),length(app.xaxis)),'-..','Color',[0.4660 0.6740 0.1880],'LineWidth',2)
ylim(app.UIAxes,[ min(min(app.station_times))-1 max(max(app.station_times))+1])
set(app.UIAxes,'Ytick',(min(min(app.station_times))-1:0.5:max(max(app.station_times))+1))
yticklabels(app.UIAxes,{'0.6','0.8','1','1.2','1.4'})
hold(app.UIAxes,'on')
ylabel(app.UIAxes,'MANPOWER','FontSize',15,'FontWeight','bold','Color', [0.4940, 0.1840, 0.5560])
plot(app.UIAxes,app.xaxis,repelem(1,length(app.xaxis)))
% % %ylim([
legend(app.UIAxes,'AVG Manpower','Truck data','Cycletime','Takt Time','FontSize',12,'FontWeight','bold')
legend(app.UIAxes,'boxoff')
loyolagreen = 1/255*[0,104,87];
row = dataTipTextRow('Truck No',app.trucklist);
s.DataTipTemplate.DataTipRows(end+1) = row;
% %
%
timevec=datetime('6:30','format','HH:mm'):minutes(cell2mat(app.result{3,app.index}(2,1))):datetime('15:00','format','HH:mm')
timevec=string(timevec);
timevec(30:34)=[];
timevec(42:49)=[];
timevec(62:63)=[];
t2=timevec;
timevec(2:9)=" ";
timevec(11:18)=" ";
timevec(20:27)=" ";
timevec(29:36)=" ";
timevec(38:45)=" ";
timevec(47:54)=" ";
timevec(56:61)=" ";
set(app.UIAxes,'xtick',[1:61],'xticklabel',string(timevec),'FontSize',10,'FontWeight','bold');
set(app.UIAxes,'XtickLabelRotation',25,'FontSize',11,'FontWeight','bold');
h=get(app.UIAxes,'YLabel');
set(h,'rotation',0,'HorizontalAlignment','right','position', get(h,'position')+[1.8,1,0])
% set(app.UIAxes,y, 'position', get(y,'position')-[0.1,0,0]);
s.DataTipTemplate.DataTipRows(1).Label = 'Time (HR)';
s.DataTipTemplate.DataTipRows(2).Label = 'Cycle Time';
% Add a new row to the data tip. For the label, use State. For the value, use the state names contained in the statelabel variable in your workspace.
s.DataTipTemplate.DataTipRows(1).Value = t2;
row = dataTipTextRow('Truck No',app.trucklist);
s.DataTipTemplate.DataTipRows(end+1) = row;
% title(app.UIAxes,[' STATION NAME : ',filesinfo{1,ploti},],'Interpreter','none','FontWeight','bold','FontSize',22,...
% 'FontName','Arial',...
% 'Color',[0 0.447058823529412 0.741176470588235],'FontSize',22,'FontWeight','bold')
% hold on

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by