reporting: add indentation to table rows. closes #581

time-shift
Houtan Bastani 2014-01-24 09:53:53 -06:00
parent a15808b2ce
commit fa9c0f0a79
5 changed files with 18 additions and 4 deletions

View File

@ -10722,7 +10722,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, tableDataRhs, tableRowColor, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zerotol
@defmethod Report addSeries data, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableDataRhs, tableRowColor, tableRowIndent, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zerotol
Adds a @code{Series} to a @code{Graph} or a @code{Table}.
@optionshead
@table @code
@ -10762,6 +10762,10 @@ followed by annual data. Default: @code{empty}
The color that you want the row to be. Predefined values include
@code{LightCyan} and @code{Gray}. Default: @code{white}.
@item tableRowIndent, @code{INTEGER}
The number of times to indent the name of the series in the
table. Used to create subgroups of series. Default: @code{0}
@item tableShowMarkers, @code{BOOLEAN}
In a Table, if @code{true}, surround each cell with brackets and color
it according to @ref{tableNegColor} and @ref{tablePosColor}. No effect

View File

@ -53,6 +53,7 @@ o.tableSubSectionHeader = '';
o.tableAlignRight = false;
o.tableRowColor = 'white';
o.tableRowIndent = 0;
o.tableDataRhs = '';

View File

@ -56,6 +56,7 @@ end
assert(ischar(o.tableNegColor), '@report_series.write: tableNegColor must be a string');
assert(ischar(o.tablePosColor), '@report_series.write: tablePosColor must be a string');
assert(ischar(o.tableRowColor), '@report_series.write: tableRowColor must be a string');
assert(isint(o.tableRowIndent), '@report_series.write: tableRowIndent must be an integer');
assert(islogical(o.tableShowMarkers), '@report_series.write: tableShowMarkers must be true or false');
assert(islogical(o.tableAlignRight), '@report_series.write: tableAlignRight must be true or false');
assert(isfloat(o.tableMarkerLimit), '@report_series,write: tableMarkerLimit must be a float');
@ -73,7 +74,14 @@ end
if o.tableAlignRight
fprintf(fid, '\\multicolumn{1}{r}{');
end
fprintf(fid, '%s', o.data.tex{:});
if o.tableRowIndent == 0
fprintf(fid, '\\noindent');
else
for i=1:o.tableRowIndent
fprintf(fid,'\\indent');
end
end
fprintf(fid, ' %s', o.data.tex{:});
if o.tableAlignRight
fprintf(fid, '}');
end

View File

@ -50,6 +50,7 @@ end
ndates = dates.ndat;
fprintf(fid, '%% Report_Table Object\n');
fprintf(fid, '\\setlength{\\parindent}{6pt}\n');
fprintf(fid, '\\setlength{\\tabcolsep}{4pt}\n');
fprintf(fid, '\\begin{tabular}{@{}l');
@ -156,7 +157,7 @@ for i=1:ne
end
fprintf(fid, '\\bottomrule\n');
fprintf(fid, '\\end{tabular} \\par \\medskip\n\n');
fprintf(fid, '\\end{tabular}\\setlength{\\parindent}{0pt}\n \\par \\medskip\n\n');
fprintf(fid, '%% End Report_Table Object\n');
fprintf(1, '.');
end

View File

@ -62,7 +62,7 @@ for i=1:length(seriesNames)
deltaa = delta.tex_rename('$\Delta$');
rep = rep.addSeries('data', delta, ...
'tableShowMarkers', true, ...
'tableAlignRight', true, ...
'tableRowIndent', 2, ...
'tableDataRhs', deltaa);
end
end