Skip to content

Commit

Permalink
Merge pull request #64 from andreasnoack/master
Browse files Browse the repository at this point in the history
Better 0.6 fixes
  • Loading branch information
Evizero committed Feb 20, 2017
2 parents bcdcade + dd2693d commit fbd7d5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
@@ -1,3 +1,3 @@
julia 0.5
StatsBase
Compat 0.18
Compat 0.17
31 changes: 2 additions & 29 deletions src/graphics/bargraphics.jl
@@ -1,5 +1,3 @@
if VERSION < v"0.6-"
_type_string = """
type BarplotGraphics{R<:Real} <: GraphicsArea
bars::Vector{R}
color::Symbol
Expand All @@ -8,42 +6,17 @@ type BarplotGraphics{R<:Real} <: GraphicsArea
max_len::R
symb::AbstractString

function BarplotGraphics(
function (::Type{BarplotGraphics{R}}){R}(
bars::Vector{R},
width::Int,
color::Symbol,
symb)
width = max(width, 5)
max_freq = maximum(bars)
max_len = length(string(max_freq))
new(bars, color, width, max_freq, max_len, symb)
new{R}(bars, color, width, max_freq, max_len, symb)
end
end
"""
else
_type_string = """
type BarplotGraphics{R<:Real} <: GraphicsArea
bars::Vector{R}
color::Symbol
width::Int
max_freq::R
max_len::R
symb::AbstractString
function BarplotGraphics{R}(
bars::Vector{R},
width::Int,
color::Symbol,
symb) where R
width = max(width, 5)
max_freq = maximum(bars)
max_len = length(string(max_freq))
new(bars, color, width, max_freq, max_len, symb)
end
end
"""
end
include_string(_type_string)

nrows(c::BarplotGraphics) = length(c.bars)
ncols(c::BarplotGraphics) = c.width
Expand Down

0 comments on commit fbd7d5b

Please sign in to comment.