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
|
|
|
|
if chunk[:term]
|
|
|
|
chunk[:figure] = [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
|
2014-12-04 15:14:07 +01:00
|
|
|
chunk[:figure] = String[]
|
|
|
|
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
|
|
|
|
if chunk[:fig_ext] in vector_fmts
|
2014-12-09 09:35:38 +01:00
|
|
|
Winston.savefig(data, full_name, width=chunk[:fig_width]*100, height=chunk[:fig_height]*100)
|
2014-12-09 08:43:32 +01:00
|
|
|
else
|
2014-12-09 09:35:38 +01:00
|
|
|
Winston.savefig(data, full_name, width=chunk[:fig_width]*chunk[:dpi], height=chunk[:fig_height]*chunk[:dpi])
|
2014-12-09 08:43:32 +01:00
|
|
|
end
|
|
|
|
|
2014-12-04 15:14:07 +01:00
|
|
|
report.fignum += 1
|
|
|
|
end
|