reporting: add option ‘graphLegendName’ to addSeries

time-shift
Houtan Bastani 2014-05-19 12:29:54 +02:00
parent 214610be1e
commit ae1c12f482
3 changed files with 16 additions and 3 deletions

View File

@ -11189,6 +11189,7 @@ The height of the graph, in inches. Default: @code{4.5}
Whether or not to display the major grid on the graph. Default:
@code{true}
@anchor{showLegend}
@item showLegend, @code{BOOLEAN}
Whether or not to display the legend. Default: @code{false}
@ -11331,7 +11332,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, tableRowIndent, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zeroTol
@defmethod Report addSeries data, graphLegendName, 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
@ -11339,6 +11340,10 @@ Adds a @code{Series} to a @code{Graph} or a @code{Table}.
@item data, @code{dseries}
@xref{data}.
@item graphLegendName, @code{STRING}
The name to display in the legend for this series. Will be displayed only if
the @ref{data} option has been set. Default: the @code{tex} name of the series
@item graphLineColor, @code{`red'} | @code{`green'} | @code{`blue'} | @code{`cyan'} | @code{`magenta'} | @code{`yellow'} | @code{`black'} | @code{`gray'} | @code{`darkgray'} | @code{`lightgray'} | @code{`brown'} | @code{`lime'} | @code{`olive'} | @code{`orange'} | @code{`pink'} | @code{`purple'} | @code{`teal'} | @code{`violet'} | @code{`white'}
Color to use for the series in a graph. Default: @code{`black'}

View File

@ -35,6 +35,8 @@ o = struct;
o.data = '';
o.graphLegendName = '';
o.graphLineColor = 'black';
o.graphLineStyle = 'solid';
o.graphLineWidth = 0.5;
@ -84,6 +86,10 @@ elseif nargin > 1
end
end
if ~isempty(o.graphLegendName)
o.data = o.data.tex_rename(o.graphLegendName);
end
% Create report_series object
o = class(o, 'report_series');
end

View File

@ -239,11 +239,13 @@ rep = rep.addGraph('title', 'Equilibrium World Real Food Price', ...
'xTickLabelRotation', 0);
rep = rep.addSeries('data', db_q{'LRPFOOD_BAR_WORLD'}, ...
'graphLineColor', 'blue', ...
'graphLineWidth', 1.5);
'graphLineWidth', 1.5, ...
'graphLegendName', 'baseline');
rep = rep.addSeries('data', dc_q{'LRPFOOD_BAR_WORLD'}, ...
'graphLineColor', 'blue', ...
'graphLineStyle', 'dashed', ...
'graphLineWidth', 1.5);
'graphLineWidth', 1.5, ...
'graphLegendName', 'control');
%% Write & Compile Report
rep.write();