Added a Date & DateTime method for widen - enables xlims with Date or DateTime types

This commit is contained in:
Thatcher Chamberlin 2020-12-01 18:36:43 -05:00
parent c35adbfeff
commit b046ed9b90

View File

@ -426,6 +426,11 @@ end
# -------------------------------------------------------------------------
# handle widen in the case that xlims are of type Date or DateTime
function widen(dmin::Union{Date,DateTime}, dmax::Union{Date,DateTime}, scale = :identity)
widen(Dates.value(dmin), Dates.value(dmax), scale)
end
# push the limits out slightly
function widen(lmin, lmax, scale = :identity)
f, invf = RecipesPipeline.scale_func(scale), RecipesPipeline.inverse_scale_func(scale)
@ -674,7 +679,7 @@ function axis_drawing_info(sp, letter)
reverse_if((tick, tick_stop), isy),
)
end
if ax[:minorgrid]
if ax[:minorgrid]
push!(
minorgrid_segments,
reverse_if((tick, oamin), isy),
@ -728,7 +733,7 @@ function axis_drawing_info_3d(sp, letter)
minorgrid_segments = Segments(3)
border_segments = Segments(3)
if sp[:framestyle] != :none# && letter === :x
na0, na1 = if sp[:framestyle] in (:origin, :zerolines)
0, 0
@ -847,4 +852,4 @@ end
reverse_if(x, cond) = cond ? reverse(x) : x
axis_tuple(x, y, letter) = reverse_if((x, y), letter === :y)
axes_shift(t, i) = i % 3 == 0 ? t : i % 3 == 1 ? (t[3], t[1], t[2]) : (t[2], t[3], t[1])
axes_shift(t, i) = i % 3 == 0 ? t : i % 3 == 1 ? (t[3], t[1], t[2]) : (t[2], t[3], t[1])