Commit 8185ee97 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

reporting: @graph: accept dynDate ranges for shade and xrange and float...

reporting: @graph: accept dynDate ranges for shade and xrange and float lower/upper bound for yrange
parent b9e61f13
......@@ -60,9 +60,7 @@ else
end
if ~isempty(o.xrange)
dd1 = dynDate(o.xrange{1});
dd2 = dynDate(o.xrange{2});
ds = ds(dd1:dd2);
ds = ds(o.xrange);
end
data = ds.data;
......@@ -72,14 +70,14 @@ xlabels = getDatesCellStringArray(ds.time);
plot(x, data);
if ~isempty(o.yrange)
ylim([o.yrange{:}]);
ylim(o.yrange);
end
if ~isempty(o.shade)
x1 = find(strcmp(o.shade{1}, xlabels));
x2 = find(strcmp(o.shade{2}, xlabels));
x1 = find(strcmpi(o.shade(1).format(), xlabels));
x2 = find(strcmpi(o.shade(o.shade.ndat).format(), xlabels));
assert(~isempty(x1) && ~isempty(x2), ['@graph.createGraph: either ' ...
o.shade{1} ' or ' o.shade{2} 'is not in the date ' ...
o.shade(1).format() ' or ' o.shade(o.shade.ndat).format() ' is not in the date ' ...
'range of data selected.']);
yrange = get(gca, 'YLim');
......
......@@ -102,15 +102,16 @@ valid_legend_orientations = {'vertical', 'horizontal'};
assert(any(strcmp(o.legend_orientation, valid_legend_orientations)), ...
['@graph.graph: legend_orientation must be one of ' strjoin(valid_legend_orientations, ' ')]);
assert(isempty(o.shade) || (iscell(o.shade) && length(o.shade) == 2 && ...
ischar(o.shade{1}) && ischar(o.shade{2})), ...
['@graph.graph: yrange is specified as ''{''1999q1'',''1999q2''}''.']);
assert(isempty(o.xrange) || (iscell(o.xrange) && length(o.xrange) == 2 && ...
ischar(o.xrange{1}) && ischar(o.xrange{2})), ...
['@graph.graph: xrange is specified as ''{''1999q1'',''1999q2''}''.']);
assert(isempty(o.yrange) || (iscell(o.yrange) && length(o.yrange) == 2 && ...
ischar(o.yrange{1}) && ischar(o.yrange{2})), ...
['@graph.graph: yrange is specified as ''{''1999q1'',''1999q2''}''.']);
assert(isempty(o.shade) || (isa(o.shade, 'dynDates') && o.shade.ndat >= 2), ...
['@graph.graph: shade is specified as a dynDates range, e.g. ' ...
'''dynDates(''1999q1''):dynDates(''1999q3'')''.']);
assert(isempty(o.xrange) || (isa(o.xrange, 'dynDates') && o.xrange.ndat >= 2), ...
['@graph.graph: xrange is specified as a dynDates range, e.g. ' ...
'''dynDates(''1999q1''):dynDates(''1999q3'')''.']);
assert(isempty(o.yrange) || (isfloat(o.yrange) && length(o.yrange) == 2 && ...
o.yrange(1) < o.yrange(2)), ...
['@graph.graph: yrange is specified an array with two float entries, ' ...
'the lower bound and upper bound.']);
assert(~isempty(o.data), '@graph.graph: must provide data');
msg = ['@graph.graph: data must either be a dynSeries or a cell array of ' ...
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment