Commit 0de30dc5 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

reporting: fixes to make fan charts work with debian’s outdated latex distro

parent 05eef8cc
......@@ -238,6 +238,48 @@ end
if o.writeCSV
csvseries = dseries();
end
if isunix && ~ismac
for i=1:ne
isfan = ~isempty(o.series{i}.graphFanShadeColor);
if isfan
break
end
end
if isfan
data = dseries();
for i=1:ne
tmp = o.series{i}.data;
tmp = tmp.set_names(int2str(i));
data = [data tmp];
end
if isempty(dd) || all(dd == data.dates)
ds = data;
else
ds = data(dd);
end
for i=2:ne
tmp = ds{i} - ds{i-1};
idx = find(tmp.data ~= 0);
split = ds(ds.dates(idx));
end
idx = find(ds.dates == split.dates(1));
for i=2:ne
fprintf(fid, '\\addplot[fill=%s!%d, draw=none, forget plot] coordinates {',...
o.series{i}.graphFanShadeColor, o.series{i}.graphFanShadeOpacity);
for j=idx-1:ds.dates.ndat
fprintf(fid, '(%d, %f) ', j, ds{i-1}(ds.dates(j),1).data);
end
for j=ds.dates.ndat:-1:idx-1
fprintf(fid, '(%d, %f) ', j, ds{i}(ds.dates(j),1).data);
end
fprintf(fid, '} \\closedcycle;\n');
end
end
end
for i=1:ne
o.series{i}.writeSeriesForGraph(fid, dd, i);
if o.writeCSV
......
......@@ -52,7 +52,9 @@ if isoctave && isempty(regexpi(computer, '.*apple.*', 'once'))
fprintf(fid, '\\usepackage[utf8x]{inputenc}\n');
fprintf(fid, '\\usepackage{gnuplot-lua-tikz}\n');
end
fprintf(fid, '\\usepgfplotslibrary{fillbetween}\n');
if ispc || ismac
fprintf(fid, '\\usepgfplotslibrary{fillbetween}\n');
end
fprintf(fid, '\\definecolor{LightCyan}{rgb}{0.88,1,1}\n');
fprintf(fid, '\\definecolor{Gray}{gray}{0.9}\n');
if o.showDate
......
......@@ -124,12 +124,14 @@ end
fprintf(fid,'};\n');
% For Fan charts
if ~isempty(o.graphFanShadeColor)
assert(isint(series_num) && series_num > 1, ['@report_series.writeSeriesForGraph: can only add '...
'graphFanShadeColor and graphFanShadeOpacity starting from the ' ...
'second series in the graph']);
fprintf(fid, '\\addplot[%s!%d, forget plot] fill between[of=%d and %d];\n', ...
o.graphFanShadeColor, o.graphFanShadeOpacity, series_num, series_num - 1);
if ispc || ismac
if ~isempty(o.graphFanShadeColor)
assert(isint(series_num) && series_num > 1, ['@report_series.writeSeriesForGraph: can only add '...
'graphFanShadeColor and graphFanShadeOpacity starting from the ' ...
'second series in the graph']);
fprintf(fid, '\\addplot[%s!%d, forget plot] fill between[of=%d and %d];\n', ...
o.graphFanShadeColor, o.graphFanShadeOpacity, series_num, series_num - 1);
end
end
end
......@@ -155,5 +157,9 @@ end
if ~isempty(o.graphMiscTikzAddPlotOptions)
fprintf(fid, ',%s', o.graphMiscTikzAddPlotOptions);
end
fprintf(fid,',name path=%d]', series_num);
if isunix && ~ismac
fprintf(fid,']');
else
fprintf(fid,',name path=%d]', series_num);
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment