|
| 1 | +function updateConstantLine(obj,plotIndex) |
| 2 | + %---------------------------------------------------------------------% |
| 3 | + |
| 4 | + %-AXIS INDEX-% |
| 5 | + axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis); |
| 6 | + |
| 7 | + %-PLOT DATA STRUCTURE- % |
| 8 | + plotData = obj.State.Plot(plotIndex).Handle; |
| 9 | + |
| 10 | + %-CHECK FOR MULTIPLE AXES-% |
| 11 | + [xsource, ysource] = findSourceAxis(obj,axIndex); |
| 12 | + |
| 13 | + %---------------------------------------------------------------------% |
| 14 | + |
| 15 | + %-scatter xaxis-% |
| 16 | + obj.data{plotIndex}.xaxis = ["x" num2str(xsource)]; |
| 17 | + |
| 18 | + %---------------------------------------------------------------------% |
| 19 | + |
| 20 | + %-scatter yaxis-% |
| 21 | + obj.data{plotIndex}.yaxis = ["y" num2str(ysource)]; |
| 22 | + |
| 23 | + %---------------------------------------------------------------------% |
| 24 | + |
| 25 | + %-scatter type-% |
| 26 | + obj.data{plotIndex}.type = "scatter"; |
| 27 | + |
| 28 | + %---------------------------------------------------------------------% |
| 29 | + |
| 30 | + %-scatter visible-% |
| 31 | + obj.data{plotIndex}.visible = strcmp(plotData.Visible,"on"); |
| 32 | + |
| 33 | + %---------------------------------------------------------------------% |
| 34 | + |
| 35 | + %-scatter-% |
| 36 | + |
| 37 | + xaxis = obj.layout.("xaxis"+xsource); |
| 38 | + yaxis = obj.layout.("yaxis"+ysource); |
| 39 | + value = [plotData.Value plotData.Value]; |
| 40 | + if plotData.InterceptAxis == "y" |
| 41 | + obj.data{plotIndex}.x = xaxis.range; |
| 42 | + obj.data{plotIndex}.y = value; |
| 43 | + else |
| 44 | + obj.data{plotIndex}.x = value; |
| 45 | + obj.data{plotIndex}.y = yaxis.range; |
| 46 | + end |
| 47 | + |
| 48 | + %---------------------------------------------------------------------% |
| 49 | + |
| 50 | + %-Fro 3D plots-% |
| 51 | + obj.PlotOptions.is3d = false; % by default |
| 52 | + |
| 53 | + if isfield(plotData,"ZData") |
| 54 | + |
| 55 | + numbset = unique(plotData.ZData); |
| 56 | + |
| 57 | + if any(plotData.ZData) && length(numbset)>1 |
| 58 | + %-scatter z-% |
| 59 | + obj.data{plotIndex}.z = plotData.ZData; |
| 60 | + |
| 61 | + %-overwrite type-% |
| 62 | + obj.data{plotIndex}.type = "scatter3d"; |
| 63 | + |
| 64 | + %-flag to manage 3d plots-% |
| 65 | + obj.PlotOptions.is3d = true; |
| 66 | + end |
| 67 | + end |
| 68 | + |
| 69 | + %---------------------------------------------------------------------% |
| 70 | + |
| 71 | + %-scatter name-% |
| 72 | + obj.data{plotIndex}.name = plotData.DisplayName; |
| 73 | + |
| 74 | + %---------------------------------------------------------------------% |
| 75 | + |
| 76 | + %-scatter mode-% |
| 77 | + if plotData.Type ~= "constantline" ... |
| 78 | + && ~strcmpi("none", plotData.Marker) ... |
| 79 | + && ~strcmpi("none", plotData.LineStyle) |
| 80 | + mode = "lines+markers"; |
| 81 | + elseif plotData.Type ~= "constantline" ... |
| 82 | + && ~strcmpi("none", plotData.Marker) |
| 83 | + mode = "markers"; |
| 84 | + elseif ~strcmpi("none", plotData.LineStyle) |
| 85 | + mode = "lines"; |
| 86 | + else |
| 87 | + mode = "none"; |
| 88 | + end |
| 89 | + |
| 90 | + obj.data{plotIndex}.mode = mode; |
| 91 | + |
| 92 | + %---------------------------------------------------------------------% |
| 93 | + |
| 94 | + %-scatter line-% |
| 95 | + obj.data{plotIndex}.line = extractLineLine(plotData); |
| 96 | + |
| 97 | + %---------------------------------------------------------------------% |
| 98 | + |
| 99 | + %-scatter marker-% |
| 100 | + if plotData.Type ~= "constantline" |
| 101 | + obj.data{plotIndex}.marker = extractLineMarker(plotData); |
| 102 | + end |
| 103 | + |
| 104 | + %---------------------------------------------------------------------% |
| 105 | + |
| 106 | + %-scatter showlegend-% |
| 107 | + leg = get(plotData.Annotation); |
| 108 | + legInfo = get(leg.LegendInformation); |
| 109 | + |
| 110 | + switch legInfo.IconDisplayStyle |
| 111 | + case "on" |
| 112 | + showleg = true; |
| 113 | + case "off" |
| 114 | + showleg = false; |
| 115 | + end |
| 116 | + |
| 117 | + obj.data{plotIndex}.showlegend = showleg; |
| 118 | +end |
0 commit comments