|
| 1 | +function obj = updateCategoricalHistogram(obj,histIndex) |
| 2 | + |
| 3 | +% x:...[DONE] |
| 4 | +% y:...[DONE] |
| 5 | +% histnorm:...[DONE] |
| 6 | +% name:...[DONE] |
| 7 | +% autobinx:...[DONE] |
| 8 | +% nbinsx:...[DONE] |
| 9 | +% xbins:...[DONE] |
| 10 | +% autobiny:...[DONE] |
| 11 | +% nbinsy:...[DONE] |
| 12 | +% ybins:...[DONE] |
| 13 | +% text:...[NOT SUPPORTED IN MATLAB] |
| 14 | +% error_y:...[HANDLED BY ERRORBARSERIES] |
| 15 | +% error_x:...[HANDLED BY ERRORBARSERIES] |
| 16 | +% opacity: --- [TODO] |
| 17 | +% xaxis:...[DONE] |
| 18 | +% yaxis:...[DONE] |
| 19 | +% showlegend:...[DONE] |
| 20 | +% stream:...[HANDLED BY PLOTLYSTREAM] |
| 21 | +% visible:...[DONE] |
| 22 | +% type:...[DONE] |
| 23 | +% orientation:...[DONE] |
| 24 | + |
| 25 | +% MARKER: |
| 26 | +% color: ...[DONE] |
| 27 | +% size: ...[NA] |
| 28 | +% symbol: ...[NA] |
| 29 | +% opacity: ...[TODO] |
| 30 | +% sizeref: ...[NA] |
| 31 | +% sizemode: ...[NA] |
| 32 | +% colorscale: ...[NA] |
| 33 | +% cauto: ...[NA] |
| 34 | +% cmin: ...[NA] |
| 35 | +% cmax: ...[NA] |
| 36 | +% outliercolor: ...[NA] |
| 37 | +% maxdisplayed: ...[NA] |
| 38 | + |
| 39 | +% MARKER LINE: |
| 40 | +% color: ...[DONE] |
| 41 | +% width: ...[DONE] |
| 42 | +% dash: ...[NA] |
| 43 | +% opacity: ...[TODO] |
| 44 | +% shape: ...[NA] |
| 45 | +% smoothing: ...[NA] |
| 46 | +% outliercolor: ...[NA] |
| 47 | +% outlierwidth: ...[NA] |
| 48 | + |
| 49 | +%-------------------------------------------------------------------------% |
| 50 | + |
| 51 | +%-AXIS INDEX-% |
| 52 | +axIndex = obj.getAxisIndex(obj.State.Plot(histIndex).AssociatedAxis); |
| 53 | + |
| 54 | +%-HIST DATA STRUCTURE- % |
| 55 | +hist_data = get(obj.State.Plot(histIndex).Handle); |
| 56 | + |
| 57 | +%-CHECK FOR MULTIPLE AXES-% |
| 58 | +[xsource, ysource] = findSourceAxis(obj,axIndex); |
| 59 | + |
| 60 | +%-AXIS DATA-% |
| 61 | +eval(['xaxis = obj.layout.xaxis' num2str(xsource) ';']); |
| 62 | +eval(['yaxis = obj.layout.yaxis' num2str(ysource) ';']); |
| 63 | + |
| 64 | +%-------------------------------------------------------------------------% |
| 65 | + |
| 66 | +%-hist xaxis-% |
| 67 | +obj.data{histIndex}.xaxis = ['x' num2str(xsource)]; |
| 68 | + |
| 69 | +%-------------------------------------------------------------------------% |
| 70 | + |
| 71 | +%-hist yaxis-% |
| 72 | +obj.data{histIndex}.yaxis = ['y' num2str(ysource)]; |
| 73 | + |
| 74 | +%-------------------------------------------------------------------------% |
| 75 | + |
| 76 | +%-bar type-% |
| 77 | +obj.data{histIndex}.type = 'bar'; |
| 78 | + |
| 79 | +%-------------------------------------------------------------------------% |
| 80 | + |
| 81 | +%-hist data-% |
| 82 | +obj.data{histIndex}.width = hist_data.BarWidth; |
| 83 | +obj.data{histIndex}.y = hist_data.BinCounts; |
| 84 | + |
| 85 | +%-------------------------------------------------------------------------% |
| 86 | + |
| 87 | +%-hist categorical layout on x-axis-% |
| 88 | +obj.layout.xaxis1.type = 'category'; |
| 89 | +obj.layout.xaxis1.autotick = false; |
| 90 | + |
| 91 | +gap = 1 - hist_data.BarWidth; |
| 92 | +xmin = -0.5 * gap; |
| 93 | +xmax = (hist_data.NumDisplayBins - 1) + 0.5 * gap; |
| 94 | + |
| 95 | +obj.layout.xaxis1.range = {xmin, xmax}; |
| 96 | + |
| 97 | +%-------------------------------------------------------------------------% |
| 98 | + |
| 99 | +%-hist name-% |
| 100 | +obj.data{histIndex}.name = hist_data.DisplayName; |
| 101 | + |
| 102 | +%-------------------------------------------------------------------------% |
| 103 | + |
| 104 | +%-layout barmode-% |
| 105 | +obj.layout.barmode = 'group'; |
| 106 | + |
| 107 | +%-------------------------------------------------------------------------% |
| 108 | + |
| 109 | +%-hist line width-% |
| 110 | +obj.data{histIndex}.marker.line.width = hist_data.LineWidth; |
| 111 | + |
| 112 | +%-------------------------------------------------------------------------% |
| 113 | + |
| 114 | +%-hist opacity-% |
| 115 | +if ~ischar(hist_data.FaceAlpha) |
| 116 | + obj.data{histIndex}.opacity = hist_data.FaceAlpha; |
| 117 | +end |
| 118 | + |
| 119 | +%-------------------------------------------------------------------------% |
| 120 | + |
| 121 | +obj.data{histIndex}.marker = extractPatchFace(hist_data); |
| 122 | + |
| 123 | +%-------------------------------------------------------------------------% |
| 124 | + |
| 125 | +%-hist visible-% |
| 126 | +obj.data{histIndex}.visible = strcmp(hist_data.Visible,'on'); |
| 127 | + |
| 128 | +%-------------------------------------------------------------------------% |
| 129 | + |
| 130 | +%-hist showlegend-% |
| 131 | +leg = get(hist_data.Annotation); |
| 132 | +legInfo = get(leg.LegendInformation); |
| 133 | + |
| 134 | +switch legInfo.IconDisplayStyle |
| 135 | + case 'on' |
| 136 | + showleg = true; |
| 137 | + case 'off' |
| 138 | + showleg = false; |
| 139 | +end |
| 140 | + |
| 141 | +obj.data{histIndex}.showlegend = showleg; |
| 142 | + |
| 143 | +%-------------------------------------------------------------------------% |
| 144 | + |
| 145 | +end |
0 commit comments