reporting: fix bug where a whole row wasn’t colored if the tableSubSectionHeader option was passed at the same time

time-shift
Houtan Bastani 2014-07-28 16:32:17 +02:00
parent 19134d1287
commit 1f3ae372fe
3 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,5 @@
function o = writeSeriesForTable(o, fid, dates, precision)
%function o = writeSeriesForTable(o, fid, dates, precision)
function o = writeSeriesForTable(o, fid, dates, precision, ncols)
%function o = writeSeriesForTable(o, fid, dates, precision, ncols)
% Write Table Row
%
% INPUTS
@ -7,6 +7,7 @@ function o = writeSeriesForTable(o, fid, dates, precision)
% fid [int] file id
% dates [dates] dates for report_series slice
% precision [float] precision with which to print the data
% ncols [int] total number of columns in table
%
%
% OUTPUTS
@ -69,6 +70,9 @@ if ~isempty(o.tableRowColor)
end
if ~isempty(o.tableSubSectionHeader)
fprintf(fid, '%s', o.tableSubSectionHeader);
for i=1:ncols-1
fprintf(fid, ' &');
end
fprintf(fid, '\\\\%%\n');
return;
end

View File

@ -170,7 +170,7 @@ fprintf(fid, '%%\n');
% Write Report_Table Data
for i=1:ne
o.series{i}.writeSeriesForTable(fid, o.range, o.precision);
o.series{i}.writeSeriesForTable(fid, o.range, o.precision, ncols);
if o.showHlines
fprintf(fid, '\\hline\n');
end

View File

@ -20,6 +20,8 @@ shortNames = {'US', 'EU', 'JA', 'EA6', 'LA6', 'RC6'};
longNames = {'Coca Cola', 'Kinder Bueno', 'Pizza', ...
'Vegetarianism Is Good', 'OS X', 'Dothraki'};
rep = rep.addSeries('tableSubSectionHeader', 'A group', ...
'tableRowColor', 'red!22');
for i=1:length(shortNames)
db_a = db_a.tex_rename([seriesRootName shortNames{i}], longNames{i});
rep = rep.addSeries('data', db_a{[seriesRootName shortNames{i}]});