Skip to content

Commit

Permalink
_canvas_type in unicodeplots
Browse files Browse the repository at this point in the history
  • Loading branch information
tbreloff committed Nov 21, 2016
1 parent e9ccdef commit eba1e36
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/backends/unicodeplots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ end

# -------------------------------

const _canvas_type = Ref(:auto)

function _canvas_map()
KW(
:braille => UnicodePlots.BrailleCanvas,
:ascii => UnicodePlots.AsciiCanvas,
:block => UnicodePlots.BlockCanvas,
:dot => UnicodePlots.DotCanvas,
:density => UnicodePlots.DensityCanvas,
)
end


# do all the magic here... build it all at once, since we need to know about all the series at the very beginning
function rebuildUnicodePlot!(plt::Plot, width, height)
Expand All @@ -66,7 +78,12 @@ function rebuildUnicodePlot!(plt::Plot, width, height)
y = Float64[ylim[1]]

# create a plot window with xlim/ylim set, but the X/Y vectors are outside the bounds
canvas_type = isijulia() ? UnicodePlots.AsciiCanvas : UnicodePlots.BrailleCanvas
ct = _canvas_type[]
canvas_type = if ct == :auto
isijulia() ? UnicodePlots.AsciiCanvas : UnicodePlots.BrailleCanvas
else
_canvas_map()[ct]
end

# special handling for spy
if length(sp.series_list) == 1
Expand Down

0 comments on commit eba1e36

Please sign in to comment.