Merge pull request #1027 from daschw/ds-datetime-ticks

Allow Date and DateTime as ticks (fix: #1026)
This commit is contained in:
Daniel Schwabeneder 2017-08-20 22:51:26 +02:00 committed by GitHub
commit c76855698e

View File

@ -216,7 +216,7 @@ end
# return (continuous_values, discrete_values) for the ticks on this axis
function get_ticks(axis::Axis)
ticks = axis[:ticks]
ticks = _transform_ticks(axis[:ticks])
ticks in (nothing, false) && return nothing
dvals = axis[:discrete_values]
@ -246,6 +246,10 @@ function get_ticks(axis::Axis)
end
end
_transform_ticks(ticks) = ticks
_transform_ticks(ticks::AbstractArray{T}) where T <: Dates.TimeType = Dates.value.(ticks)
_transform_ticks(ticks::NTuple{2, Any}) = (_transform_ticks(ticks[1]), ticks[2])
# -------------------------------------------------------------------------