|
1 |
| -function updateArea(obj,areaIndex) |
| 1 | +function data = updateArea(obj,areaIndex) |
2 | 2 | % x: ...[DONE]
|
3 | 3 | % y: ...[DONE]
|
4 | 4 | % r: ...[NOT SUPPORTED IN MATLAB]
|
@@ -75,50 +75,42 @@ function updateArea(obj,areaIndex)
|
75 | 75 | [xsource, ysource] = findSourceAxis(obj,axIndex);
|
76 | 76 | end
|
77 | 77 |
|
78 |
| - obj.data{areaIndex}.xaxis = "x" + xsource; |
79 |
| - obj.data{areaIndex}.yaxis = "y" + ysource; |
80 |
| - obj.data{areaIndex}.type = "scatter"; |
81 |
| - obj.data{areaIndex}.x = area_data.XData; |
| 78 | + data.xaxis = "x" + xsource; |
| 79 | + data.yaxis = "y" + ysource; |
| 80 | + data.type = "scatter"; |
| 81 | + data.x = area_data.XData; |
82 | 82 |
|
83 |
| - %-area y-% |
84 | 83 | prevAreaIndex = find(cellfun(@(x) isfield(x,"fill") ...
|
85 |
| - && isequal({x.xaxis x.yaxis},{obj.data{areaIndex}.xaxis ... |
86 |
| - obj.data{areaIndex}.yaxis}),obj.data(1:areaIndex-1)),1,"last"); |
| 84 | + && isequal({x.xaxis x.yaxis},{data.xaxis ... |
| 85 | + data.yaxis}),obj.data(1:areaIndex-1)),1,"last"); |
87 | 86 | if ~isempty(prevAreaIndex)
|
88 |
| - obj.data{areaIndex}.y = obj.data{prevAreaIndex}.y + area_data.YData; |
| 87 | + data.y = obj.data{prevAreaIndex}.y + area_data.YData; |
89 | 88 | else
|
90 |
| - obj.data{areaIndex}.y = area_data.YData; |
| 89 | + data.y = area_data.YData; |
91 | 90 | end
|
92 | 91 |
|
93 |
| - obj.data{areaIndex}.name = area_data.DisplayName; |
94 |
| - obj.data{areaIndex}.visible = strcmp(area_data.Visible, "on"); |
| 92 | + data.name = area_data.DisplayName; |
| 93 | + data.visible = area_data.Visible == "on"; |
95 | 94 |
|
96 |
| - %-area fill-% |
97 | 95 | if ~isempty(prevAreaIndex)
|
98 |
| - obj.data{areaIndex}.fill = "tonexty"; |
| 96 | + data.fill = "tonexty"; |
99 | 97 | else % first area plot
|
100 |
| - obj.data{areaIndex}.fill = "tozeroy"; |
| 98 | + data.fill = "tozeroy"; |
101 | 99 | end
|
102 | 100 |
|
103 |
| - %-AREA MODE-% |
104 |
| - if isprop(area_data, "LineStyle") ... |
105 |
| - && isequal(area_data.LineStyle, "none") |
106 |
| - obj.data{areaIndex}.mode = "none"; |
| 101 | + if isprop(area_data, "LineStyle") && area_data.LineStyle == "none" |
| 102 | + data.mode = "none"; |
107 | 103 | else
|
108 |
| - obj.data{areaIndex}.mode = "lines"; |
| 104 | + data.mode = "lines"; |
109 | 105 | end
|
110 | 106 |
|
111 |
| - obj.data{areaIndex}.line = extractAreaLine(area_data); |
112 |
| - fill = extractAreaFace(area_data); |
113 |
| - obj.data{areaIndex}.fillcolor = fill.color; |
| 107 | + data.line = extractAreaLine(area_data); |
| 108 | + data.fillcolor = extractAreaFace(area_data).color; |
114 | 109 |
|
115 |
| - leg = area_data.Annotation; |
116 |
| - legInfo = leg.LegendInformation; |
117 |
| - switch legInfo.IconDisplayStyle |
| 110 | + switch area_data.Annotation.LegendInformation.IconDisplayStyle |
118 | 111 | case "on"
|
119 |
| - showleg = true; |
| 112 | + data.showlegend = true; |
120 | 113 | case "off"
|
121 |
| - showleg = false; |
| 114 | + data.showlegend = false; |
122 | 115 | end
|
123 |
| - obj.data{areaIndex}.showlegend = showleg; |
124 | 116 | end
|
0 commit comments