reporting: fix shading

time-shift
Houtan Bastani 2014-02-24 09:05:47 +01:00
parent 9f3333db58
commit 0feeb0f2a9
2 changed files with 19 additions and 9 deletions

View File

@ -185,11 +185,23 @@ if ~isempty(o.shade)
assert(~isempty(x1) && ~isempty(x2), ['@graph.writeGraphFile: either ' ...
date2string(o.shade(1)) ' or ' date2string(o.shade(end)) ' is not in the date ' ...
'range of data selected.']);
fprintf(fid,['\\begin{pgfonlayer}{background}\n\\fill[%s!%f]\n(axis ' ...
'cs:%f,\\pgfkeysvalueof{/pgfplots/ymin})\nrectangle (axis ' ...
'cs:\\pgfkeysvalueof{/pgfplots/xmax},\\pgfkeysvalueof{/' ...
'pgfplots/ymax});\n\\end{pgfonlayer}\n'], ...
o.shadeColor, o.shadeOpacity,x1);
if x1 == 1
fprintf(fid,['\\begin{pgfonlayer}{background}\n\\fill[%s!%f]\n(axis ' ...
'cs:\\pgfkeysvalueof{/pgfplots/xmin},\\pgfkeysvalueof{/pgfplots/ymin})\nrectangle (axis ' ...
'cs:%f,\\pgfkeysvalueof{/pgfplots/ymax});\n\\end{pgfonlayer}\n'], ...
o.shadeColor, o.shadeOpacity, x2);
elseif x2 == dd.ndat
fprintf(fid,['\\begin{pgfonlayer}{background}\n\\fill[%s!%f]\n(axis ' ...
'cs:%f,\\pgfkeysvalueof{/pgfplots/ymin})\nrectangle (axis ' ...
'cs:\\pgfkeysvalueof{/pgfplots/xmax},\\pgfkeysvalueof{/' ...
'pgfplots/ymax});\n\\end{pgfonlayer}\n'], ...
o.shadeColor, o.shadeOpacity, x1);
else
fprintf(fid,['\\begin{pgfonlayer}{background}\n\\fill[%s!%f]\n(axis ' ...
'cs:%f,\\pgfkeysvalueof{/pgfplots/ymin})\nrectangle (axis ' ...
'cs:%f,\\pgfkeysvalueof{/pgfplots/ymax});\n\\end{pgfonlayer}\n'], ...
o.shadeColor, o.shadeOpacity, x1, x2);
end
end
fprintf(fid, '\\end{axis}\n\\end{tikzpicture}\n');

View File

@ -205,12 +205,10 @@ rep = rep.addSeries('data', dc_q{'LRPOIL_WORLD'}, ...
'graphLineStyle', 'dashed', ...
'graphLineWidth', 1.5);
srange1 = prange(1):forecast_date;
rep = rep.addGraph('title', 'Equilibrium World Real Oil Price', ...
'xrange', prange, ...
'shade', srange, ...
'xTicks', [1,5,10,15,find(srange(1)==prange),length(prange)], ...
'xTickLabels',{startpoint{:},'2008Q1','2009Q2','2010Q3',shaded{:}, endpoint{:}},...
'xTickLabelRotation', 0);
'shade', srange1);
rep = rep.addSeries('data', db_q{'LRPOIL_BAR_WORLD'}, ...
'graphLineColor', 'blue', ...
'graphLineWidth', 1.5);