reporting: tables: add row highlighting option
parent
2cbe1c34d9
commit
387a9b87b1
|
@ -1,5 +1,5 @@
|
|||
function o = writeSeriesForTable(o, fid, dates, precision, ncols)
|
||||
%function o = writeSeriesForTable(o, fid, dates, precision, ncols)
|
||||
function o = writeSeriesForTable(o, fid, dates, precision, ncols, rowcolor)
|
||||
%function o = writeSeriesForTable(o, fid, dates, precision, ncols, rowcolor)
|
||||
% Write Table Row
|
||||
%
|
||||
% INPUTS
|
||||
|
@ -8,6 +8,7 @@ function o = writeSeriesForTable(o, fid, dates, precision, ncols)
|
|||
% dates [dates] dates for report_series slice
|
||||
% precision [float] precision with which to print the data
|
||||
% ncols [int] total number of columns in table
|
||||
% rowcolor [string] string to color this row
|
||||
%
|
||||
%
|
||||
% OUTPUTS
|
||||
|
@ -65,7 +66,11 @@ assert(isfloat(o.tableMarkerLimit), '@report_series.writeSeriesForTable: tableMa
|
|||
|
||||
%% Write Output
|
||||
fprintf(fid, '%% Table Row (report_series)\n');
|
||||
if ~isempty(o.tableRowColor)
|
||||
if ~isempty(o.tableRowColor) && ~strcmpi(o.tableRowColor, 'white')
|
||||
fprintf(fid, '\\rowcolor{%s}', o.tableRowColor);
|
||||
elseif ~isempty(rowcolor)
|
||||
fprintf(fid, '\\rowcolor{%s}', rowcolor);
|
||||
else
|
||||
fprintf(fid, '\\rowcolor{%s}', o.tableRowColor);
|
||||
end
|
||||
if ~isempty(o.tableSubSectionHeader)
|
||||
|
|
|
@ -51,6 +51,8 @@ o.range = {};
|
|||
o.precision = 1;
|
||||
o.writeCSV = false;
|
||||
|
||||
o.highlightRows = {''};
|
||||
|
||||
if nargin == 1
|
||||
assert(isa(varargin{1}, 'report_table'),['With one arg to Report_Table constructor, ' ...
|
||||
'you must pass a report_table object']);
|
||||
|
@ -117,6 +119,7 @@ assert(iscellstr(o.titleFormat), ...
|
|||
assert(ischar(o.tableName), '@report_table.report_table: tableName must be a string');
|
||||
assert(ischar(o.tableDirName), '@report_table.report_table: tableDirName must be a string');
|
||||
assert(islogical(o.writeCSV), '@report_table.report_table: writeCSV must be either true or false');
|
||||
assert(iscellstr(o.highlightRows), '@report_table.report_table: highlightRowsmust be a cell string');
|
||||
|
||||
% using o.seriesToUse, create series objects and put them in o.series
|
||||
if ~isempty(o.data)
|
||||
|
|
|
@ -175,7 +175,7 @@ if o.writeCSV
|
|||
csvseries = dseries();
|
||||
end
|
||||
for i=1:ne
|
||||
o.series{i}.writeSeriesForTable(fid, o.range, o.precision, ncols);
|
||||
o.series{i}.writeSeriesForTable(fid, o.range, o.precision, ncols, o.highlightRows{mod(i,length(o.highlightRows))+1});
|
||||
if o.writeCSV
|
||||
if isempty(o.series{i}.tableSubSectionHeader)
|
||||
csvseries = [csvseries ...
|
||||
|
|
Loading…
Reference in New Issue