From fa6f0a6b001beea5af73b230e9fb921eed1e376f Mon Sep 17 00:00:00 2001 From: Travis DePrato <773453+travigd@users.noreply.github.com> Date: Tue, 26 Nov 2019 12:55:27 -0500 Subject: [PATCH 1/5] Fix PlotlyJS integration with WebIO Fixes #2272. --- src/backends/plotlyjs.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index 5893ece3..7f86cc66 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -42,8 +42,8 @@ _display(plt::Plot{PlotlyJSBackend}) = display(plotlyjs_syncplot(plt)) @require WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29" begin function WebIO.render(plt::Plot{PlotlyJSBackend}) - prepare_output(plt) - WebIO.render(plt.o) + plt_html = sprint(show, MIME("text/html"), x) + return WebIO.render(dom"div"(innerHTML=plt_html)) end end From 7d34b9bb46123499439d0e6eea305b40de849e61 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 30 Mar 2020 11:39:01 +0200 Subject: [PATCH 2/5] fix julia versions in tests --- .travis.yml | 2 +- appveyor.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index abf00122..60b5bbde 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ os: - linux # - osx julia: + - 1.0 - 1 - - 1.4 - nightly matrix: diff --git a/appveyor.yml b/appveyor.yml index 7742efb2..911fe8f4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,7 @@ environment: matrix: - # - julia_version: 0.7 + - julia_version: 1.0 - julia_version: 1 - - julia_version: 1.4 - julia_version: nightly platform: From f1f9d807e625494089be3458bc812d2c729c45d1 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 30 Mar 2020 11:39:50 +0200 Subject: [PATCH 3/5] don't pin FixedPointNumbers in tests --- .travis.yml | 2 +- appveyor.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 60b5bbde..ccd58dfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,4 +41,4 @@ after_success: script: - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - if [[ `uname` = "Linux" ]]; then TESTCMD="xvfb-run julia"; else TESTCMD="julia"; fi - - $TESTCMD -e 'using Pkg; if VERSION == v"1.4"; Pkg.resolve(); end; Pkg.pin(PackageSpec(name="FixedPointNumbers", version="0.7")); Pkg.build(); Pkg.test(coverage=true)' + - $TESTCMD -e 'using Pkg; Pkg.build(); Pkg.test(coverage=true)' diff --git a/appveyor.yml b/appveyor.yml index 911fe8f4..081e56df 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,8 +32,7 @@ install: - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) build_script: - - C:\julia\bin\julia --project=C:\projects\plots-jl -e "using Pkg; if VERSION == v"""1.4"""; Pkg.resolve(); end; Pkg.pin(PackageSpec(name="""FixedPointNumbers""", version="""0.7"""))" - - echo "%JL_BUILD_SCRIPT%" + - echo "%JL_TEST_SCRIPT%" - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" test_script: From cb8df169c79d443fca5435c6fdd1d4561ab05adc Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 30 Mar 2020 12:37:26 +0200 Subject: [PATCH 4/5] fix typo --- src/backends/plotlyjs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index 7f86cc66..b43944be 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -42,7 +42,7 @@ _display(plt::Plot{PlotlyJSBackend}) = display(plotlyjs_syncplot(plt)) @require WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29" begin function WebIO.render(plt::Plot{PlotlyJSBackend}) - plt_html = sprint(show, MIME("text/html"), x) + plt_html = sprint(show, MIME("text/html"), plt) return WebIO.render(dom"div"(innerHTML=plt_html)) end end From f62f4806c3af8be8c358c47a97376c78d54165f5 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 30 Mar 2020 23:49:29 +0200 Subject: [PATCH 5/5] remove some more `Any` in `series.jl` --- src/series.jl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/series.jl b/src/series.jl index e2ae1057..699d885f 100644 --- a/src/series.jl +++ b/src/series.jl @@ -65,8 +65,10 @@ process_fillrange(range, plotattributes) = series_vector(range, plotattributes) process_ribbon(ribbon::Number, plotattributes) = [ribbon] process_ribbon(ribbon, plotattributes) = series_vector(ribbon, plotattributes) # ribbon as a tuple: (lower_ribbons, upper_ribbons) -process_ribbon(ribbon::Tuple{Any,Any}, plotattributes) = collect(zip(series_vector(ribbon[1], plotattributes), - series_vector(ribbon[2], plotattributes))) +process_ribbon(ribbon::Tuple{S, T}, plotattributes) where {S, T} = collect(zip( + series_vector(ribbon[1], plotattributes), + series_vector(ribbon[2], plotattributes), +)) # -------------------------------------------------------------------- @@ -166,7 +168,7 @@ struct SliceIt end end # this is the default "type recipe"... just pass the object through -@recipe f(::Type{T}, v::T) where {T<:Any} = v +@recipe f(::Type{T}, v::T) where T = v # this should catch unhandled "series recipes" and error with a nice message @recipe f(::Type{V}, x, y, z) where {V<:Val} = error("The backend must not support the series type $V, and there isn't a series recipe defined.") @@ -572,13 +574,7 @@ end end @recipe function f(fs::AbstractArray{F}, xmin::Number, xmax::Number) where F<:Function xscale, yscale = [get(plotattributes, sym, :identity) for sym=(:xscale,:yscale)] - xs = Array{Any}(undef, length(fs)) - ys = Array{Any}(undef, length(fs)) - for (i, (x, y)) in enumerate(_scaled_adapted_grid(f, xscale, yscale, xmin, xmax) for f in fs) - xs[i] = x - ys[i] = y - end - xs, ys + unzip(_scaled_adapted_grid.(fs, xscale, yscale, xmin, xmax)) end @recipe f(fx::FuncOrFuncs{F}, fy::FuncOrFuncs{G}, u::AVec) where {F<:Function,G<:Function} = mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u) @recipe f(fx::FuncOrFuncs{F}, fy::FuncOrFuncs{G}, umin::Number, umax::Number, n = 200) where {F<:Function,G<:Function} = fx, fy, range(umin, stop = umax, length = n)