Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Fix v0.7 deprecations #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: julia
julia:
- 0.3
- 0.4
- 0.5
- 0.7
- nightly
notifications:
email: false
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ A Julia implementation of [spark](https://github.com/holman/spark).
## Example usage

julia> using Sparklines
julia> spark(sin(0:0.2:2pi))

julia> spark(sin.(0:0.2:2pi))
▄▅▅▆▇▇▇███▇▇▆▆▅▅▄▃▂▂▁▁▁▁▁▁▁▁▂▂▃▄

julia> spark(cumsum(randn(80)))
▄▄▄▃▃▃▄▅▅▄▃▄▂▁▁▁▁▁▁▁▂▃▄▄▅▄▄▅▄▅▆▅▄▃▃▃▄▄▅▅▆▅▅▅▅▅▆▅▅▄▄▅▅▆▆▇█▇▇▇▆▅▆▅▄▄▃▄▆▆▅▆▇▇▇▇▇▆▅▅
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.3
julia 0.7-alpha
Compat 0.8
12 changes: 6 additions & 6 deletions src/Sparklines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ const ticks = ['▁','▂','▃','▄','▅','▆','▇','█']

!isdefined(Base, :extrema) && (extrema(x) = (minimum(x), maximum(x)))

spark(itr) = spark(STDOUT, itr)
spark(itr) = spark(stdout, itr)
function spark(io::IO, itr)
values = collect(itr)
min, max = extrema(values)

f = div((max - min) * 2^8, length(ticks)-1)
f < 1 && (f = one(typeof(f)))
idxs = convert(Vector{Int}, div(((values .- min) * 2^8), f))
print(io, convert(String, ticks[idxs.+1]))

idxs = convert(Vector{Int}, div.(((values .- min) .* 2^8), f))
print(io, String(ticks[idxs.+1]))
end

sparkln(itr) = sparkln(STDOUT, itr)
sparkln(itr) = sparkln(stdout, itr)
sparkln(io::IO, itr) = (spark(io, itr); println(io))


Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Sparklines
using Base.Test
using Test

# Original tests from https://github.com/holman/spark/blob/master/spark-test.sh
# Copyright (c) Zach Holman, http://zachholman.com, MIT license
Expand Down