2014-12-09 09:35:38 +01:00
|
|
|
import Winston
|
2014-12-04 15:14:07 +01:00
|
|
|
|
2014-12-04 20:54:56 +01:00
|
|
|
function Base.display(report::Report, m::MIME"image/png", data)
|
2014-12-04 15:14:07 +01:00
|
|
|
|
|
|
|
chunk = report.cur_chunk
|
|
|
|
full_name, rel_name = get_figname(report, chunk)
|
|
|
|
|
|
|
|
docformat = formats[report.formatdict[:doctype]]
|
|
|
|
|
|
|
|
#Add to results for term chunks and store otherwise
|
2015-01-05 15:35:24 +01:00
|
|
|
if chunk.options[:term]
|
|
|
|
chunk.figures = [rel_name]
|
2014-12-05 10:28:55 +01:00
|
|
|
|
|
|
|
if report.term_state == :text
|
2014-12-09 08:43:32 +01:00
|
|
|
report.cur_result *= "\n" * report.formatdict[:codeend] * "\n"
|
2014-12-05 10:28:55 +01:00
|
|
|
end
|
|
|
|
|
2014-12-04 15:14:07 +01:00
|
|
|
report.cur_result *= formatfigures(chunk, docformat)
|
2014-12-05 10:28:55 +01:00
|
|
|
report.term_state = :fig
|
2015-01-05 15:35:24 +01:00
|
|
|
chunk.figures = String[]
|
2014-12-04 15:14:07 +01:00
|
|
|
else
|
|
|
|
push!(report.figures, rel_name)
|
|
|
|
end
|
|
|
|
|
2014-12-09 08:43:32 +01:00
|
|
|
vector_fmts = [".pdf", ".svg"]
|
|
|
|
|
|
|
|
#Don't use dpi for vector formats
|
2015-01-05 15:35:24 +01:00
|
|
|
if chunk.options[:fig_ext] in vector_fmts
|
|
|
|
Winston.savefig(data, full_name, width=chunk.options[:fig_width]*100,
|
|
|
|
height=chunk.options[:fig_height]*100)
|
2014-12-09 08:43:32 +01:00
|
|
|
else
|
2015-01-05 15:35:24 +01:00
|
|
|
Winston.savefig(data, full_name,
|
|
|
|
width=chunk.options[:fig_width]*chunk.options[:dpi],
|
|
|
|
height=chunk.options[:fig_height]*chunk.options[:dpi])
|
2014-12-09 08:43:32 +01:00
|
|
|
end
|
|
|
|
|
2014-12-04 15:14:07 +01:00
|
|
|
report.fignum += 1
|
|
|
|
end
|