reporting: @series: add zerotol option
parent
7d1899df20
commit
5515a8a64a
|
@ -8359,7 +8359,7 @@ Whether or not to show vertical lines separating the columns. Default: @code{fal
|
|||
@end defmethod
|
||||
|
||||
@anchor{addSeries}
|
||||
@defmethod Report addSeries data, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor
|
||||
@defmethod Report addSeries data, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, zerotol
|
||||
Adds a @code{Series} to a @code{Graph} or a @code{Table}.
|
||||
@optionshead
|
||||
@table @code
|
||||
|
@ -8413,6 +8413,11 @@ zero. Default: @code{`red'}
|
|||
The color to use when marking Table data that is greater than
|
||||
zero. Default: @code{`blue'}
|
||||
|
||||
@item zerotol, @code{DOUBLE}
|
||||
The zero tolerance. Anything smaller than @code{zerotol} and larger
|
||||
than @code{-zerotol} will be set to zero before being
|
||||
graphed. Default: @math{1e-6}
|
||||
|
||||
@end table
|
||||
@end defmethod
|
||||
|
||||
|
|
|
@ -60,6 +60,9 @@ assert(~(strcmp(o.graphLineStyle, 'none') && isempty(o.graphMarker)), ['@series.
|
|||
% Validate xrange
|
||||
assert(isempty(xrange) || isa(xrange, 'dynDates'));
|
||||
|
||||
% Zero tolerance
|
||||
assert(isfloat(o.zerotol), '@series.write: zerotol must be a float');
|
||||
|
||||
%%
|
||||
if isempty(xrange) || xrange == o.data.time
|
||||
ds = o.data;
|
||||
|
@ -67,8 +70,18 @@ else
|
|||
ds = o.data(xrange);
|
||||
end
|
||||
|
||||
opt = {'XData', 1:length(ds.data)};
|
||||
opt = {opt{:}, 'YData', ds.data};
|
||||
% if graphing data that is within zerotol, set to zero, create series and
|
||||
% get line:
|
||||
thedata = ds.data;
|
||||
stz = bsxfun(@and, ...
|
||||
bsxfun(@lt, thedata, o.zerotol), ...
|
||||
bsxfun(@gt, thedata, -o.zerotol));
|
||||
if any(stz)
|
||||
thedata(stz) = 0;
|
||||
end
|
||||
|
||||
opt = {'XData', 1:length(thedata)};
|
||||
opt = {opt{:}, 'YData', thedata};
|
||||
|
||||
opt = {opt{:}, 'Color', o.graphLineColor};
|
||||
opt = {opt{:}, 'LineStyle', o.graphLineStyle};
|
||||
|
|
|
@ -51,6 +51,8 @@ o.tableMarkerLimit = 1e-4;
|
|||
|
||||
o.tableAlignRight = false;
|
||||
|
||||
o.zerotol = 1e-6;
|
||||
|
||||
if nargin == 1
|
||||
assert(isa(varargin{1}, 'series'),['@series.series: with one arg you ' ...
|
||||
'must pass a series object']);
|
||||
|
|
Loading…
Reference in New Issue